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. 28
      src/acr/browser/lightning/BrowserActivity.java
  4. 8
      src/acr/browser/lightning/LightningView.java

4
AndroidManifest.xml

@ -3,8 +3,8 @@ @@ -3,8 +3,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="acr.browser.lightning"
android:versionCode="69"
android:versionName="4.0.1a" >
android:versionCode="70"
android:versionName="4.0.2a" >
<uses-permission android:name="android.permission.INTERNET" />
<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 { @@ -61,7 +61,7 @@ public class AnimatedProgressBar extends LinearLayout {
* @param attrs is the attribute set passed by the constructor
*/
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);
int backgroundColor;
int progressColor;

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

@ -1185,7 +1185,7 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -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;
LightningView startingTab = new LightningView(mActivity, url);
if (mIdGenerator == 0) {
@ -1199,6 +1199,7 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -1199,6 +1199,7 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
mDrawerListLeft.setItemChecked(mWebViews.size() - 1, true);
showTab(startingTab);
}
return true;
}
private synchronized void deleteTab(int position) {
@ -1594,7 +1595,7 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -1594,7 +1595,7 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
filter = new ColorMatrixColorFilter(colorMatrix);
paint.setColorFilter(filter);
}
c.drawBitmap(favicon, 0, 0, paint);
holder.favicon.setImageBitmap(grayscaleBitmap);
}
@ -2064,8 +2065,8 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -2064,8 +2065,8 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
Message click = mClickHandler.obtainMessage();
if (click != null) {
click.setTarget(mClickHandler);
mCurrentView.getWebView().requestFocusNodeHref(click);
}
mCurrentView.getWebView().requestFocusNodeHref(click);
}
@Override
@ -2077,7 +2078,11 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -2077,7 +2078,11 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
callback.onCustomViewHidden();
return;
}
view.setKeepScreenOn(true);
try{
view.setKeepScreenOn(true);
} catch (SecurityException e){
Log.e(Constants.TAG, "WebView is not allowed to keep the screen on");
}
mOriginalOrientation = getRequestedOrientation();
FrameLayout decor = (FrameLayout) getWindow().getDecorView();
mFullscreenContainer = new FullscreenHolder(this);
@ -2103,7 +2108,11 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -2103,7 +2108,11 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
}
Log.d(Constants.TAG, "onHideCustomView");
mCurrentView.setVisibility(View.VISIBLE);
mCustomView.setKeepScreenOn(false);
try{
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));
FrameLayout decor = (FrameLayout) getWindow().getDecorView();
if (decor != null) {
@ -2217,10 +2226,11 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -2217,10 +2226,11 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
if (resultMsg == null) {
return;
}
newTab("", true);
WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
transport.setWebView(mCurrentView.getWebView());
resultMsg.sendToTarget();
if (newTab("", true)) {
WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
transport.setWebView(mCurrentView.getWebView());
resultMsg.sendToTarget();
}
}
@Override

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

@ -329,7 +329,13 @@ public class LightningView { @@ -329,7 +329,13 @@ public class LightningView {
mTextReflow = true;
mSettings.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
if (API >= android.os.Build.VERSION_CODES.KITKAT) {
mSettings.setLayoutAlgorithm(LayoutAlgorithm.TEXT_AUTOSIZING);
try {
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 {
mTextReflow = false;

Loading…
Cancel
Save