Browse Source

Settings should utilize .apply() instead of .commit()

master
Anthony Restaino 10 years ago
parent
commit
7f8253b470
  1. 10
      src/acr/browser/lightning/AdvancedSettingsActivity.java
  2. 16
      src/acr/browser/lightning/DisplaySettingsActivity.java
  3. 22
      src/acr/browser/lightning/GeneralSettingsActivity.java
  4. 12
      src/acr/browser/lightning/PrivacySettingsActivity.java
  5. 32
      src/acr/browser/lightning/SettingsActivity.java

10
src/acr/browser/lightning/AdvancedSettingsActivity.java

@ -24,8 +24,6 @@ import android.widget.TextView;
public class AdvancedSettingsActivity extends ActionBarActivity { public class AdvancedSettingsActivity extends ActionBarActivity {
// mPreferences variables
private static final int API = android.os.Build.VERSION.SDK_INT;
private SharedPreferences mPreferences; private SharedPreferences mPreferences;
private SharedPreferences.Editor mEditPrefs; private SharedPreferences.Editor mEditPrefs;
private CheckBox cbAllowPopups, cbAllowCookies, cbAllowIncognitoCookies, cbRestoreTabs; private CheckBox cbAllowPopups, cbAllowCookies, cbAllowIncognitoCookies, cbRestoreTabs;
@ -119,7 +117,7 @@ public class AdvancedSettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.POPUPS, isChecked); mEditPrefs.putBoolean(PreferenceConstants.POPUPS, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
}); });
@ -131,7 +129,7 @@ public class AdvancedSettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.COOKIES, isChecked); mEditPrefs.putBoolean(PreferenceConstants.COOKIES, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
}); });
@ -143,7 +141,7 @@ public class AdvancedSettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.INCOGNITO_COOKIES, isChecked); mEditPrefs.putBoolean(PreferenceConstants.INCOGNITO_COOKIES, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
}); });
@ -155,7 +153,7 @@ public class AdvancedSettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.RESTORE_LOST_TABS, isChecked); mEditPrefs.putBoolean(PreferenceConstants.RESTORE_LOST_TABS, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
}); });

16
src/acr/browser/lightning/DisplaySettingsActivity.java

@ -4,7 +4,6 @@
package acr.browser.lightning; package acr.browser.lightning;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
@ -22,11 +21,9 @@ import android.widget.RelativeLayout;
public class DisplaySettingsActivity extends ActionBarActivity { public class DisplaySettingsActivity extends ActionBarActivity {
// mPreferences variables // mPreferences variables
private static final int API = android.os.Build.VERSION.SDK_INT;
private SharedPreferences mPreferences; private SharedPreferences mPreferences;
private SharedPreferences.Editor mEditPrefs; private SharedPreferences.Editor mEditPrefs;
private CheckBox cbHideStatusBar, cbFullScreen, cbWideViewPort, cbOverView, cbTextReflow; private CheckBox cbHideStatusBar, cbFullScreen, cbWideViewPort, cbOverView, cbTextReflow;
private Context mContext;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -49,7 +46,6 @@ public class DisplaySettingsActivity extends ActionBarActivity {
// commit() or apply() call // commit() or apply() call
mEditPrefs = mPreferences.edit(); mEditPrefs = mPreferences.edit();
mContext = this;
initialize(); initialize();
} }
@ -101,7 +97,7 @@ public class DisplaySettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.HIDE_STATUS_BAR, isChecked); mEditPrefs.putBoolean(PreferenceConstants.HIDE_STATUS_BAR, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
}); });
@ -113,7 +109,7 @@ public class DisplaySettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.FULL_SCREEN, isChecked); mEditPrefs.putBoolean(PreferenceConstants.FULL_SCREEN, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
}); });
@ -126,7 +122,7 @@ public class DisplaySettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.USE_WIDE_VIEWPORT, isChecked); mEditPrefs.putBoolean(PreferenceConstants.USE_WIDE_VIEWPORT, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
}); });
@ -138,7 +134,7 @@ public class DisplaySettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.OVERVIEW_MODE, isChecked); mEditPrefs.putBoolean(PreferenceConstants.OVERVIEW_MODE, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
}); });
@ -150,7 +146,7 @@ public class DisplaySettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.TEXT_REFLOW, isChecked); mEditPrefs.putBoolean(PreferenceConstants.TEXT_REFLOW, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
}); });
} }
@ -229,7 +225,7 @@ public class DisplaySettingsActivity extends ActionBarActivity {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
mEditPrefs.putInt(PreferenceConstants.TEXT_SIZE, which + 1); mEditPrefs.putInt(PreferenceConstants.TEXT_SIZE, which + 1);
mEditPrefs.commit(); mEditPrefs.apply();
} }
}); });

