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
android:name="com.stevesoltys.seedvault.settings.SettingsActivity"
android:exported="true"
android:permission=""
tools:replace="android:permission" />
tools:remove="android:permission" />
<activity
android:name="com.stevesoltys.seedvault.restore.RestoreActivity"
android:exported="true"
android:permission=""
tools:replace="android:permission" />
tools:remove="android:permission" />
</application>
</manifest>

View file

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

View file

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