Added option for empty user agent if the user sets an empty string to work around webview limitations

This commit is contained in:
Anthony Restaino 2015-08-25 20:19:38 -04:00
parent dd18526ddf
commit 04c9f75a90
2 changed files with 9 additions and 3 deletions

View File

@ -737,7 +737,8 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
if (mSearch.hasFocus()) {
searchTheWeb(mSearch.getText().toString());
}
} else if ((keyCode == KeyEvent.KEYCODE_MENU) && (Build.VERSION.SDK_INT <= 16)
} else if ((keyCode == KeyEvent.KEYCODE_MENU)
&& (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN)
&& (Build.MANUFACTURER.compareTo("LGE") == 0)) {
// Workaround for stupid LG devices that crash
return true;
@ -747,7 +748,8 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
@Override
public boolean onKeyUp(int keyCode, @NonNull KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_MENU) && (Build.VERSION.SDK_INT <= 16)
if ((keyCode == KeyEvent.KEYCODE_MENU)
&& (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN)
&& (Build.MANUFACTURER.compareTo("LGE") == 0)) {
// Workaround for stupid LG devices that crash
openOptionsMenu();

View File

@ -365,7 +365,11 @@ public class LightningView {
settings.setUserAgentString(Constants.MOBILE_USER_AGENT);
break;
case 4:
settings.setUserAgentString(mPreferences.getUserAgentString(mDefaultUserAgent));
String ua = mPreferences.getUserAgentString(mDefaultUserAgent);
if (ua == null || ua.isEmpty()) {
ua = " ";
}
settings.setUserAgentString(ua);
break;
}
}