From 65905a7160cbae595aba3f05810532931042bbfb Mon Sep 17 00:00:00 2001
From: Torsten Grote <t@grobox.de>
Date: Wed, 22 Jan 2020 12:25:54 -0300
Subject: [PATCH] Hide navigation bar in SetupWizard for more visual
 consistency

---
 .../com/stevesoltys/seedvault/restore/RestoreActivity.kt   | 2 ++
 .../java/com/stevesoltys/seedvault/ui/BackupActivity.kt    | 5 +++++
 .../seedvault/ui/RequireProvisioningActivity.kt            | 2 +-
 .../seedvault/ui/recoverycode/RecoveryCodeActivity.kt      | 7 +++++++
 .../stevesoltys/seedvault/ui/storage/StorageActivity.kt    | 2 ++
 5 files changed, 17 insertions(+), 1 deletion(-)

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 98fb9f0e..ff911602 100644
--- a/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreActivity.kt
+++ b/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreActivity.kt
@@ -19,6 +19,8 @@ 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 97378027..7f0d7edf 100644
--- a/app/src/main/java/com/stevesoltys/seedvault/ui/BackupActivity.kt
+++ b/app/src/main/java/com/stevesoltys/seedvault/ui/BackupActivity.kt
@@ -1,6 +1,7 @@
 package com.stevesoltys.seedvault.ui
 
 import android.view.MenuItem
+import android.view.View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
 import androidx.annotation.CallSuper
 import androidx.appcompat.app.AppCompatActivity
 import androidx.fragment.app.Fragment
@@ -24,4 +25,8 @@ abstract class BackupActivity : AppCompatActivity() {
         fragmentTransaction.commit()
     }
 
+    protected fun hideSystemUI() {
+        window.decorView.systemUiVisibility = SYSTEM_UI_FLAG_HIDE_NAVIGATION
+    }
+
 }
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 bf129ef7..cffe2bfc 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() {
 
-    private val isSetupWizard: Boolean
+    protected 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 dcfc7605..61270454 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,6 +5,7 @@ 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
 
@@ -15,6 +16,8 @@ class RecoveryCodeActivity : BackupActivity() {
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
 
+        if (isSetupWizard()) hideSystemUI()
+
         setContentView(R.layout.activity_recovery_code)
 
         viewModel.isRestore = isRestore()
@@ -62,4 +65,8 @@ 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 d03a77e7..7534c19b 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,6 +22,8 @@ class StorageActivity : BackupActivity() {
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
 
+        if (isSetupWizard()) hideSystemUI()
+
         setContentView(R.layout.activity_fragment_container)
 
         viewModel = if (isRestore()) {