22
src/acr/browser/lightning/GeneralSettingsActivity.java

@ -187,7 +187,7 @@ public class GeneralSettingsActivity extends ActionBarActivity {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
mEditPrefs.putInt(PreferenceConstants.SEARCH, which); mEditPrefs.putInt(PreferenceConstants.SEARCH, which);
mEditPrefs.commit(); mEditPrefs.apply();
switch (which) { switch (which) {
case 0: case 0:
searchUrlPicker(); searchUrlPicker();
@ -255,7 +255,7 @@ public class GeneralSettingsActivity extends ActionBarActivity {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
String text = getSearchUrl.getText().toString(); String text = getSearchUrl.getText().toString();
mEditPrefs.putString(PreferenceConstants.SEARCH_URL, text); mEditPrefs.putString(PreferenceConstants.SEARCH_URL, text);
mEditPrefs.commit(); mEditPrefs.apply();
mSearchText.setText(getResources().getString(R.string.custom_url) + ": " mSearchText.setText(getResources().getString(R.string.custom_url) + ": "
+ text); + text);
} }
@ -277,7 +277,7 @@ public class GeneralSettingsActivity extends ActionBarActivity {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
mEditPrefs.putInt(PreferenceConstants.USER_AGENT, which + 1); mEditPrefs.putInt(PreferenceConstants.USER_AGENT, which + 1);
mEditPrefs.commit(); mEditPrefs.apply();
switch (which + 1) { switch (which + 1) {
case 1: case 1:
mAgentTextView.setText(getResources().getString( mAgentTextView.setText(getResources().getString(
@ -337,7 +337,7 @@ public class GeneralSettingsActivity extends ActionBarActivity {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
String text = getAgent.getText().toString(); String text = getAgent.getText().toString();
mEditPrefs.putString(PreferenceConstants.USER_AGENT_STRING, text); mEditPrefs.putString(PreferenceConstants.USER_AGENT_STRING, text);
mEditPrefs.commit(); mEditPrefs.apply();
mAgentTextView.setText(getResources().getString(R.string.agent_custom)); mAgentTextView.setText(getResources().getString(R.string.agent_custom));
} }
}); });
@ -372,7 +372,7 @@ public class GeneralSettingsActivity extends ActionBarActivity {
mEditPrefs.putString( mEditPrefs.putString(
PreferenceConstants.DOWNLOAD_DIRECTORY, PreferenceConstants.DOWNLOAD_DIRECTORY,
Environment.DIRECTORY_DOWNLOADS); Environment.DIRECTORY_DOWNLOADS);
mEditPrefs.commit(); mEditPrefs.apply();
mDownloadTextView.setText(Constants.EXTERNAL_STORAGE + '/' mDownloadTextView.setText(Constants.EXTERNAL_STORAGE + '/'
+ Environment.DIRECTORY_DOWNLOADS); + Environment.DIRECTORY_DOWNLOADS);
break; break;
@ -415,7 +415,7 @@ public class GeneralSettingsActivity extends ActionBarActivity {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
String text = getHome.getText().toString(); String text = getHome.getText().toString();
mEditPrefs.putString(PreferenceConstants.HOMEPAGE, text); mEditPrefs.putString(PreferenceConstants.HOMEPAGE, text);
mEditPrefs.commit(); mEditPrefs.apply();
mHomepageText.setText(text); mHomepageText.setText(text);
} }
}); });
@ -461,7 +461,7 @@ public class GeneralSettingsActivity extends ActionBarActivity {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
String text = getDownload.getText().toString(); String text = getDownload.getText().toString();
mEditPrefs.putString(PreferenceConstants.DOWNLOAD_DIRECTORY, text); mEditPrefs.putString(PreferenceConstants.DOWNLOAD_DIRECTORY, text);
mEditPrefs.commit(); mEditPrefs.apply();
mDownloadTextView.setText(Constants.EXTERNAL_STORAGE + '/' + text); mDownloadTextView.setText(Constants.EXTERNAL_STORAGE + '/' + text);
} }
}); });
@ -498,21 +498,21 @@ public class GeneralSettingsActivity extends ActionBarActivity {
case 1: case 1:
mEditPrefs.putString(PreferenceConstants.HOMEPAGE, mEditPrefs.putString(PreferenceConstants.HOMEPAGE,
"about:home"); "about:home");
mEditPrefs.commit(); mEditPrefs.apply();
mHomepageText.setText(getResources().getString( mHomepageText.setText(getResources().getString(
R.string.action_homepage)); R.string.action_homepage));
break; break;
case 2: case 2:
mEditPrefs.putString(PreferenceConstants.HOMEPAGE, mEditPrefs.putString(PreferenceConstants.HOMEPAGE,
"about:blank"); "about:blank");
mEditPrefs.commit(); mEditPrefs.apply();
mHomepageText.setText(getResources().getString( mHomepageText.setText(getResources().getString(
R.string.action_blank)); R.string.action_blank));
break; break;
case 3: case 3:
mEditPrefs.putString(PreferenceConstants.HOMEPAGE, mEditPrefs.putString(PreferenceConstants.HOMEPAGE,
"about:bookmarks"); "about:bookmarks");
mEditPrefs.commit(); mEditPrefs.apply();
mHomepageText.setText(getResources().getString( mHomepageText.setText(getResources().getString(
R.string.action_bookmarks)); R.string.action_bookmarks));
@ -544,7 +544,7 @@ public class GeneralSettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.GOOGLE_SEARCH_SUGGESTIONS, isChecked); mEditPrefs.putBoolean(PreferenceConstants.GOOGLE_SEARCH_SUGGESTIONS, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
}); });

