-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #717 from grote/ask-if-restore
Ask on first run if user wants restore
- Loading branch information
Showing
7 changed files
with
82 additions
and
28 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
app/src/main/java/com/stevesoltys/seedvault/settings/FirstRunFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 The Calyx Institute | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package com.stevesoltys.seedvault.settings | ||
|
||
import android.app.Dialog | ||
import android.content.DialogInterface | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.fragment.app.DialogFragment | ||
import com.google.android.material.dialog.MaterialAlertDialogBuilder | ||
import com.stevesoltys.seedvault.R | ||
import com.stevesoltys.seedvault.restore.RestoreActivity | ||
|
||
class FirstRunFragment : DialogFragment() { | ||
|
||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
return MaterialAlertDialogBuilder(requireContext()) | ||
.setMessage(R.string.first_start_text) | ||
.setPositiveButton(R.string.setup_button) { dialog, _ -> | ||
parentFragmentManager.beginTransaction() | ||
.replace(R.id.fragment, SettingsFragment(), null) | ||
.commit() | ||
dialog.dismiss() | ||
} | ||
.setNeutralButton(R.string.restore_backup_button) { dialog, _ -> | ||
val i = Intent(requireContext(), RestoreActivity::class.java) | ||
startActivity(i) | ||
dialog.dismiss() | ||
requireActivity().finish() | ||
} | ||
.create() | ||
} | ||
|
||
override fun onCancel(dialog: DialogInterface) { | ||
requireActivity().finish() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters