From 2b799d9f71a4449327fc509cece90281a97af046 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 26 Jun 2018 13:15:50 +0200 Subject: [PATCH] SW: ask for import after storage permission --- .../androidaps/setupwizard/SWDefinition.java | 34 +++++++++++-------- app/src/main/res/values-ro/strings.xml | 1 - app/src/main/res/values/strings.xml | 2 +- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java b/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java index ccca95440a..a8402dc1a5 100644 --- a/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java +++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java @@ -98,14 +98,7 @@ public class SWDefinition { add(new SWScreen(R.string.nav_setupwizard) .add(new SWInfotext() .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) .skippable(false) .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)) .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) .skippable(true) .add(new SWInfotext() @@ -446,13 +448,6 @@ public class SWDefinition { add(new SWScreen(R.string.nav_setupwizard) .add(new SWInfotext() .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) .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)) .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) .skippable(true) .add(new SWInfotext() diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 8cd757d949..2a80de2bbf 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -958,7 +958,6 @@ Apăsați butonul pentru a activa Obiectivele. După terminarea procesului de setare, alegeți fereastra Obiective pentru a face AndroidAPS complet funcțional. Activați Obiectivele Configurați plugin APS - Nu există configurații exportate, decin nu se poate face import de configurații. Configurați pluginul pentru Sensibilitate Pluginul Sensibilitate este folosit pentru estimarea sensibilității și calcularea COB. Pentru mai multe info vizitați: 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. diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c903f341a2..b940b328a1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1122,7 +1122,6 @@ Press the button below to enable Objectives. Look in the Objectives tab, after you finish this wizard, to make AndroidAPS completely functional.\n Enable Objectives Configure APS plugin - Exported configuration is missing thus import configuration is not possible.\n startupwizard_processed Configure Sensitivity plugin Sensitivity plugin is used for sensitivity detection and COB calculation. For more info visit: @@ -1178,6 +1177,7 @@ 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. keep_screen_on Clean AndroidAPS started + Stored settings found %d day