diff options
| author | Harsh Shandilya <me@msfjarvis.dev> | 2020-12-05 06:07:18 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-05 06:07:18 +0530 |
| commit | 5e66d99c852ea67a88b650c03b0e8d55e83eccde (patch) | |
| tree | aee323a08253fe7b863976eff92a1bd412bd1430 /app/src/main/java/com/zeapo/pwdstore/Application.kt | |
| parent | 8eb55f18a11d6b2f155c7c9d48ca833313ee13db (diff) | |
| download | HardenedPass-5e66d99c852ea67a88b650c03b0e8d55e83eccde.tar.gz HardenedPass-5e66d99c852ea67a88b650c03b0e8d55e83eccde.zip | |
Refactor package structure (#1233)
* idea: default test runner to Gradle
* Kick off package structure revamp
* Reparent all classes under dev.msfjarvis.aps
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/Application.kt')
| -rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/Application.kt | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/Application.kt b/app/src/main/java/com/zeapo/pwdstore/Application.kt deleted file mode 100644 index 3f3963d0..00000000 --- a/app/src/main/java/com/zeapo/pwdstore/Application.kt +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright © 2014-2020 The Android Password Store Authors. All Rights Reserved. - * SPDX-License-Identifier: GPL-3.0-only - */ -package com.zeapo.pwdstore - -import android.content.SharedPreferences -import androidx.appcompat.app.AppCompatDelegate -import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY -import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM -import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO -import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES -import com.github.ajalt.timberkt.Timber.DebugTree -import com.github.ajalt.timberkt.Timber.plant -import com.zeapo.pwdstore.git.sshj.setUpBouncyCastleForSshj -import com.zeapo.pwdstore.utils.PreferenceKeys -import com.zeapo.pwdstore.utils.ProxyUtils -import com.zeapo.pwdstore.utils.getString -import com.zeapo.pwdstore.utils.sharedPrefs - -@Suppress("Unused") -class Application : android.app.Application(), SharedPreferences.OnSharedPreferenceChangeListener { - - private val prefs by lazy { sharedPrefs } - - override fun onCreate() { - super.onCreate() - instance = this - if (BuildConfig.ENABLE_DEBUG_FEATURES || - prefs.getBoolean(PreferenceKeys.ENABLE_DEBUG_LOGGING, false)) { - plant(DebugTree()) - } - prefs.registerOnSharedPreferenceChangeListener(this) - setNightMode() - setUpBouncyCastleForSshj() - runMigrations(applicationContext) - ProxyUtils.setDefaultProxy() - } - - override fun onTerminate() { - prefs.unregisterOnSharedPreferenceChangeListener(this) - super.onTerminate() - } - - override fun onSharedPreferenceChanged(prefs: SharedPreferences, key: String) { - if (key == PreferenceKeys.APP_THEME) { - setNightMode() - } - } - - private fun setNightMode() { - AppCompatDelegate.setDefaultNightMode(when (prefs.getString(PreferenceKeys.APP_THEME) - ?: getString(R.string.app_theme_def)) { - "light" -> MODE_NIGHT_NO - "dark" -> MODE_NIGHT_YES - "follow_system" -> MODE_NIGHT_FOLLOW_SYSTEM - else -> MODE_NIGHT_AUTO_BATTERY - }) - } - - companion object { - - lateinit var instance: Application - } -} |
