mirror of
https://codeberg.org/timelimit/timelimit-android.git
synced 2025-10-03 01:39:22 +02:00
Migrate back button handling in LockActivity and AnnoyActivity
This commit is contained in:
parent
ab6373a657
commit
09e6a30ee3
2 changed files with 11 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* TimeLimit Copyright <C> 2019 - 2021 Jonas Lochmann
|
||||
* TimeLimit Copyright <C> 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,6 +20,7 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.activity.viewModels
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
|
@ -139,6 +140,10 @@ class LockActivity : AppCompatActivity(), ActivityViewModelHolder, U2fManager.De
|
|||
|
||||
adapter.showTasksFragment = isTimeOver
|
||||
}
|
||||
|
||||
onBackPressedDispatcher.addCallback(object: OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {/* nothing to do */}
|
||||
})
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
@ -202,10 +207,5 @@ class LockActivity : AppCompatActivity(), ActivityViewModelHolder, U2fManager.De
|
|||
}
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
// do nothing because going back would open the blocked app again
|
||||
// super.onBackPressed()
|
||||
}
|
||||
|
||||
override fun onDeviceFound(device: U2FDevice) = AuthTokenLoginProcessor.process(device, getActivityViewModel())
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import android.content.pm.ApplicationInfo
|
|||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.activity.viewModels
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import io.timelimit.android.BuildConfig
|
||||
|
@ -125,6 +126,10 @@ class AnnoyActivity : AppCompatActivity(), ActivityViewModelHolder, U2fManager.D
|
|||
logic.annoyLogic.doParentTempUnlock()
|
||||
}
|
||||
}
|
||||
|
||||
onBackPressedDispatcher.addCallback(object: OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {/* nothing to do */}
|
||||
})
|
||||
}
|
||||
|
||||
private fun shutdown() {
|
||||
|
@ -134,11 +139,6 @@ class AnnoyActivity : AppCompatActivity(), ActivityViewModelHolder, U2fManager.D
|
|||
}
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
// super.onBackPressed()
|
||||
// just ignore it
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue