예제 #1
0
  private void handleShareButtonClick() {
    // XXX should make Page Options button disabled if the page is not loaded yet
    // url = null case
    String webViewUrl = mainWebView.getUrl();
    if (webViewUrl == null) {
      webViewUrl = "";
    }

    // direct displaying after feed item is clicked
    // the rest will arrive as SESSION_BROWSE
    // so we should save this feed item with target redirected URL
    if (isStorySessionOrStoryUrl()) {
      DDGControlVar.mDuckDuckGoContainer.lastFeedUrl = webViewUrl;
      if (DDGControlVar.currentFeedObject != null) {
        new WebViewStoryMenuDialog(context, DDGControlVar.currentFeedObject, mainWebView.isReadable)
            .show(); //
      }
    } else if (DDGUtils.isSerpUrl(webViewUrl)) {
      new WebViewQueryMenuDialog(context, webViewUrl).show();
    } else {
      new WebViewWebPageMenuDialog(context, webViewUrl).show();
    }
  }
예제 #2
0
  public void showWebUrl(String url) {
    if (DDGControlVar.useExternalBrowser == DDGConstants.ALWAYS_EXTERNAL) {
      Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
      DDGUtils.execIntentIfSafe(context, browserIntent);
      return;
    }

    if (isStorySessionOrStoryUrl()) {
      DDGControlVar.mDuckDuckGoContainer.lastFeedUrl = url;
      if (DDGControlVar.currentFeedObject != null) {
        urlType = URLTYPE.FEED;
      }
    } else if (DDGUtils.isSerpUrl(url)) {
      urlType = URLTYPE.SERP;
    } else {
      urlType = URLTYPE.WEBPAGE;
    }

    if (!savedState) {
      mainWebView.setIsReadable(false);
      mainWebView.loadUrl(url);
    }
  }