Bug 801412 - Add pref to always restore session. r=wesj

This commit is contained in:
Brian Nicholson 2013-07-11 14:03:12 -07:00
Родитель 577f3c9c71
Коммит 25f0aab929
5 изменённых файлов: 16 добавлений и 1 удалений

Просмотреть файл

@ -59,6 +59,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.PowerManager;
import android.os.StrictMode;
import android.preference.PreferenceManager;
import android.provider.ContactsContract;
import android.telephony.CellLocation;
@ -1693,7 +1694,8 @@ abstract public class GeckoApp
});
restoreMode = RESTORE_NORMAL;
} else if (savedInstanceState != null) {
} else if (savedInstanceState != null ||
PreferenceManager.getDefaultSharedPreferences(this).getBoolean(GeckoPreferences.PREFS_RESTORE_SESSION, false)) {
restoreMode = RESTORE_NORMAL;
}

Просмотреть файл

@ -75,6 +75,8 @@ public class GeckoPreferences
private static String PREFS_GEO_REPORTING = "app.geo.reportdata";
private static String PREFS_HEALTHREPORT_LINK = NON_PREF_PREFIX + "healthreport.link";
public static String PREFS_RESTORE_SESSION = NON_PREF_PREFIX + "restoreSession";
// These values are chosen to be distinct from other Activity constants.
private static int REQUEST_CODE_PREF_SCREEN = 5;
private static int RESULT_CODE_EXIT_SETTINGS = 6;
@ -456,6 +458,10 @@ public class GeckoPreferences
// Translate boolean value to int for geo reporting pref.
PrefsHelper.setPref(prefName, (Boolean) newValue ? 1 : 0);
return true;
} else if (PREFS_RESTORE_SESSION.equals(prefName)) {
// Do nothing else; the pref will be persisted in the shared prefs,
// and it will be read at startup in Java before a session restore.
return true;
}
if (!TextUtils.isEmpty(prefName)) {

Просмотреть файл

@ -115,6 +115,7 @@
<!ENTITY pref_plugins_disabled "Disabled">
<!ENTITY pref_text_size "Text size">
<!ENTITY pref_reflow_on_zoom3 "Double tap to reflow text">
<!ENTITY pref_restore_session "Always restore tabs">
<!ENTITY pref_font_size_tiny "Tiny">
<!ENTITY pref_font_size_small "Small">
<!ENTITY pref_font_size_medium "Medium">

Просмотреть файл

@ -22,6 +22,11 @@
android:defaultValue="true"
android:persistent="false" />
<CheckBoxPreference android:key="android.not_a_preference.restoreSession"
android:title="@string/pref_restore_session"
android:defaultValue="false"
android:persistent="true" />
<ListPreference android:key="app.update.autodownload"
android:title="@string/pref_update_autodownload"
android:entries="@array/pref_update_autodownload_entries"

Просмотреть файл

@ -120,6 +120,7 @@
<string name="pref_font_size_adjust_char">&pref_font_size_adjust_char;</string>
<string name="pref_font_size_preview_text">&pref_font_size_preview_text;</string>
<string name="pref_reflow_on_zoom">&pref_reflow_on_zoom3;</string>
<string name="pref_restore_session">&pref_restore_session;</string>
<string name="pref_show_product_announcements">&pref_show_product_announcements;</string>
<string name="pref_sync">&pref_sync;</string>
<string name="pref_search_suggestions">&pref_search_suggestions;</string>