made press twice to exit an option (see #356)
This commit is contained in:
parent
899d59d38f
commit
ba24a79c34
@ -44,6 +44,8 @@
|
|||||||
<string name="pref_force_desktop_sum">Nice for tablets, looks awful on smartphones</string>
|
<string name="pref_force_desktop_sum">Nice for tablets, looks awful on smartphones</string>
|
||||||
<string name="pref_force_https">Force https</string>
|
<string name="pref_force_https">Force https</string>
|
||||||
<string name="pref_force_https_sum">Disabling may improve performance</string>
|
<string name="pref_force_https_sum">Disabling may improve performance</string>
|
||||||
|
<string name="pref_press_twice_to_exit">Press back button twice to exit</string>
|
||||||
|
<string name="pref_press_twice_to_exit_sum">Avoids accidental exits</string>
|
||||||
<string name="pref_developer_options">Developer options</string>
|
<string name="pref_developer_options">Developer options</string>
|
||||||
<string name="pref_enable_dev_mode">Enable developer mode</string>
|
<string name="pref_enable_dev_mode">Enable developer mode</string>
|
||||||
<string name="pref_enable_dev_mode_sum">If enabled, all IITC sources will be loaded from external storage of the Android device.
|
<string name="pref_enable_dev_mode_sum">If enabled, all IITC sources will be loaded from external storage of the Android device.
|
||||||
|
@ -50,6 +50,11 @@
|
|||||||
android:title="@string/pref_force_https"
|
android:title="@string/pref_force_https"
|
||||||
android:summary="@string/pref_force_https_sum"
|
android:summary="@string/pref_force_https_sum"
|
||||||
android:defaultValue="true" />
|
android:defaultValue="true" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="pref_press_twice_to_exit"
|
||||||
|
android:title="@string/pref_press_twice_to_exit"
|
||||||
|
android:summary="@string/pref_press_twice_to_exit_sum"
|
||||||
|
android:defaultValue="false" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
|
@ -50,6 +50,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
private boolean desktop = false;
|
private boolean desktop = false;
|
||||||
private boolean reload_needed = false;
|
private boolean reload_needed = false;
|
||||||
private ArrayList<String> dialogStack = new ArrayList<String>();
|
private ArrayList<String> dialogStack = new ArrayList<String>();
|
||||||
|
private SharedPreferences sharedPref;
|
||||||
|
|
||||||
// Used for custom back stack handling
|
// Used for custom back stack handling
|
||||||
private ArrayList<Integer> backStack = new ArrayList<Integer>();
|
private ArrayList<Integer> backStack = new ArrayList<Integer>();
|
||||||
@ -80,7 +81,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
actionBar.setHomeButtonEnabled(true);
|
actionBar.setHomeButtonEnabled(true);
|
||||||
|
|
||||||
// do something if user changed something in the settings
|
// do something if user changed something in the settings
|
||||||
SharedPreferences sharedPref = PreferenceManager
|
sharedPref = PreferenceManager
|
||||||
.getDefaultSharedPreferences(this);
|
.getDefaultSharedPreferences(this);
|
||||||
listener = new OnSharedPreferenceChangeListener() {
|
listener = new OnSharedPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -106,6 +107,10 @@ public class IITC_Mobile extends Activity {
|
|||||||
// no iitc reload needed here
|
// no iitc reload needed here
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// no reload needed
|
||||||
|
if (key.equals("pref_press_twice_to_exit"))
|
||||||
|
return;
|
||||||
|
|
||||||
reload_needed = true;
|
reload_needed = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -287,7 +292,7 @@ public class IITC_Mobile extends Activity {
|
|||||||
// Pop last item from backStack and pretend the relevant menu item was clicked
|
// Pop last item from backStack and pretend the relevant menu item was clicked
|
||||||
backStackPop();
|
backStackPop();
|
||||||
} else {
|
} else {
|
||||||
if (back_button_pressed)
|
if (back_button_pressed || !sharedPref.getBoolean("pref_press_twice_to_exit", false))
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
else {
|
else {
|
||||||
back_button_pressed = true;
|
back_button_pressed = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user