本文整理汇总了Java中android.webkit.WebView.isShown方法的典型用法代码示例。如果您正苦于以下问题:Java WebView.isShown方法的具体用法?Java WebView.isShown怎么用?Java WebView.isShown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.webkit.WebView
的用法示例。
在下文中一共展示了WebView.isShown方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPageFinished
import android.webkit.WebView; //导入方法依赖的package包/类
@Override
public void onPageFinished(WebView view, String url) {
if (view.isShown()) {
mBrowserController.updateUrl(url, true);
view.postInvalidate();
}
if (view.getTitle() == null || view.getTitle().isEmpty()) {
mTitle.setTitle(mActivity.getString(R.string.untitled));
} else {
mTitle.setTitle(view.getTitle());
}
if (API >= android.os.Build.VERSION_CODES.KITKAT && mInvertPage) {
view.evaluateJavascript(Constants.JAVASCRIPT_INVERT_PAGE, null);
}
mBrowserController.update();
}
示例2: 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);
}
}
}
示例3: onPageFinished
import android.webkit.WebView; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public void onPageFinished(@NonNull WebView view, String url) {
if (view.isShown()) {
mUIController.updateUrl(url, false);
mUIController.setBackButtonEnabled(view.canGoBack());
mUIController.setForwardButtonEnabled(view.canGoForward());
view.postInvalidate();
}
if (view.getTitle() == null || view.getTitle().isEmpty()) {
mLightningView.getTitleInfo().setTitle(mActivity.getString(R.string.untitled));
} else {
mLightningView.getTitleInfo().setTitle(view.getTitle());
}
if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT &&
mLightningView.getInvertePage()) {
view.evaluateJavascript(Constants.JAVASCRIPT_INVERT_PAGE, null);
}
mUIController.tabChanged(mLightningView);
}
示例4: 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);
}
}
}
示例5: cancel
import android.webkit.WebView; //导入方法依赖的package包/类
@Override
public void cancel() {
WebView webView = getWebView();
// If the page hasn't loaded, or the listener is already called, then we can't interrupt
// this cancellation. Either the JS won't be ready to consume the event, or the listener
// has already processed a result.
// So let's just handle this cancellation in the standard way.
if (!isPageFinished()
|| isListenerCalled()
|| webView == null
|| !webView.isShown()) {
super.cancel();
return;
}
// Return right away if we have already queued up the delayed-cancel call.
if (waitingForDialogToClose) {
return;
}
waitingForDialogToClose = true;
// Now fire off the event that will tell the dialog to wind down.
String eventJS =
"(function() {" +
" var event = document.createEvent('Event');" +
" event.initEvent('fbPlatformDialogMustClose',true,true);" +
" document.dispatchEvent(event);" +
"})();";
webView.loadUrl("javascript:" + eventJS);
// Set up a timeout for the dialog to respond. If the timer expires, we need to honor
// the user's desire to dismiss the dialog.
Handler handler = new Handler(Looper.getMainLooper());
handler.postDelayed(
new Runnable() {
@Override
public void run() {
// If we get here, then the dialog did not close quickly enough.
// So we need to honor the user's wish to cancel and we should do
// so without allowing interruptions.
FacebookWebFallbackDialog.super.cancel();
}
},
OS_BACK_BUTTON_RESPONSE_TIMEOUT_MILLISECONDS);
}