From c52d3724426ae8b832dd5c4f5a937e5c44e9a58a Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Mon, 20 Jan 2020 11:49:30 -0300 Subject: [PATCH] Don't make the app immersive in SetupWizard Fixes third item in #63 --- .../stevesoltys/seedvault/restore/RestoreActivity.kt | 2 -- .../com/stevesoltys/seedvault/ui/BackupActivity.kt | 11 ++--------- .../seedvault/ui/RequireProvisioningActivity.kt | 2 +- .../seedvault/ui/recoverycode/RecoveryCodeActivity.kt | 11 ++--------- .../seedvault/ui/storage/StorageActivity.kt | 2 -- 5 files changed, 5 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreActivity.kt b/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreActivity.kt index ff911602..98fb9f0e 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreActivity.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreActivity.kt @@ -19,8 +19,6 @@ class RestoreActivity : RequireProvisioningActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - if (isSetupWizard) hideSystemUI() - setContentView(R.layout.activity_fragment_container) viewModel.displayFragment.observeEvent(this, LiveEventHandler { fragment -> diff --git a/app/src/main/java/com/stevesoltys/seedvault/ui/BackupActivity.kt b/app/src/main/java/com/stevesoltys/seedvault/ui/BackupActivity.kt index 918a54c1..97378027 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/ui/BackupActivity.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/ui/BackupActivity.kt @@ -1,7 +1,6 @@ package com.stevesoltys.seedvault.ui import android.view.MenuItem -import android.view.View import androidx.annotation.CallSuper import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.Fragment @@ -10,8 +9,8 @@ import com.stevesoltys.seedvault.R abstract class BackupActivity : AppCompatActivity() { @CallSuper - override fun onOptionsItemSelected(item: MenuItem): Boolean = when { - item.itemId == android.R.id.home -> { + override fun onOptionsItemSelected(item: MenuItem): Boolean = when (item.itemId) { + android.R.id.home -> { onBackPressed() true } @@ -25,10 +24,4 @@ abstract class BackupActivity : AppCompatActivity() { 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) - } - } diff --git a/app/src/main/java/com/stevesoltys/seedvault/ui/RequireProvisioningActivity.kt b/app/src/main/java/com/stevesoltys/seedvault/ui/RequireProvisioningActivity.kt index cffe2bfc..bf129ef7 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/ui/RequireProvisioningActivity.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/ui/RequireProvisioningActivity.kt @@ -24,7 +24,7 @@ private val TAG = RequireProvisioningActivity::class.java.name */ abstract class RequireProvisioningActivity : BackupActivity() { - protected val isSetupWizard: Boolean + private val isSetupWizard: Boolean get() = intent?.action == ACTION_SETUP_WIZARD protected abstract fun getViewModel(): RequireProvisioningViewModel diff --git a/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeActivity.kt b/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeActivity.kt index 210f2640..dcfc7605 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeActivity.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeActivity.kt @@ -5,7 +5,6 @@ import android.view.MenuItem import com.stevesoltys.seedvault.R import com.stevesoltys.seedvault.ui.BackupActivity 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 org.koin.androidx.viewmodel.ext.android.viewModel @@ -16,8 +15,6 @@ class RecoveryCodeActivity : BackupActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - if (isSetupWizard()) hideSystemUI() - setContentView(R.layout.activity_recovery_code) viewModel.isRestore = isRestore() @@ -38,8 +35,8 @@ class RecoveryCodeActivity : BackupActivity() { } override fun onOptionsItemSelected(item: MenuItem): Boolean { - return when { - item.itemId == android.R.id.home -> { + return when (item.itemId) { + android.R.id.home -> { onBackPressed() true } @@ -65,8 +62,4 @@ class RecoveryCodeActivity : BackupActivity() { return intent?.getBooleanExtra(INTENT_EXTRA_IS_RESTORE, false) ?: false } - private fun isSetupWizard(): Boolean { - return intent?.getBooleanExtra(INTENT_EXTRA_IS_SETUP_WIZARD, false) ?: false - } - } diff --git a/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageActivity.kt b/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageActivity.kt index 7534c19b..d03a77e7 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageActivity.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageActivity.kt @@ -22,8 +22,6 @@ class StorageActivity : BackupActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - if (isSetupWizard()) hideSystemUI() - setContentView(R.layout.activity_fragment_container) viewModel = if (isRestore()) {