本文整理匯總了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);
}