Browse Source

Bug Fixes for rouge Android versions/OEMs that don't behave correctly

master
Anthony Restaino 10 years ago
parent
commit
43950d4f71
  1. 4
      AndroidManifest.xml
  2. 2
      src/acr/browser/lightning/AnimatedProgressBar.java
  3. 16
      src/acr/browser/lightning/BrowserActivity.java
  4. 6
      src/acr/browser/lightning/LightningView.java

4
AndroidManifest.xml

@ -3,8 +3,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="acr.browser.lightning" package="acr.browser.lightning"
android:versionCode="69" android:versionCode="70"
android:versionName="4.0.1a" > android:versionName="4.0.2a" >
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" /> <uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />

2
src/acr/browser/lightning/AnimatedProgressBar.java

@ -61,7 +61,7 @@ public class AnimatedProgressBar extends LinearLayout {
* @param attrs is the attribute set passed by the constructor * @param attrs is the attribute set passed by the constructor
*/ */
private void init(final Context context, AttributeSet attrs) { private void init(final Context context, AttributeSet attrs) {
this.setLayerType(LAYER_TYPE_HARDWARE, null);
TypedArray array = context.getTheme().obtainStyledAttributes(attrs, R.styleable.AnimatedProgressBar, 0, 0); TypedArray array = context.getTheme().obtainStyledAttributes(attrs, R.styleable.AnimatedProgressBar, 0, 0);
int backgroundColor; int backgroundColor;
int progressColor; int progressColor;

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

@ -1185,7 +1185,7 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
} }
} }
protected synchronized void newTab(String url, boolean show) { protected synchronized boolean newTab(String url, boolean show) {
mIsNewIntent = false; mIsNewIntent = false;
LightningView startingTab = new LightningView(mActivity, url); LightningView startingTab = new LightningView(mActivity, url);
if (mIdGenerator == 0) { if (mIdGenerator == 0) {
@ -1199,6 +1199,7 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
mDrawerListLeft.setItemChecked(mWebViews.size() - 1, true); mDrawerListLeft.setItemChecked(mWebViews.size() - 1, true);
showTab(startingTab); showTab(startingTab);
} }
return true;
} }
private synchronized void deleteTab(int position) { private synchronized void deleteTab(int position) {
@ -2064,9 +2065,9 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
Message click = mClickHandler.obtainMessage(); Message click = mClickHandler.obtainMessage();
if (click != null) { if (click != null) {
click.setTarget(mClickHandler); click.setTarget(mClickHandler);
}
mCurrentView.getWebView().requestFocusNodeHref(click); mCurrentView.getWebView().requestFocusNodeHref(click);
} }
}
@Override @Override
public void onShowCustomView(View view, int requestedOrientation, CustomViewCallback callback) { public void onShowCustomView(View view, int requestedOrientation, CustomViewCallback callback) {
@ -2077,7 +2078,11 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
callback.onCustomViewHidden(); callback.onCustomViewHidden();
return; return;
} }
try{
view.setKeepScreenOn(true); view.setKeepScreenOn(true);
} catch (SecurityException e){
Log.e(Constants.TAG, "WebView is not allowed to keep the screen on");
}
mOriginalOrientation = getRequestedOrientation(); mOriginalOrientation = getRequestedOrientation();
FrameLayout decor = (FrameLayout) getWindow().getDecorView(); FrameLayout decor = (FrameLayout) getWindow().getDecorView();
mFullscreenContainer = new FullscreenHolder(this); mFullscreenContainer = new FullscreenHolder(this);
@ -2103,7 +2108,11 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
} }
Log.d(Constants.TAG, "onHideCustomView"); Log.d(Constants.TAG, "onHideCustomView");
mCurrentView.setVisibility(View.VISIBLE); mCurrentView.setVisibility(View.VISIBLE);
try{
mCustomView.setKeepScreenOn(false); mCustomView.setKeepScreenOn(false);
} catch (SecurityException e){
Log.e(Constants.TAG, "WebView is not allowed to keep the screen on");
}
setFullscreen(mPreferences.getBoolean(PreferenceConstants.HIDE_STATUS_BAR, false)); setFullscreen(mPreferences.getBoolean(PreferenceConstants.HIDE_STATUS_BAR, false));
FrameLayout decor = (FrameLayout) getWindow().getDecorView(); FrameLayout decor = (FrameLayout) getWindow().getDecorView();
if (decor != null) { if (decor != null) {
@ -2217,11 +2226,12 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
if (resultMsg == null) { if (resultMsg == null) {
return; return;
} }
newTab("", true); if (newTab("", true)) {
WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj; WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
transport.setWebView(mCurrentView.getWebView()); transport.setWebView(mCurrentView.getWebView());
resultMsg.sendToTarget(); resultMsg.sendToTarget();
} }
}
@Override @Override
/** /**

6
src/acr/browser/lightning/LightningView.java

@ -329,7 +329,13 @@ public class LightningView {
mTextReflow = true; mTextReflow = true;
mSettings.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS); mSettings.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
if (API >= android.os.Build.VERSION_CODES.KITKAT) { if (API >= android.os.Build.VERSION_CODES.KITKAT) {
try {
mSettings.setLayoutAlgorithm(LayoutAlgorithm.TEXT_AUTOSIZING); mSettings.setLayoutAlgorithm(LayoutAlgorithm.TEXT_AUTOSIZING);
} catch (Exception e) {
// This shouldn't be necessary, but there are a number
// of KitKat devices that crash trying to set this
Log.e(Constants.TAG, "Problem setting LayoutAlgorithm to TEXT_AUTOSIZING");
}
} }
} else { } else {
mTextReflow = false; mTextReflow = false;

Loading…
Cancel
Save