SW: ask for import after storage permission

This commit is contained in:
Milos Kozak 2018-06-26 13:15:50 +02:00
parent 4df3561b4b
commit 2b799d9f71
3 changed files with 20 additions and 17 deletions

View file

@ -98,14 +98,7 @@ public class SWDefinition {
add(new SWScreen(R.string.nav_setupwizard) add(new SWScreen(R.string.nav_setupwizard)
.add(new SWInfotext() .add(new SWInfotext()
.label(R.string.welcometosetupwizard)) .label(R.string.welcometosetupwizard))
.add(new SWButton() )
.text(R.string.nav_import)
.action(() -> ImportExportPrefs.importSharedPreferences(getActivity()))
.visibility(ImportExportPrefs.file::exists))
.add(new SWInfotext()
.label(R.string.backupismissing)
.visibility(() -> !ImportExportPrefs.file.exists()))
)
.add(new SWScreen(R.string.language) .add(new SWScreen(R.string.language)
.skippable(false) .skippable(false)
.add(new SWRadioButton() .add(new SWRadioButton()
@ -169,6 +162,15 @@ public class SWDefinition {
.visibility(() -> Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE)) .visibility(() -> Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE))
.validator(() -> !(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE))) .validator(() -> !(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE)))
) )
.add(new SWScreen(R.string.nav_import)
.add(new SWInfotext()
.label(R.string.storedsettingsfound))
.add(new SWBreak())
.add(new SWButton()
.text(R.string.nav_import)
.action(() -> ImportExportPrefs.importSharedPreferences(getActivity())))
.visibility(() -> ImportExportPrefs.file.exists() && !(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE)))
)
.add(new SWScreen(R.string.nsclientinternal_title) .add(new SWScreen(R.string.nsclientinternal_title)
.skippable(true) .skippable(true)
.add(new SWInfotext() .add(new SWInfotext()
@ -446,13 +448,6 @@ public class SWDefinition {
add(new SWScreen(R.string.nav_setupwizard) add(new SWScreen(R.string.nav_setupwizard)
.add(new SWInfotext() .add(new SWInfotext()
.label(R.string.welcometosetupwizard)) .label(R.string.welcometosetupwizard))
.add(new SWButton()
.text(R.string.nav_import)
.action(() -> ImportExportPrefs.importSharedPreferences(getActivity()))
.visibility(ImportExportPrefs.file::exists))
.add(new SWInfotext()
.label(R.string.backupismissing)
.visibility(() -> !ImportExportPrefs.file.exists()))
) )
.add(new SWScreen(R.string.language) .add(new SWScreen(R.string.language)
.skippable(false) .skippable(false)
@ -505,6 +500,15 @@ public class SWDefinition {
.visibility(() -> Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE)) .visibility(() -> Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE))
.validator(() -> !(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE))) .validator(() -> !(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE)))
) )
.add(new SWScreen(R.string.nav_import)
.add(new SWInfotext()
.label(R.string.storedsettingsfound))
.add(new SWBreak())
.add(new SWButton()
.text(R.string.nav_import)
.action(() -> ImportExportPrefs.importSharedPreferences(getActivity())))
.visibility(() -> ImportExportPrefs.file.exists() && !(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE)))
)
.add(new SWScreen(R.string.nsclientinternal_title) .add(new SWScreen(R.string.nsclientinternal_title)
.skippable(true) .skippable(true)
.add(new SWInfotext() .add(new SWInfotext()

View file

@ -958,7 +958,6 @@
<string name="setupwizard_objectives_description">Apăsați butonul pentru a activa Obiectivele. După terminarea procesului de setare, alegeți fereastra Obiective pentru a face AndroidAPS complet funcțional.</string> <string name="setupwizard_objectives_description">Apăsați butonul pentru a activa Obiectivele. După terminarea procesului de setare, alegeți fereastra Obiective pentru a face AndroidAPS complet funcțional.</string>
<string name="enableobjectives">Activați Obiectivele</string> <string name="enableobjectives">Activați Obiectivele</string>
<string name="apssetup">Configurați plugin APS</string> <string name="apssetup">Configurați plugin APS</string>
<string name="backupismissing">Nu există configurații exportate, decin nu se poate face import de configurații.</string>
<string name="sensitivitysetup">Configurați pluginul pentru Sensibilitate</string> <string name="sensitivitysetup">Configurați pluginul pentru Sensibilitate</string>
<string name="setupwizard_sensitivity_description">Pluginul Sensibilitate este folosit pentru estimarea sensibilității și calcularea COB. Pentru mai multe info vizitați:</string> <string name="setupwizard_sensitivity_description">Pluginul Sensibilitate este folosit pentru estimarea sensibilității și calcularea COB. Pentru mai multe info vizitați:</string>
<string name="nsclientinfotext">NSClient răspunde de conexiunea cu Nightscout. Puteți ignora această secțiune, dar nu veți putea completa obiectivele până nu îl configurați.</string> <string name="nsclientinfotext">NSClient răspunde de conexiunea cu Nightscout. Puteți ignora această secțiune, dar nu veți putea completa obiectivele până nu îl configurați.</string>

View file

@ -1122,7 +1122,6 @@
<string name="setupwizard_objectives_description">Press the button below to enable Objectives. Look in the Objectives tab, after you finish this wizard, to make AndroidAPS completely functional.\n</string> <string name="setupwizard_objectives_description">Press the button below to enable Objectives. Look in the Objectives tab, after you finish this wizard, to make AndroidAPS completely functional.\n</string>
<string name="enableobjectives">Enable Objectives</string> <string name="enableobjectives">Enable Objectives</string>
<string name="apssetup">Configure APS plugin</string> <string name="apssetup">Configure APS plugin</string>
<string name="backupismissing">Exported configuration is missing thus import configuration is not possible.\n</string>
<string name="key_setupwizard_processed" translatable="false">startupwizard_processed</string> <string name="key_setupwizard_processed" translatable="false">startupwizard_processed</string>
<string name="sensitivitysetup">Configure Sensitivity plugin</string> <string name="sensitivitysetup">Configure Sensitivity plugin</string>
<string name="setupwizard_sensitivity_description">Sensitivity plugin is used for sensitivity detection and COB calculation. For more info visit:</string> <string name="setupwizard_sensitivity_description">Sensitivity plugin is used for sensitivity detection and COB calculation. For more info visit:</string>
@ -1178,6 +1177,7 @@
<string name="largetimediff">Large time difference:\nTime in pump is off by more than 1.5 hours.\nPlease adjust the time manually on the pump and make sure that reading the history from the pump does not cause unexpected behaviour.\nIf possible, remove the history from the pump before changing the time or disable the closed loop for one DIA after the last wrong history entry but minimum one DIA from now.</string> <string name="largetimediff">Large time difference:\nTime in pump is off by more than 1.5 hours.\nPlease adjust the time manually on the pump and make sure that reading the history from the pump does not cause unexpected behaviour.\nIf possible, remove the history from the pump before changing the time or disable the closed loop for one DIA after the last wrong history entry but minimum one DIA from now.</string>
<string name="key_keep_screen_on" translatable="false">keep_screen_on</string> <string name="key_keep_screen_on" translatable="false">keep_screen_on</string>
<string name="careportal_removestartedevents">Clean AndroidAPS started</string> <string name="careportal_removestartedevents">Clean AndroidAPS started</string>
<string name="storedsettingsfound">Stored settings found</string>
<plurals name="objective_days"> <plurals name="objective_days">
<item quantity="one">%d day</item> <item quantity="one">%d day</item>