Fix bug where you couldn't turn flash on on supported devices
This commit is contained in:
parent
5dfc948fd3
commit
4e3193bfc8
@ -5,6 +5,7 @@ package acr.browser.lightning.fragment;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.preference.CheckBoxPreference;
|
import android.preference.CheckBoxPreference;
|
||||||
@ -101,7 +102,7 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
|||||||
proxy.setSummary(mProxyChoices[choice]);
|
proxy.setSummary(mProxyChoices[choice]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (API >= 19) {
|
if (API >= Build.VERSION_CODES.KITKAT) {
|
||||||
mPreferenceManager.setFlashSupport(0);
|
mPreferenceManager.setFlashSupport(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +139,7 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
|||||||
boolean enableJSBool = mPreferenceManager.getJavaScriptEnabled();
|
boolean enableJSBool = mPreferenceManager.getJavaScriptEnabled();
|
||||||
|
|
||||||
cbAds.setEnabled(Constants.FULL_VERSION);
|
cbAds.setEnabled(Constants.FULL_VERSION);
|
||||||
cbFlash.setEnabled(API < 19);
|
cbFlash.setEnabled(API < Build.VERSION_CODES.KITKAT);
|
||||||
|
|
||||||
cbImages.setChecked(imagesBool);
|
cbImages.setChecked(imagesBool);
|
||||||
cbJsScript.setChecked(enableJSBool);
|
cbJsScript.setChecked(enableJSBool);
|
||||||
@ -343,7 +344,8 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
|||||||
if (!mHomepage.startsWith("about:")) {
|
if (!mHomepage.startsWith("about:")) {
|
||||||
getHome.setText(mHomepage);
|
getHome.setText(mHomepage);
|
||||||
} else {
|
} else {
|
||||||
getHome.setText("http://www.google.com");
|
String defaultUrl = "http://www.google.com";
|
||||||
|
getHome.setText(defaultUrl);
|
||||||
}
|
}
|
||||||
homePicker.setView(getHome);
|
homePicker.setView(getHome);
|
||||||
homePicker.setPositiveButton(getResources().getString(R.string.action_ok),
|
homePicker.setPositiveButton(getResources().getString(R.string.action_ok),
|
||||||
@ -526,44 +528,38 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
// switch preferences
|
boolean checked = (Boolean) newValue;
|
||||||
switch (preference.getKey()) {
|
switch (preference.getKey()) {
|
||||||
case SETTINGS_FLASH:
|
case SETTINGS_FLASH:
|
||||||
if (cbFlash.isChecked()) {
|
if (!Utils.isFlashInstalled(mActivity) && checked) {
|
||||||
getFlashChoice();
|
|
||||||
} else {
|
|
||||||
mPreferenceManager.setFlashSupport(0);
|
|
||||||
}
|
|
||||||
if (!Utils.isFlashInstalled(mActivity) && cbFlash.isChecked()) {
|
|
||||||
Utils.createInformativeDialog(mActivity, R.string.title_warning, R.string.dialog_adobe_not_installed);
|
Utils.createInformativeDialog(mActivity, R.string.title_warning, R.string.dialog_adobe_not_installed);
|
||||||
cbFlash.setEnabled(false);
|
|
||||||
mPreferenceManager.setFlashSupport(0);
|
mPreferenceManager.setFlashSupport(0);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
if (checked) {
|
||||||
|
getFlashChoice();
|
||||||
|
} else {
|
||||||
|
mPreferenceManager.setFlashSupport(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cbFlash.setChecked((Boolean) newValue);
|
|
||||||
return true;
|
return true;
|
||||||
case SETTINGS_ADS:
|
case SETTINGS_ADS:
|
||||||
mPreferenceManager.setAdBlockEnabled((Boolean) newValue);
|
mPreferenceManager.setAdBlockEnabled(checked);
|
||||||
cbAds.setChecked((Boolean) newValue);
|
|
||||||
return true;
|
return true;
|
||||||
case SETTINGS_IMAGES:
|
case SETTINGS_IMAGES:
|
||||||
mPreferenceManager.setBlockImagesEnabled((Boolean) newValue);
|
mPreferenceManager.setBlockImagesEnabled(checked);
|
||||||
cbImages.setChecked((Boolean) newValue);
|
|
||||||
return true;
|
return true;
|
||||||
case SETTINGS_JAVASCRIPT:
|
case SETTINGS_JAVASCRIPT:
|
||||||
mPreferenceManager.setJavaScriptEnabled((Boolean) newValue);
|
mPreferenceManager.setJavaScriptEnabled(checked);
|
||||||
cbJsScript.setChecked((Boolean) newValue);
|
|
||||||
return true;
|
return true;
|
||||||
case SETTINGS_COLORMODE:
|
case SETTINGS_COLORMODE:
|
||||||
mPreferenceManager.setColorModeEnabled((Boolean) newValue);
|
mPreferenceManager.setColorModeEnabled(checked);
|
||||||
cbColorMode.setChecked((Boolean) newValue);
|
|
||||||
return true;
|
return true;
|
||||||
case SETTINGS_GOOGLESUGGESTIONS:
|
case SETTINGS_GOOGLESUGGESTIONS:
|
||||||
mPreferenceManager.setGoogleSearchSuggestionsEnabled((Boolean) newValue);
|
mPreferenceManager.setGoogleSearchSuggestionsEnabled(checked);
|
||||||
cbgooglesuggest.setChecked((Boolean) newValue);
|
|
||||||
return true;
|
return true;
|
||||||
case SETTINGS_DRAWERTABS:
|
case SETTINGS_DRAWERTABS:
|
||||||
mPreferenceManager.setShowTabsInDrawer((Boolean) newValue);
|
mPreferenceManager.setShowTabsInDrawer(checked);
|
||||||
cbDrawerTabs.setChecked((Boolean) newValue);
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user