Don't hide navigation bar in setup wizard
Also: Remove back button from recovery code input page Convert root back button to skip button Change-Id: I0bca13b53ac3898f2ab3b8503aaf7d2bc51a983a
This commit is contained in:
parent
b32352fbbe
commit
100666442c
11 changed files with 17 additions and 47 deletions
|
|
@ -21,8 +21,6 @@ class RestoreActivity : RequireProvisioningActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
if (isSetupWizard) hideSystemUiNavigation()
|
|
||||||
|
|
||||||
setContentView(R.layout.activity_fragment_container)
|
setContentView(R.layout.activity_fragment_container)
|
||||||
|
|
||||||
viewModel.displayFragment.observeEvent(this, { fragment ->
|
viewModel.displayFragment.observeEvent(this, { 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.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
|
||||||
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
|
||||||
|
|
@ -25,8 +24,4 @@ abstract class BackupActivity : AppCompatActivity() {
|
||||||
fragmentTransaction.commit()
|
fragmentTransaction.commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun hideSystemUiNavigation() {
|
|
||||||
window.decorView.systemUiVisibility = SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ abstract class RequireProvisioningActivity : BackupActivity() {
|
||||||
|
|
||||||
private val recoveryCodeRequest =
|
private val recoveryCodeRequest =
|
||||||
registerForActivityResult(StartActivityForResult()) { result ->
|
registerForActivityResult(StartActivityForResult()) { result ->
|
||||||
|
setResult(result.resultCode)
|
||||||
if (result.resultCode != RESULT_OK) {
|
if (result.resultCode != RESULT_OK) {
|
||||||
Log.w(TAG, "Error in activity result for requesting recovery code")
|
Log.w(TAG, "Error in activity result for requesting recovery code")
|
||||||
if (!getViewModel().recoveryCodeIsSet()) {
|
if (!getViewModel().recoveryCodeIsSet()) {
|
||||||
|
|
@ -32,6 +33,7 @@ abstract class RequireProvisioningActivity : BackupActivity() {
|
||||||
}
|
}
|
||||||
private val requestLocation =
|
private val requestLocation =
|
||||||
registerForActivityResult(StartActivityForResult()) { result ->
|
registerForActivityResult(StartActivityForResult()) { result ->
|
||||||
|
setResult(result.resultCode)
|
||||||
if (result.resultCode != RESULT_OK) {
|
if (result.resultCode != RESULT_OK) {
|
||||||
Log.w(TAG, "Error in activity result for requesting location")
|
Log.w(TAG, "Error in activity result for requesting location")
|
||||||
if (!getViewModel().validLocationIsSet()) {
|
if (!getViewModel().validLocationIsSet()) {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import android.view.WindowManager.LayoutParams.FLAG_SECURE
|
||||||
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 org.koin.androidx.viewmodel.ext.android.viewModel
|
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||||
|
|
||||||
class RecoveryCodeActivity : BackupActivity() {
|
class RecoveryCodeActivity : BackupActivity() {
|
||||||
|
|
@ -16,7 +15,6 @@ class RecoveryCodeActivity : BackupActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
if (isSetupWizard()) hideSystemUiNavigation()
|
|
||||||
window.addFlags(FLAG_SECURE)
|
window.addFlags(FLAG_SECURE)
|
||||||
|
|
||||||
setContentView(R.layout.activity_recovery_code)
|
setContentView(R.layout.activity_recovery_code)
|
||||||
|
|
@ -66,8 +64,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
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@ class RecoveryCodeInputFragment : Fragment() {
|
||||||
private lateinit var introText: TextView
|
private lateinit var introText: TextView
|
||||||
private lateinit var doneButton: Button
|
private lateinit var doneButton: Button
|
||||||
private lateinit var newCodeButton: Button
|
private lateinit var newCodeButton: Button
|
||||||
private lateinit var backView: TextView
|
|
||||||
private lateinit var wordLayout1: TextInputLayout
|
private lateinit var wordLayout1: TextInputLayout
|
||||||
private lateinit var wordLayout2: TextInputLayout
|
private lateinit var wordLayout2: TextInputLayout
|
||||||
private lateinit var wordLayout3: TextInputLayout
|
private lateinit var wordLayout3: TextInputLayout
|
||||||
|
|
@ -76,7 +75,6 @@ class RecoveryCodeInputFragment : Fragment() {
|
||||||
introText = v.findViewById(R.id.introText)
|
introText = v.findViewById(R.id.introText)
|
||||||
doneButton = v.findViewById(R.id.doneButton)
|
doneButton = v.findViewById(R.id.doneButton)
|
||||||
newCodeButton = v.findViewById(R.id.newCodeButton)
|
newCodeButton = v.findViewById(R.id.newCodeButton)
|
||||||
backView = v.findViewById(R.id.backView)
|
|
||||||
wordLayout1 = v.findViewById(R.id.wordLayout1)
|
wordLayout1 = v.findViewById(R.id.wordLayout1)
|
||||||
wordLayout2 = v.findViewById(R.id.wordLayout2)
|
wordLayout2 = v.findViewById(R.id.wordLayout2)
|
||||||
wordLayout3 = v.findViewById(R.id.wordLayout3)
|
wordLayout3 = v.findViewById(R.id.wordLayout3)
|
||||||
|
|
@ -105,8 +103,6 @@ class RecoveryCodeInputFragment : Fragment() {
|
||||||
|
|
||||||
if (viewModel.isRestore) {
|
if (viewModel.isRestore) {
|
||||||
introText.setText(R.string.recovery_code_input_intro)
|
introText.setText(R.string.recovery_code_input_intro)
|
||||||
backView.visibility = VISIBLE
|
|
||||||
backView.setOnClickListener { requireActivity().finishAfterTransition() }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val adapterLayout = android.R.layout.simple_list_item_1
|
val adapterLayout = android.R.layout.simple_list_item_1
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,6 @@ class StorageActivity : BackupActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
if (isSetupWizard()) hideSystemUiNavigation()
|
|
||||||
|
|
||||||
setContentView(R.layout.activity_fragment_container)
|
setContentView(R.layout.activity_fragment_container)
|
||||||
|
|
||||||
viewModel = if (isRestore()) {
|
viewModel = if (isRestore()) {
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import androidx.activity.result.contract.ActivityResultContracts.OpenDocumentTre
|
||||||
import androidx.annotation.RequiresPermission
|
import androidx.annotation.RequiresPermission
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.google.android.setupcompat.util.ResultCodes.RESULT_SKIP
|
||||||
import com.stevesoltys.seedvault.R
|
import com.stevesoltys.seedvault.R
|
||||||
import com.stevesoltys.seedvault.ui.INTENT_EXTRA_IS_RESTORE
|
import com.stevesoltys.seedvault.ui.INTENT_EXTRA_IS_RESTORE
|
||||||
import org.koin.androidx.viewmodel.ext.android.getSharedViewModel
|
import org.koin.androidx.viewmodel.ext.android.getSharedViewModel
|
||||||
|
|
@ -45,7 +46,7 @@ internal class StorageRootsFragment : Fragment(), StorageRootClickedListener {
|
||||||
private lateinit var divider: View
|
private lateinit var divider: View
|
||||||
private lateinit var listView: RecyclerView
|
private lateinit var listView: RecyclerView
|
||||||
private lateinit var progressBar: ProgressBar
|
private lateinit var progressBar: ProgressBar
|
||||||
private lateinit var backView: TextView
|
private lateinit var skipView: TextView
|
||||||
|
|
||||||
private val adapter by lazy { StorageRootAdapter(viewModel.isRestoreOperation, this) }
|
private val adapter by lazy { StorageRootAdapter(viewModel.isRestoreOperation, this) }
|
||||||
|
|
||||||
|
|
@ -62,7 +63,7 @@ internal class StorageRootsFragment : Fragment(), StorageRootClickedListener {
|
||||||
divider = v.findViewById(R.id.divider)
|
divider = v.findViewById(R.id.divider)
|
||||||
listView = v.findViewById(R.id.listView)
|
listView = v.findViewById(R.id.listView)
|
||||||
progressBar = v.findViewById(R.id.progressBar)
|
progressBar = v.findViewById(R.id.progressBar)
|
||||||
backView = v.findViewById(R.id.backView)
|
skipView = v.findViewById(R.id.skipView)
|
||||||
|
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
@ -78,8 +79,11 @@ internal class StorageRootsFragment : Fragment(), StorageRootClickedListener {
|
||||||
|
|
||||||
if (viewModel.isRestoreOperation) {
|
if (viewModel.isRestoreOperation) {
|
||||||
titleView.text = getString(R.string.storage_fragment_restore_title)
|
titleView.text = getString(R.string.storage_fragment_restore_title)
|
||||||
backView.visibility = VISIBLE
|
skipView.visibility = VISIBLE
|
||||||
backView.setOnClickListener { requireActivity().finishAfterTransition() }
|
skipView.setOnClickListener {
|
||||||
|
requireActivity().setResult(RESULT_SKIP)
|
||||||
|
requireActivity().finishAfterTransition()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
warningIcon.visibility = VISIBLE
|
warningIcon.visibility = VISIBLE
|
||||||
if (viewModel.hasStorageSet) {
|
if (viewModel.hasStorageSet) {
|
||||||
|
|
|
||||||
|
|
@ -71,23 +71,6 @@
|
||||||
app:layout_constraintEnd_toStartOf="@+id/newCodeButton"
|
app:layout_constraintEnd_toStartOf="@+id/newCodeButton"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/backView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?android:selectableItemBackground"
|
|
||||||
android:padding="16dp"
|
|
||||||
android:text="@string/restore_back"
|
|
||||||
android:textColor="?android:colorAccent"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/doneButton"
|
|
||||||
app:layout_constraintHorizontal_bias="0.0"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/wordList"
|
|
||||||
app:layout_constraintVertical_bias="1.0"
|
|
||||||
tools:visibility="visible" />
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/newCodeButton"
|
android:id="@+id/newCodeButton"
|
||||||
style="@style/Widget.AppCompat.Button.Borderless"
|
style="@style/Widget.AppCompat.Button.Borderless"
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?android:selectableItemBackground"
|
android:background="?android:selectableItemBackground"
|
||||||
android:padding="16dp"
|
android:padding="16dp"
|
||||||
android:text="@string/restore_skip"
|
android:text="@string/restore_skip_apps"
|
||||||
android:textColor="?android:colorAccent"
|
android:textColor="?android:colorAccent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/backView"
|
app:layout_constraintBottom_toTopOf="@+id/skipView"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/divider"
|
app:layout_constraintTop_toBottomOf="@+id/divider"
|
||||||
|
|
@ -87,18 +87,18 @@
|
||||||
style="?android:progressBarStyleLarge"
|
style="?android:progressBarStyleLarge"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/backView"
|
app:layout_constraintBottom_toTopOf="@+id/skipView"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/titleView" />
|
app:layout_constraintTop_toBottomOf="@+id/titleView" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/backView"
|
android:id="@+id/skipView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?android:selectableItemBackground"
|
android:background="?android:selectableItemBackground"
|
||||||
android:padding="16dp"
|
android:padding="16dp"
|
||||||
android:text="@string/restore_back"
|
android:text="@string/restore_skip"
|
||||||
android:textColor="?android:colorAccent"
|
android:textColor="?android:colorAccent"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
|
|
||||||
|
|
@ -148,8 +148,8 @@
|
||||||
<string name="restore_title">Restore from backup</string>
|
<string name="restore_title">Restore from backup</string>
|
||||||
<string name="restore_choose_restore_set">Choose a backup to restore</string>
|
<string name="restore_choose_restore_set">Choose a backup to restore</string>
|
||||||
<string name="restore_restore_set_times">Last backup %1$s · First %2$s.</string>
|
<string name="restore_restore_set_times">Last backup %1$s · First %2$s.</string>
|
||||||
<string name="restore_back">Don\'t restore</string>
|
<string name="restore_skip">Don\'t restore</string>
|
||||||
<string name="restore_skip">Skip restoring apps</string>
|
<string name="restore_skip_apps">Skip restoring apps</string>
|
||||||
<string name="restore_invalid_location_title">No backups found</string>
|
<string name="restore_invalid_location_title">No backups found</string>
|
||||||
<string name="restore_invalid_location_message">We could not find any backups at this location.\n\nPlease choose another location that contains a %s folder.</string>
|
<string name="restore_invalid_location_message">We could not find any backups at this location.\n\nPlease choose another location that contains a %s folder.</string>
|
||||||
<string name="restore_set_error">An error occurred while loading the backups.</string>
|
<string name="restore_set_error">An error occurred while loading the backups.</string>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue