Java Code Examples for android.webkit.WebView#getTitle()

The following examples show how to use android.webkit.WebView#getTitle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LightningView.java    From browser with GNU General Public License v2.0 9 votes vote down vote up
@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();
}
 
Example 2
Source File: LightningWebClient.java    From Xndroid with GNU General Public License v3.0 8 votes vote down vote up
@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);
}
 
Example 3
Source File: LightningWebClient.java    From JumpGo with Mozilla Public License 2.0 6 votes vote down vote up
@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);
}
 
Example 4
Source File: VenvyWebView.java    From VideoOS-Android-SDK with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String getTitle() {
    if (mAgentWeb == null || mAgentWeb.getWebCreator() == null) {
        return null;
    }
    WebView webView = mAgentWeb.getWebCreator().getWebView();
    return webView != null ? webView.getTitle() : null;
}
 
Example 5
Source File: HtmlActivity.java    From AFBaseLibrary with Apache License 2.0 5 votes vote down vote up
@Override
public void onPageFinished(WebView view, String url) {
    super.onPageFinished(view, url);
    if (tvTitle != null && TextUtils.isEmpty(title)) {
        title = view.getTitle();
        tvTitle.setText(view.getTitle());
    }
}
 
Example 6
Source File: WebViewIdlingResource.java    From aws-device-farm-sample-app-for-android with Apache License 2.0 5 votes vote down vote up
/**
 * Updates the progress
 *
 * @param view the webview
 * @param newProgress the current progress
 */
@Override
public void onProgressChanged(WebView view, int newProgress) {
    Log.i(getName(), ""  + newProgress);
    if (newProgress == FINISHED && view.getTitle() != null && resourceCallback != null) {
        resourceCallback.onTransitionToIdle();
    }
}
 
Example 7
Source File: WebBrowserActivity.java    From Dashchan with Apache License 2.0 5 votes vote down vote up
@Override
public void onPageFinished(WebView view, String url) {
	String title = view.getTitle();
	if (StringUtils.isEmptyOrWhitespace(title)) {
		setTitle(R.string.action_browser);
	} else {
		setTitle(view.getTitle());
	}
}