INNER CODE UNIT · Kotlin

onCreate

fumiama/copymanga · app/src/main/java/top/fumiama/copymanga/MainActivity.kt:84

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(null)

        val darkModePrefKey = getString(R.string.darkModeKeyID)
        PreferenceManager.getDefaultSharedPreferences(this)?.apply {
            if (contains(darkModePrefKey)) getString(darkModePrefKey, "0")?.toInt()?.let {
                if (it > 0) {
                    AppCompatDelegate.setDefaultNightMode(listOf(
                        AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM,
                        AppCompatDelegate.MODE_NIGHT_NO,
                        AppCompatDelegate.MODE_NIGHT_YES,
                    )[it])
                }
            }
        }

        // must init before setContentView because HomeF need them to init
        mainWeakReference = WeakReference(this)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…