Compare commits
1 commit
75fe24e825
...
8591f035a4
Author | SHA1 | Date | |
---|---|---|---|
8591f035a4 |
2 changed files with 13 additions and 0 deletions
|
@ -3,6 +3,7 @@ package im.angry.openeuicc.ui.wizard
|
||||||
import android.app.assist.AssistContent
|
import android.app.assist.AssistContent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.view.WindowManager
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import android.widget.ProgressBar
|
import android.widget.ProgressBar
|
||||||
|
@ -315,5 +316,11 @@ class DownloadWizardActivity: BaseEuiccAccessActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun beforeNext() {}
|
open fun beforeNext() {}
|
||||||
|
|
||||||
|
protected fun setKeepScreenOn(enabled: Boolean) {
|
||||||
|
val flags = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
|
||||||
|
val window = (requireActivity() as DownloadWizardActivity).window
|
||||||
|
if (enabled) window.addFlags(flags) else window.clearFlags(flags)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -96,6 +96,7 @@ class DownloadWizardProgressFragment : DownloadWizardActivity.DownloadWizardStep
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
super.onStart()
|
super.onStart()
|
||||||
|
setKeepScreenOn(true)
|
||||||
|
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
showProgressBar(-1) // set indeterminate first
|
showProgressBar(-1) // set indeterminate first
|
||||||
|
@ -140,6 +141,11 @@ class DownloadWizardProgressFragment : DownloadWizardActivity.DownloadWizardStep
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onStop() {
|
||||||
|
super.onStop()
|
||||||
|
setKeepScreenOn(false)
|
||||||
|
}
|
||||||
|
|
||||||
private suspend fun startDownloadOrSubscribe(): EuiccChannelManagerService.ForegroundTaskSubscriberFlow? =
|
private suspend fun startDownloadOrSubscribe(): EuiccChannelManagerService.ForegroundTaskSubscriberFlow? =
|
||||||
if (state.downloadStarted) {
|
if (state.downloadStarted) {
|
||||||
// This will also return null if task ID is -1 (uninitialized), too
|
// This will also return null if task ID is -1 (uninitialized), too
|
||||||
|
|
Loading…
Add table
Reference in a new issue