Browse Source

Improved TextReflow on Kitkat and up

master
Anthony Restaino 10 years ago
parent
commit
bad6872f69
  1. 29
      src/acr/browser/lightning/LightningView.java

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

@ -744,24 +744,27 @@ public class LightningView {
} }
boolean isRunning = false; private boolean mIsRunning = false;
private float mZoomScale = 0.0f;
@Override @Override
public void onScaleChanged(final WebView view, final float oldScale, final float newScale) { public void onScaleChanged(final WebView view, final float oldScale, final float newScale) {
if (view.isShown() && mTextReflow && API >= android.os.Build.VERSION_CODES.KITKAT) { if (view.isShown() && mTextReflow && API >= android.os.Build.VERSION_CODES.KITKAT) {
view.invalidate(); if (mIsRunning)
if (isRunning)
return; return;
isRunning = view.postDelayed(new Runnable() { if (Math.abs(mZoomScale - newScale) > 0.01f) {
mIsRunning = view.postDelayed(new Runnable() {
@Override
public void run() { @Override
// TODO public void run() {
view.evaluateJavascript(Constants.JAVASCRIPT_TEXT_REFLOW, null); mZoomScale = newScale;
isRunning = false; view.evaluateJavascript(Constants.JAVASCRIPT_TEXT_REFLOW, null);
} Log.d("YOLO", "SCALE CHANGING " + newScale);
mIsRunning = false;
}, 100); }
}, 100);
}
} }
} }

Loading…
Cancel
Save