mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Fix #441 - changing text size needs to call evaluateJavascript instead of loadUrl when targeting SDK >= 19
This commit is contained in:
parent
057ee82e33
commit
35170ed98c
1 changed files with 9 additions and 12 deletions
|
@ -1,12 +1,12 @@
|
|||
package com.newsblur.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebSettings.PluginState;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import com.newsblur.util.AppConstants;
|
||||
|
@ -58,16 +58,13 @@ public class NewsblurWebview extends WebView {
|
|||
super.onResume();
|
||||
}
|
||||
|
||||
public void setHandler(Handler h) {
|
||||
this.handler = h;
|
||||
loadUrl("javascript:window.onload=webview.scroll(document.body.scrollHeight)");
|
||||
public void setTextSize(float textSize) {
|
||||
Log.d("Reading", "Setting textsize to " + (AppConstants.FONT_SIZE_LOWER_BOUND + textSize));
|
||||
String script = "javascript:document.body.style.fontSize='" + (AppConstants.FONT_SIZE_LOWER_BOUND + textSize) + "em';";
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
evaluateJavascript(script, null);
|
||||
} else {
|
||||
loadUrl(script);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTextSize(float textSize) {
|
||||
Log.d("Reading", "Setting textsize to " + (AppConstants.FONT_SIZE_LOWER_BOUND + textSize));
|
||||
loadUrl("javascript:document.body.style.fontSize='" + (AppConstants.FONT_SIZE_LOWER_BOUND + textSize) + "em';");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue