Exemplo n.º 1
1
  @Override
  protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    mUIManager.onNewIntent(intent);

    if (intent != null && !TextUtils.isEmpty(intent.getStringExtra("QRCODE_URL"))) {
      mUIManager.loadUrl(intent.getStringExtra("QRCODE_URL"));
    }
  }
Exemplo n.º 2
0
  /*
  * @Override public boolean onCreateOptionsMenu(final Menu menu) {
  * getMenuInflater().inflate(UIFactory.getMainMenuLayout(this), menu);
  * return true; }
  *
  * @Override public boolean onPrepareOptionsMenu(Menu menu) {
  * super.onPrepareOptionsMenu(menu);
  *
  * BaseWebViewFragment currentFragment =
  * mUIManager.getCurrentWebViewFragment();
  *
  * menu.setGroupEnabled(R.id.MainActivity_DisabledOnStartPageMenuGroup,
  * currentFragment != null && !currentFragment.isStartPageShown());
  *
  * CustomWebView currentWebView = mUIManager.getCurrentWebView();
  *
  * boolean privateBrowsing = currentWebView != null &&
  * currentWebView.isPrivateBrowsingEnabled();
  *
  * menu.findItem(R.id.MainActivity_MenuIncognitoTab).setChecked(privateBrowsing
  * ); menu.findItem(R.id.MainActivity_MenuFullScreen).setChecked(mUIManager.
  * isFullScreen());
  *
  * menu.removeGroup(R.id.MainActivity_AddonsMenuGroup);
  *
  * if (!privateBrowsing && (currentWebView != null)) { List<AddonMenuItem>
  * contributedMenuItems =
  * Controller.getInstance().getAddonManager().getContributedMainMenuItems
  * (currentWebView); for (AddonMenuItem item : contributedMenuItems) {
  * menu.add(R.id.MainActivity_AddonsMenuGroup, item.getAddon().getMenuId(),
  * 0, item.getMenuItem()); } }
  *
  * return true; }
  *
  * @Override public boolean onOptionsItemSelected(MenuItem item) { Intent i;
  *
  * switch (item.getItemId()) { case R.id.MainActivity_MenuAddTab:
  * mUIManager.addTab(true,
  * PreferenceManager.getDefaultSharedPreferences(this
  * ).getBoolean(Constants.PREFERENCE_INCOGNITO_BY_DEFAULT, false), false);
  * return true;
  *
  * case R.id.MainActivity_MenuCloseTab: mUIManager.closeCurrentTab(); return
  * true;
  *

  * case R.id.MainActivity_MenuIncognitoTab:
  * mUIManager.togglePrivateBrowsing(); return true;


  * default: if
  * (Controller.getInstance().getAddonManager().onContributedMainMenuItemSelected
  * (this, item.getItemId(), mUIManager.getCurrentWebView())) { return true;
  * } else { return super.onOptionsItemSelected(item); } } }
  */
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);

    if (requestCode == ACTIVITY_BOOKMARKS) {
      if (resultCode == RESULT_OK) {
        if (intent != null) {
          Bundle b = intent.getExtras();
          if (b != null) {
            if (b.getBoolean(Constants.EXTRA_NEW_TAB)) {
              mUIManager.addTab(
                  false,
                  PreferenceManager.getDefaultSharedPreferences(this)
                      .getBoolean(Constants.PREFERENCE_INCOGNITO_BY_DEFAULT, false),
                  false);
            }

            mUIManager.loadUrl(b.getString(Constants.EXTRA_URL));
          }
        }
      }
    } else if (requestCode == ACTIVITY_OPEN_FILE_CHOOSER) {
      if (mUIManager.getUploadMessage() == null) {
        return;
      }

      Uri result = intent == null || resultCode != RESULT_OK ? null : intent.getData();
      mUIManager.getUploadMessage().onReceiveValue(result);
      mUIManager.setUploadMessage(null);
    }

    mUIManager.onActivityResult(requestCode, resultCode, intent);
  }
Exemplo n.º 3
0
  private void restoreTabs(Set<String> tabs) {
    boolean first = true;

    for (String url : tabs) {
      if (first) {
        mUIManager.loadUrl(url);
        first = false;
      } else {
        mUIManager.addTab(url, !first, false, false);
      }
    }
  }