mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-14 13:08:56 +01:00
Add fingerprint to lock UI
Migrate login UI to conductor Fix batch add controller not saving EditText content onResume Prevent double-locking of lock UI Remove back button from lock UI Fix login preference not updating
This commit is contained in:
@@ -5,6 +5,7 @@ import android.content.Context
|
||||
import android.content.res.Configuration
|
||||
import android.support.multidex.MultiDex
|
||||
import com.evernote.android.job.JobManager
|
||||
import com.github.ajalt.reprint.core.Reprint
|
||||
import eu.kanade.tachiyomi.data.backup.BackupCreatorJob
|
||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
|
||||
import eu.kanade.tachiyomi.data.updater.UpdateCheckerJob
|
||||
@@ -26,6 +27,7 @@ open class App : Application() {
|
||||
|
||||
setupJobManager()
|
||||
Paper.init(this) //Setup metadata DB (EH)
|
||||
Reprint.initialize(this) //Setup fingerprint (EH)
|
||||
|
||||
LocaleHelper.updateConfiguration(this, resources.configuration)
|
||||
}
|
||||
|
||||
@@ -199,5 +199,7 @@ class PreferencesHelper(val context: Context) {
|
||||
fun lockSalt() = rxPrefs.getString("lock_salt", null)
|
||||
|
||||
fun lockLength() = rxPrefs.getInteger("lock_length", -1)
|
||||
|
||||
fun lockUseFingerprint() = rxPrefs.getBoolean("lock_finger", false)
|
||||
// <-- EH
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import rx.Observable
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.net.URLEncoder
|
||||
import java.util.*
|
||||
import exh.ui.login.LoginActivity
|
||||
import exh.ui.login.LoginController
|
||||
import exh.util.UriFilter
|
||||
import exh.util.UriGroup
|
||||
import okhttp3.CacheControl
|
||||
@@ -323,9 +323,9 @@ class EHentai(override val id: Long,
|
||||
val cookiesHeader by lazy {
|
||||
val cookies: MutableMap<String, String> = mutableMapOf()
|
||||
if(prefs.enableExhentai().getOrDefault()) {
|
||||
cookies.put(LoginActivity.MEMBER_ID_COOKIE, prefs.memberIdVal().get()!!)
|
||||
cookies.put(LoginActivity.PASS_HASH_COOKIE, prefs.passHashVal().get()!!)
|
||||
cookies.put(LoginActivity.IGNEOUS_COOKIE, prefs.igneousVal().get()!!)
|
||||
cookies.put(LoginController.MEMBER_ID_COOKIE, prefs.memberIdVal().get()!!)
|
||||
cookies.put(LoginController.PASS_HASH_COOKIE, prefs.passHashVal().get()!!)
|
||||
cookies.put(LoginController.IGNEOUS_COOKIE, prefs.igneousVal().get()!!)
|
||||
}
|
||||
|
||||
//Setup settings
|
||||
|
||||
@@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.ui.main
|
||||
import android.animation.ObjectAnimator
|
||||
import android.app.ActivityManager
|
||||
import android.app.Service
|
||||
import android.app.usage.UsageStats
|
||||
import android.app.usage.UsageStatsManager
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
@@ -15,8 +14,6 @@ import android.support.v7.graphics.drawable.DrawerArrowDrawable
|
||||
import android.view.ViewGroup
|
||||
import com.bluelinelabs.conductor.*
|
||||
import com.bluelinelabs.conductor.changehandler.FadeChangeHandler
|
||||
import com.bluelinelabs.conductor.changehandler.SimpleSwapChangeHandler
|
||||
import com.bluelinelabs.conductor.changehandler.VerticalChangeHandler
|
||||
import eu.kanade.tachiyomi.Migrations
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
@@ -40,7 +37,6 @@ import exh.ui.lock.lockEnabled
|
||||
import exh.ui.lock.notifyLockSecurity
|
||||
import kotlinx.android.synthetic.main.main_activity.*
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.util.*
|
||||
|
||||
|
||||
class MainActivity : BaseActivity() {
|
||||
@@ -49,7 +45,7 @@ class MainActivity : BaseActivity() {
|
||||
|
||||
val preferences: PreferencesHelper by injectLazy()
|
||||
|
||||
private var drawerArrow: DrawerArrowDrawable? = null
|
||||
var drawerArrow: DrawerArrowDrawable? = null
|
||||
|
||||
private var secondaryDrawer: ViewGroup? = null
|
||||
|
||||
@@ -153,6 +149,8 @@ class MainActivity : BaseActivity() {
|
||||
if (savedInstanceState == null) {
|
||||
val lockEnabled = lockEnabled(preferences)
|
||||
if (lockEnabled) {
|
||||
//Special case first lock
|
||||
toolbar.navigationIcon = null
|
||||
doLock()
|
||||
|
||||
//Check lock security
|
||||
@@ -236,6 +234,16 @@ class MainActivity : BaseActivity() {
|
||||
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED)
|
||||
}
|
||||
|
||||
// --> EH
|
||||
//Special case and hide drawer arrow for lock controller
|
||||
if(to is LockController) {
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(false)
|
||||
} else {
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
toolbar.navigationIcon = drawerArrow
|
||||
}
|
||||
// <-- EH
|
||||
|
||||
ObjectAnimator.ofFloat(drawerArrow, "progress", if (showHamburger) 0f else 1f).start()
|
||||
|
||||
if (from is TabbedController) {
|
||||
@@ -270,10 +278,9 @@ class MainActivity : BaseActivity() {
|
||||
// --> EH
|
||||
//Lock code
|
||||
var willLock = false
|
||||
var disableLock = false
|
||||
override fun onRestart() {
|
||||
super.onRestart()
|
||||
if(willLock && lockEnabled() && !disableLock) {
|
||||
if(willLock && lockEnabled()) {
|
||||
doLock()
|
||||
}
|
||||
|
||||
@@ -286,6 +293,10 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
fun tryLock() {
|
||||
//Do not double-lock
|
||||
if(router.backstack.lastOrNull()?.controller() is LockController)
|
||||
return
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
val mUsageStatsManager = getSystemService("usagestats") as UsageStatsManager
|
||||
val time = System.currentTimeMillis()
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package eu.kanade.tachiyomi.ui.setting
|
||||
|
||||
import android.content.Intent
|
||||
import android.support.v7.preference.PreferenceScreen
|
||||
import com.bluelinelabs.conductor.RouterTransaction
|
||||
import com.bluelinelabs.conductor.changehandler.FadeChangeHandler
|
||||
import exh.ui.migration.MetadataFetchDialog
|
||||
import exh.ui.login.LoginActivity
|
||||
import exh.ui.login.LoginController
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
|
||||
/**
|
||||
* EH Settings fragment
|
||||
@@ -20,9 +22,11 @@ class SettingsEhController : SettingsController() {
|
||||
isPersistent = false
|
||||
defaultValue = false
|
||||
preferences.enableExhentai()
|
||||
.asObservable().subscribeUntilDestroy {
|
||||
.asObservable()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeUntilDestroy {
|
||||
isChecked = it
|
||||
}
|
||||
}
|
||||
|
||||
onChange { newVal ->
|
||||
newVal as Boolean
|
||||
@@ -30,7 +34,9 @@ class SettingsEhController : SettingsController() {
|
||||
preferences.enableExhentai().set(false)
|
||||
true
|
||||
} else {
|
||||
startActivity(Intent(context, LoginActivity::class.java))
|
||||
router.pushController(RouterTransaction.with(LoginController())
|
||||
.pushChangeHandler(FadeChangeHandler())
|
||||
.popChangeHandler(FadeChangeHandler()))
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.app.Dialog
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.support.v7.preference.PreferenceScreen
|
||||
import android.support.v7.preference.SwitchPreference
|
||||
import android.view.View
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import eu.kanade.tachiyomi.R
|
||||
@@ -13,6 +14,7 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
import eu.kanade.tachiyomi.util.LocaleHelper
|
||||
import exh.ui.lock.FingerLockPreference
|
||||
import exh.ui.lock.LockPreference
|
||||
import kotlinx.android.synthetic.main.pref_library_columns.view.*
|
||||
import rx.Observable
|
||||
@@ -176,12 +178,25 @@ class SettingsGeneralController : SettingsController() {
|
||||
true
|
||||
}
|
||||
}
|
||||
LockPreference(context).apply {
|
||||
key = "pref_app_lock"
|
||||
preferenceCategory {
|
||||
title = "Application lock"
|
||||
isPersistent = false
|
||||
|
||||
addPreference(this)
|
||||
LockPreference(context).apply {
|
||||
key = "pref_app_lock"
|
||||
isPersistent = false
|
||||
|
||||
addPreference(this)
|
||||
}
|
||||
|
||||
FingerLockPreference(context).apply {
|
||||
key = "pref_lock_finger"
|
||||
isPersistent = false
|
||||
|
||||
addPreference(this)
|
||||
|
||||
//Call after addPreference
|
||||
dependency = "pref_app_lock"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user