12
src/acr/browser/lightning/PrivacySettingsActivity.java

@ -188,7 +188,7 @@ public class PrivacySettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.LOCATION, isChecked); mEditPrefs.putBoolean(PreferenceConstants.LOCATION, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
}); });
@ -200,7 +200,7 @@ public class PrivacySettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.SAVE_PASSWORDS, isChecked); mEditPrefs.putBoolean(PreferenceConstants.SAVE_PASSWORDS, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
}); });
@ -212,7 +212,7 @@ public class PrivacySettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.CLEAR_CACHE_EXIT, isChecked); mEditPrefs.putBoolean(PreferenceConstants.CLEAR_CACHE_EXIT, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
}); });
@ -224,7 +224,7 @@ public class PrivacySettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.CLEAR_HISTORY_EXIT, isChecked); mEditPrefs.putBoolean(PreferenceConstants.CLEAR_HISTORY_EXIT, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
}); });
@ -236,7 +236,7 @@ public class PrivacySettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.BLOCK_THIRD_PARTY, isChecked); mEditPrefs.putBoolean(PreferenceConstants.BLOCK_THIRD_PARTY, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
}); });
@ -248,7 +248,7 @@ public class PrivacySettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.CLEAR_COOKIES_EXIT, isChecked); mEditPrefs.putBoolean(PreferenceConstants.CLEAR_COOKIES_EXIT, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
}); });

32
src/acr/browser/lightning/SettingsActivity.java

