Add option to start directly into web gui (fixes #578)

This commit is contained in:
Felix Ableitner 2017-09-04 02:01:24 +09:00
parent f2071be81c
commit 3ddf526679
3 changed files with 21 additions and 4 deletions

View File

@ -60,11 +60,18 @@ public class FirstStartActivity extends Activity implements Button.OnClickListen
if (isFirstStart) {
mPreferences.edit().putBoolean("first_start", false).apply();
}
Intent intent = new Intent(this, MainActivity.class);
intent.putExtra(MainActivity.EXTRA_FIRST_START, isFirstStart);
startActivity(intent);
finish();
// In case start_into_web_gui option is enabled, start both activities so that back
// navigation works as expected.
Intent mainIntent = new Intent(this, MainActivity.class);
mainIntent.putExtra(MainActivity.EXTRA_FIRST_START, isFirstStart);
Intent webIntent = new Intent(this, WebGuiActivity.class);
if (mPreferences.getBoolean("start_into_web_gui", false)) {
startActivities(new Intent[] {mainIntent, webIntent});
} else {
startActivity(mainIntent);
}
finish();
}
private boolean haveStoragePermission() {

View File

@ -277,6 +277,10 @@ Please report any problems you encounter via Github.</string>
<string name="preference_language_summary">Change the app language</string>
<string name="start_into_web_gui_title">Start directly into web GUI</string>
<string name="start_into_web_gui_summary">When starting the app, open web GUI instead of the main screen</string>
<string name="pref_language_default">Default Language</string>
<string-array name="versioning_types">

View File

@ -54,6 +54,12 @@
android:title="@string/preference_language_title"
android:summary="@string/preference_language_summary" />
<CheckBoxPreference
android:key="start_into_web_gui"
android:title="@string/start_into_web_gui_title"
android:summary="@string/start_into_web_gui_summary"
android:defaultValue="false"/>
</PreferenceScreen>
<PreferenceScreen