本文整理汇总了Java中android.webkit.WebView.postDelayed方法的典型用法代码示例。如果您正苦于以下问题:Java WebView.postDelayed方法的具体用法?Java WebView.postDelayed怎么用?Java WebView.postDelayed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.webkit.WebView
的用法示例。
在下文中一共展示了WebView.postDelayed方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onScaleChanged
import android.webkit.WebView; //导入方法依赖的package包/类
@Override
public void onScaleChanged(final WebView view, final float oldScale, final float newScale) {
if (view.isShown() && mTextReflow && API >= android.os.Build.VERSION_CODES.KITKAT) {
if (mIsRunning)
return;
if (Math.abs(mZoomScale - newScale) > 0.01f) {
mIsRunning = view.postDelayed(new Runnable() {
@Override
public void run() {
mZoomScale = newScale;
view.evaluateJavascript(Constants.JAVASCRIPT_TEXT_REFLOW, null);
mIsRunning = false;
}
}, 100);
}
}
}
示例2: onProgressChanged
import android.webkit.WebView; //导入方法依赖的package包/类
@Override
public void onProgressChanged(WebView view, int newProgress) {
fragment.getProgressBar().setProgress(newProgress);
if (newProgress == 100) {
view.postDelayed(new Runnable() {
@Override
public void run() {
fragment.getProgressBar().setVisibility(View.GONE);
}
}, 500);
} else {
if (fragment.getProgressBar().getVisibility() == View.GONE) {
fragment.getProgressBar().setVisibility(View.VISIBLE);
}
}
}
示例3: onScaleChanged
import android.webkit.WebView; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public void onScaleChanged(@NonNull final WebView view, final float oldScale, final float newScale) {
if (view.isShown() && mLightningView.mPreferences.getTextReflowEnabled() &&
Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
if (mIsRunning)
return;
float changeInPercent = Math.abs(100 - 100 / mZoomScale * newScale);
if (changeInPercent > 2.5f && !mIsRunning) {
mIsRunning = view.postDelayed(new Runnable() {
@Override
public void run() {
mZoomScale = newScale;
view.evaluateJavascript(Constants.JAVASCRIPT_TEXT_REFLOW, new ValueCallback<String>() {
@Override
public void onReceiveValue(String value) {
mIsRunning = false;
}
});
}
}, 100);
}
}
}
示例4: closeInputKeyboard
import android.webkit.WebView; //导入方法依赖的package包/类
/**
* 控制键盘显隐,如果输入法在窗口上已经显示,则隐藏,反之则显示
*/
public static void closeInputKeyboard(final IQuickFragment webLoader, WebView wv, JSONObject param, final Callback callback) {
wv.postDelayed(new Runnable() {
public void run() {
DeviceUtil.hideInputKeyboard(webLoader.getPageControl().getActivity());
callback.applySuccess();
}
}, 200);
}
示例5: onPageStarted
import android.webkit.WebView; //导入方法依赖的package包/类
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
mDone = false;
// 当webview加载2秒后强制回馈完成
view.postDelayed(this, 2800);
}