@ -88,7 +88,7 @@ public class SettingsActivity extends ActionBarActivity {
if (API >= 19) { if (API >= 19) {
mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 0); mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 0);
mEditPrefs.commit(); mEditPrefs.apply();
} }
int flashNum = mPreferences.getInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 0); int flashNum = mPreferences.getInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 0);
boolean imagesBool = mPreferences.getBoolean(PreferenceConstants.BLOCK_IMAGES, false); boolean imagesBool = mPreferences.getBoolean(PreferenceConstants.BLOCK_IMAGES, false);
@ -204,7 +204,7 @@ public class SettingsActivity extends ActionBarActivity {
getFlashChoice(); getFlashChoice();
} else { } else {
mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 0); mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 0);
mEditPrefs.commit(); mEditPrefs.apply();
} }
boolean flashInstalled = false; boolean flashInstalled = false;
@ -223,7 +223,7 @@ public class SettingsActivity extends ActionBarActivity {
.getString(R.string.dialog_adobe_not_installed)); .getString(R.string.dialog_adobe_not_installed));
buttonView.setChecked(false); buttonView.setChecked(false);
mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 0); mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 0);
mEditPrefs.commit(); mEditPrefs.apply();
} else if ((API >= 17) && isChecked) { } else if ((API >= 17) && isChecked) {
Utils.createInformativeDialog(SettingsActivity.this, Utils.createInformativeDialog(SettingsActivity.this,
@ -238,7 +238,7 @@ public class SettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.BLOCK_ADS, isChecked); mEditPrefs.putBoolean(PreferenceConstants.BLOCK_ADS, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
}); });
@ -247,7 +247,7 @@ public class SettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.BLOCK_IMAGES, isChecked); mEditPrefs.putBoolean(PreferenceConstants.BLOCK_IMAGES, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
@ -257,7 +257,7 @@ public class SettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.JAVASCRIPT, isChecked); mEditPrefs.putBoolean(PreferenceConstants.JAVASCRIPT, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
@ -272,7 +272,7 @@ public class SettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.USE_PROXY, isChecked); mEditPrefs.putBoolean(PreferenceConstants.USE_PROXY, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
@ -282,7 +282,7 @@ public class SettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.ENABLE_COLOR_MODE, isChecked); mEditPrefs.putBoolean(PreferenceConstants.ENABLE_COLOR_MODE, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
@ -299,7 +299,7 @@ public class SettingsActivity extends ActionBarActivity {
@Override @Override
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 1); mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 1);
mEditPrefs.commit(); mEditPrefs.apply();
} }
}) })
.setNegativeButton(getResources().getString(R.string.action_auto), .setNegativeButton(getResources().getString(R.string.action_auto),
@ -308,14 +308,14 @@ public class SettingsActivity extends ActionBarActivity {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 2); mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 2);
mEditPrefs.commit(); mEditPrefs.apply();
} }
}).setOnCancelListener(new OnCancelListener() { }).setOnCancelListener(new OnCancelListener() {
@Override @Override
public void onCancel(DialogInterface dialog) { public void onCancel(DialogInterface dialog) {
mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 0); mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 0);
mEditPrefs.commit(); mEditPrefs.apply();
} }
}); });
@ -333,7 +333,7 @@ public class SettingsActivity extends ActionBarActivity {
n = 1; n = 1;
} }
mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, n); mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, n);
mEditPrefs.commit(); mEditPrefs.apply();
boolean flashInstalled = false; boolean flashInstalled = false;
try { try {
PackageManager pm = getPackageManager(); PackageManager pm = getPackageManager();
@ -350,7 +350,7 @@ public class SettingsActivity extends ActionBarActivity {
.getString(R.string.dialog_adobe_not_installed)); .getString(R.string.dialog_adobe_not_installed));
buttonView.setChecked(false); buttonView.setChecked(false);
mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 0); mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 0);
mEditPrefs.commit(); mEditPrefs.apply();
} else if ((API > 17) && isChecked) { } else if ((API > 17) && isChecked) {
Utils.createInformativeDialog(SettingsActivity.this, Utils.createInformativeDialog(SettingsActivity.this,
@ -365,7 +365,7 @@ public class SettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.BLOCK_IMAGES, isChecked); mEditPrefs.putBoolean(PreferenceConstants.BLOCK_IMAGES, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
@ -375,7 +375,7 @@ public class SettingsActivity extends ActionBarActivity {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.JAVASCRIPT, isChecked); mEditPrefs.putBoolean(PreferenceConstants.JAVASCRIPT, isChecked);
mEditPrefs.commit(); mEditPrefs.apply();
} }
@ -396,7 +396,7 @@ public class SettingsActivity extends ActionBarActivity {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
String text = getAgent.getText().toString(); String text = getAgent.getText().toString();
mEditPrefs.putString(PreferenceConstants.USER_AGENT_STRING, text); mEditPrefs.putString(PreferenceConstants.USER_AGENT_STRING, text);
mEditPrefs.commit(); mEditPrefs.apply();
getAgent.setText(getResources().getString(R.string.agent_custom)); getAgent.setText(getResources().getString(R.string.agent_custom));
} }
}); });

Loading…
Cancel
Save