SW autostart SetupWizard

This commit is contained in:
Milos Kozak 2018-05-11 13:14:59 +02:00
parent ff2cc04408
commit 4fae6c703c
4 changed files with 13 additions and 3 deletions

View file

@ -90,6 +90,12 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
} }
askForBatteryOptimizationPermission(); askForBatteryOptimizationPermission();
doMigrations(); doMigrations();
if (!SP.getBoolean(R.string.key_setupwizard_processed, false)) {
Intent intent = new Intent(this, SetupWizardActivity.class);
startActivity(intent);
}
if (Config.logFunctionCalls) if (Config.logFunctionCalls)
log.debug("onCreate"); log.debug("onCreate");

View file

@ -8,7 +8,6 @@ import com.squareup.otto.Subscribe;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -79,7 +78,10 @@ public class SWDefinition {
.visibility(() -> !ImportExportPrefs.file.exists())) .visibility(() -> !ImportExportPrefs.file.exists()))
.add(new SWButton() .add(new SWButton()
.text(R.string.exitwizard) .text(R.string.exitwizard)
.action(() -> getActivity().finish())) .action(() -> {
SP.putBoolean(R.string.key_setupwizard_processed, true);
getActivity().finish();
}))
) )
.add(new SWScreen(R.string.language) .add(new SWScreen(R.string.language)
.skippable(false) .skippable(false)

View file

@ -25,6 +25,7 @@ import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientS
import info.nightscout.androidaps.startupwizard.events.EventSWUpdate; import info.nightscout.androidaps.startupwizard.events.EventSWUpdate;
import info.nightscout.utils.LocaleHelper; import info.nightscout.utils.LocaleHelper;
import info.nightscout.utils.OKDialog; import info.nightscout.utils.OKDialog;
import info.nightscout.utils.SP;
public class SetupWizardActivity extends AppCompatActivity { public class SetupWizardActivity extends AppCompatActivity {
//logging //logging
@ -155,6 +156,7 @@ public class SetupWizardActivity extends AppCompatActivity {
// Go back to overview // Go back to overview
public void finishSetupWizard(View view) { public void finishSetupWizard(View view) {
SP.putBoolean(R.string.key_setupwizard_processed, true);
Intent intent = new Intent(this, MainActivity.class); Intent intent = new Intent(this, MainActivity.class);
startActivity(intent); startActivity(intent);
} }

View file

@ -1070,5 +1070,5 @@
<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="backupismissing">Exported configuration is missing thus import configuration is not possible.\n</string>
<string name="key_setupwizard_processed" translatable="false">startupwizard_processed</string>
</resources> </resources>