parent
324da2a9e9
commit
c52d372442
5 changed files with 5 additions and 23 deletions
|
@ -19,8 +19,6 @@ class RestoreActivity : RequireProvisioningActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
if (isSetupWizard) hideSystemUI()
|
|
||||||
|
|
||||||
setContentView(R.layout.activity_fragment_container)
|
setContentView(R.layout.activity_fragment_container)
|
||||||
|
|
||||||
viewModel.displayFragment.observeEvent(this, LiveEventHandler { fragment ->
|
viewModel.displayFragment.observeEvent(this, LiveEventHandler { fragment ->
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.stevesoltys.seedvault.ui
|
package com.stevesoltys.seedvault.ui
|
||||||
|
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
|
||||||
import androidx.annotation.CallSuper
|
import androidx.annotation.CallSuper
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
|
@ -10,8 +9,8 @@ import com.stevesoltys.seedvault.R
|
||||||
abstract class BackupActivity : AppCompatActivity() {
|
abstract class BackupActivity : AppCompatActivity() {
|
||||||
|
|
||||||
@CallSuper
|
@CallSuper
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean = when {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean = when (item.itemId) {
|
||||||
item.itemId == android.R.id.home -> {
|
android.R.id.home -> {
|
||||||
onBackPressed()
|
onBackPressed()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
@ -25,10 +24,4 @@ abstract class BackupActivity : AppCompatActivity() {
|
||||||
fragmentTransaction.commit()
|
fragmentTransaction.commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun hideSystemUI() {
|
|
||||||
window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_IMMERSIVE
|
|
||||||
or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
|
||||||
or View.SYSTEM_UI_FLAG_FULLSCREEN)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ private val TAG = RequireProvisioningActivity::class.java.name
|
||||||
*/
|
*/
|
||||||
abstract class RequireProvisioningActivity : BackupActivity() {
|
abstract class RequireProvisioningActivity : BackupActivity() {
|
||||||
|
|
||||||
protected val isSetupWizard: Boolean
|
private val isSetupWizard: Boolean
|
||||||
get() = intent?.action == ACTION_SETUP_WIZARD
|
get() = intent?.action == ACTION_SETUP_WIZARD
|
||||||
|
|
||||||
protected abstract fun getViewModel(): RequireProvisioningViewModel
|
protected abstract fun getViewModel(): RequireProvisioningViewModel
|
||||||
|
|
|
@ -5,7 +5,6 @@ import android.view.MenuItem
|
||||||
import com.stevesoltys.seedvault.R
|
import com.stevesoltys.seedvault.R
|
||||||
import com.stevesoltys.seedvault.ui.BackupActivity
|
import com.stevesoltys.seedvault.ui.BackupActivity
|
||||||
import com.stevesoltys.seedvault.ui.INTENT_EXTRA_IS_RESTORE
|
import com.stevesoltys.seedvault.ui.INTENT_EXTRA_IS_RESTORE
|
||||||
import com.stevesoltys.seedvault.ui.INTENT_EXTRA_IS_SETUP_WIZARD
|
|
||||||
import com.stevesoltys.seedvault.ui.LiveEventHandler
|
import com.stevesoltys.seedvault.ui.LiveEventHandler
|
||||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||||
|
|
||||||
|
@ -16,8 +15,6 @@ class RecoveryCodeActivity : BackupActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
if (isSetupWizard()) hideSystemUI()
|
|
||||||
|
|
||||||
setContentView(R.layout.activity_recovery_code)
|
setContentView(R.layout.activity_recovery_code)
|
||||||
|
|
||||||
viewModel.isRestore = isRestore()
|
viewModel.isRestore = isRestore()
|
||||||
|
@ -38,8 +35,8 @@ class RecoveryCodeActivity : BackupActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
return when {
|
return when (item.itemId) {
|
||||||
item.itemId == android.R.id.home -> {
|
android.R.id.home -> {
|
||||||
onBackPressed()
|
onBackPressed()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
@ -65,8 +62,4 @@ class RecoveryCodeActivity : BackupActivity() {
|
||||||
return intent?.getBooleanExtra(INTENT_EXTRA_IS_RESTORE, false) ?: false
|
return intent?.getBooleanExtra(INTENT_EXTRA_IS_RESTORE, false) ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isSetupWizard(): Boolean {
|
|
||||||
return intent?.getBooleanExtra(INTENT_EXTRA_IS_SETUP_WIZARD, false) ?: false
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,6 @@ class StorageActivity : BackupActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
if (isSetupWizard()) hideSystemUI()
|
|
||||||
|
|
||||||
setContentView(R.layout.activity_fragment_container)
|
setContentView(R.layout.activity_fragment_container)
|
||||||
|
|
||||||
viewModel = if (isRestore()) {
|
viewModel = if (isRestore()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue