Esempio n. 1
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   if (commonActivityTrait.onOptionsItemSelected(item)) {
     return true;
   }
   return super.onOptionsItemSelected(item);
 }
Esempio n. 2
0
  @AfterViews
  void afterViews() {
    Log.d(TAG, "state: " + state.toString());

    commonActivityTrait.initActivity(preferences);

    urlText.setSelectAllOnFocus(true);
    urlText.setOnEditorActionListener(this);

    WebSettings webSettings = webView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setDefaultTextEncodingName(ENCODING);
    webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
    webView.addJavascriptInterface(
        new BrowserActivityJavaScriptInterface(this), BrowserActivityJavaScriptInterface.NAME);
    webView.setWebViewClient(new BrowserWebViewClient(this));
    webView.setActionModeListener(this);

    translatePanelFragment.setListener(this);

    Intent intent = getIntent();
    if (intent != null) {
      String action = intent.getAction();
      if (action != null && action.equals(Intent.ACTION_VIEW)) {
        Uri url = intent.getData();
        if (url != null) {
          loadUrl(url.toString());
          return;
        }
      }
    }

    if (extraUrlOrKeywords.isEmpty()) {
      loadUrl(state.getLastUrl());
    } else {
      loadUrl(extraUrlOrKeywords);
    }
  }