Remove permission requirement in a better way for debug builds

and reformat some SettingsFragment details
This commit is contained in:
Torsten Grote 2022-10-14 16:33:04 -03:00 committed by Chirayu Desai
parent c6a77904a6
commit 374ba8b64f
3 changed files with 10 additions and 12 deletions

View file

@ -7,13 +7,11 @@
<activity <activity
android:name="com.stevesoltys.seedvault.settings.SettingsActivity" android:name="com.stevesoltys.seedvault.settings.SettingsActivity"
android:exported="true" android:exported="true"
android:permission="" tools:remove="android:permission" />
tools:replace="android:permission" />
<activity <activity
android:name="com.stevesoltys.seedvault.restore.RestoreActivity" android:name="com.stevesoltys.seedvault.restore.RestoreActivity"
android:exported="true" android:exported="true"
android:permission="" tools:remove="android:permission" />
tools:replace="android:permission" />
</application> </application>
</manifest> </manifest>

View file

@ -130,14 +130,14 @@ class SettingsFragment : PreferenceFragmentCompat() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
viewModel.lastBackupTime.observe(viewLifecycleOwner, { time -> viewModel.lastBackupTime.observe(viewLifecycleOwner) { time ->
setAppBackupStatusSummary(time) setAppBackupStatusSummary(time)
}) }
val backupFiles: Preference = findPreference("backup_files")!! val backupFiles: Preference = findPreference("backup_files")!!
viewModel.filesSummary.observe(viewLifecycleOwner, { summary -> viewModel.filesSummary.observe(viewLifecycleOwner) { summary ->
backupFiles.summary = summary backupFiles.summary = summary
}) }
} }
override fun onStart() { override fun onStart() {
@ -160,10 +160,10 @@ class SettingsFragment : PreferenceFragmentCompat() {
if (resources.getBoolean(R.bool.show_restore_in_settings)) { if (resources.getBoolean(R.bool.show_restore_in_settings)) {
menuRestore?.isVisible = true menuRestore?.isVisible = true
} }
viewModel.backupPossible.observe(viewLifecycleOwner, { possible -> viewModel.backupPossible.observe(viewLifecycleOwner) { possible ->
menuBackupNow?.isEnabled = possible menuBackupNow?.isEnabled = possible
menuRestore?.isEnabled = possible menuRestore?.isEnabled = possible
}) }
} }
override fun onOptionsItemSelected(item: MenuItem): Boolean = when (item.itemId) { override fun onOptionsItemSelected(item: MenuItem): Boolean = when (item.itemId) {

View file

@ -193,9 +193,9 @@ internal class SettingsViewModel(
@UiThread @UiThread
fun loadFilesSummary() = viewModelScope.launch { fun loadFilesSummary() = viewModelScope.launch {
val uriSummary = storageBackup.getUriSummaryString() val uriSummary = storageBackup.getUriSummaryString()
_filesSummary.value = if (uriSummary.isEmpty()) { _filesSummary.value = uriSummary.ifEmpty {
app.getString(R.string.settings_backup_files_summary) app.getString(R.string.settings_backup_files_summary)
} else uriSummary }
} }
/** /**