@Override
 public void onFocusChange(View view, boolean hasFocus) {
   // if losing focus and not in touch mode, leave as is
   if (hasFocus || view.isInTouchMode() || mUrlInput.needsUpdate()) {
     setFocusState(hasFocus);
   }
   if (hasFocus) {
     mBaseUi.showTitleBar();
     mUrlInput.forceIme();
     if (mInVoiceMode) {
       mUrlInput.forceFilter();
     }
   } else if (!mUrlInput.needsUpdate()) {
     mUrlInput.dismissDropDown();
     mUrlInput.hideIME();
     if (mUrlInput.getText().length() == 0) {
       Tab currentTab = mUiController.getTabControl().getCurrentTab();
       if (currentTab != null) {
         setDisplayTitle(currentTab.getUrl());
       }
     }
     mBaseUi.suggestHideTitleBar();
   }
   mUrlInput.clearNeedsUpdate();
 }
  public void hideAutoLogin(boolean animate) {
    if (mUseQuickControls) {
      mBaseUi.hideTitleBar();
      mAutoLogin.setVisibility(View.GONE);
      mBaseUi.refreshWebView();
    } else {
      if (animate) {
        Animation anim = AnimationUtils.loadAnimation(getContext(), R.anim.autologin_exit);
        anim.setAnimationListener(
            new AnimationListener() {
              @Override
              public void onAnimationEnd(Animation a) {
                mAutoLogin.setVisibility(View.GONE);
                mBaseUi.refreshWebView();
              }

              @Override
              public void onAnimationStart(Animation a) {}

              @Override
              public void onAnimationRepeat(Animation a) {}
            });
        mAutoLogin.startAnimation(anim);
      } else if (mAutoLogin.getAnimation() == null) {
        mAutoLogin.setVisibility(View.GONE);
        mBaseUi.refreshWebView();
      }
    }
  }
 @Override
 public void onDismiss() {
   final Tab currentTab = mBaseUi.getActiveTab();
   mBaseUi.hideTitleBar();
   post(
       new Runnable() {
         public void run() {
           clearFocus();
           if ((currentTab != null) && !mInVoiceMode) {
             setDisplayTitle(currentTab.getUrl());
           }
         }
       });
 }
  /**
   * ***********************************
   *
   * <p>ActionsCode(author:hexibin, change_code)
   */
  @Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    // ActionsCode(hexibin, bugfix BUG00297099)
    if (mIsFixedTitleBar && mShowing) {
      int margin = getMeasuredHeight() - calculateEmbeddedHeight();
      mBaseUi.setContentViewMarginTop(-margin);
    } else {
      mBaseUi.setContentViewMarginTop(0);
    }

    // ActionsCode(hexibin, bugfix BUG00297099)
    if (!mShowing) {
      setMeasuredDimension(0, 0);
    }
  }
 /** Update the progress, from 0 to 100. */
 public void setProgress(int newProgress) {
   if (newProgress >= PROGRESS_MAX) {
     mProgress.setProgress(PageProgressView.MAX_PROGRESS);
     mProgress.setVisibility(View.GONE);
     mInLoad = false;
     mNavBar.onProgressStopped();
     // check if needs to be hidden
     if (!isEditingUrl() && !wantsToBeVisible()) {
       if (mUseQuickControls) {
         hide();
       } else {
         mBaseUi.showTitleBarForDuration();
       }
     }
   } else {
     if (!mInLoad) {
       mProgress.setVisibility(View.VISIBLE);
       mInLoad = true;
       mNavBar.onProgressStarted();
     }
     mProgress.setProgress(newProgress * PageProgressView.MAX_PROGRESS / PROGRESS_MAX);
     if (mUseQuickControls && !isEditingUrl()) {
       // ActionsCode(hexibin, bugfix BUG00297099)
       // setShowProgressOnly(true);
     }
     if (!mShowing) {
       show();
     }
   }
 }
Exemple #6
0
 @Override
 public void onAnimationEnd(Animator animation) {
   if (!mWasCanceled) {
     setTranslationY(0);
   }
   mBaseUi.setTitleGravity(Gravity.NO_GRAVITY);
 }
 /** callback from suggestion dropdown user selected a suggestion */
 @Override
 public void onAction(String text, String extra, String source) {
   mUiController.getCurrentTopWebView().requestFocus();
   if (UrlInputView.TYPED.equals(source)) {
     String url = UrlUtils.smartUrlFilter(text, false);
     Tab t = mBaseUi.getActiveTab();
     // Only shortcut javascript URIs for now, as there is special
     // logic in UrlHandler for other schemas
     if (url != null && t != null && url.startsWith("javascript:")) {
       mUiController.loadUrl(t, url);
       setDisplayTitle(text);
       return;
     }
   }
   Intent i = new Intent();
   String action = null;
   if (UrlInputView.VOICE.equals(source)) {
     action = RecognizerResultsIntent.ACTION_VOICE_SEARCH_RESULTS;
     source = null;
   } else {
     action = Intent.ACTION_SEARCH;
   }
   i.setAction(action);
   i.putExtra(SearchManager.QUERY, text);
   if (extra != null) {
     i.putExtra(SearchManager.EXTRA_DATA_KEY, extra);
   }
   if (source != null) {
     Bundle appData = new Bundle();
     appData.putString(com.android.common.Search.SOURCE, source);
     i.putExtra(SearchManager.APP_DATA, appData);
   }
   mUiController.handleNewIntent(i);
   setDisplayTitle(text);
 }
 @Override
 public void showCustomView(
     View view, int requestedOrientation, WebChromeClient.CustomViewCallback callback) {
   super.showCustomView(view, requestedOrientation, callback);
   mTitleBar.setTranslationY(
       -mActivity.getResources().getDimensionPixelSize(R.dimen.toolbar_height));
   if (mActionBar != null) mActionBar.hide();
 }
  @Override
  public void onStart() {
    super.onStart();

    // before webview loaded
    showDialog(DIALOG_PROGRESS);
    getWindow().requestFeature(Window.FEATURE_PROGRESS);
  }
Exemple #10
0
 public WebView getCurrentWebView() {
   Tab t = mBaseUi.getActiveTab();
   if (t != null) {
     return t.getWebView();
   } else {
     return null;
   }
 }
Exemple #11
0
 private void setFixedTitleBar() {
   // If getParent() returns null, we are initializing
   ViewGroup parent = (ViewGroup) getParent();
   if (mIsFixedTitleBar && parent != null) return;
   mIsFixedTitleBar = true;
   setSkipTitleBarAnimations(true);
   show();
   setSkipTitleBarAnimations(false);
   if (parent != null) {
     parent.removeView(this);
   }
   if (mIsFixedTitleBar) {
     mBaseUi.addFixedTitleBar(this);
   } else {
     mContentView.addView(this, makeLayoutParams());
     mBaseUi.setContentViewMarginTop(0);
   }
 }
Exemple #12
0
 private void setupBottomBar() {
   ViewGroup parent = (ViewGroup) getParent();
   show();
   if (parent != null) {
     parent.removeView(this);
   }
   mContentView.addView(this, makeLayoutParams());
   mBaseUi.setContentViewMarginBottom(0);
 }
 @Override
 public void onProgressChanged(Tab tab) {
   super.onProgressChanged(tab);
   if (mComboView != null && !mComboView.isShowing()) {
     mActionBar = mActivity.getActionBar();
     setupActionBar();
     if (mActionBar != null) mActionBar.show();
     if (mNavBar != null) mNavBar.setVisibility(View.VISIBLE);
   }
 }
 @Override
 public void setActiveTab(final Tab tab) {
   super.setActiveTab(tab);
   BrowserWebView view = (BrowserWebView) tab.getWebView();
   // TabControl.setCurrentTab has been called before this,
   // so the tab is guaranteed to have a webview
   if (view == null) {
     Log.e(LOGTAG, "active tab with no webview detected");
     return;
   }
   mTabBar.onSetActiveTab(tab);
 }
Exemple #15
0
 public void showAutoLogin(boolean animate) {
   if (mUseQuickControls) {
     mBaseUi.showTitleBar();
   }
   if (mAutoLogin == null) {
     inflateAutoLoginBar();
   }
   mAutoLogin.setVisibility(View.VISIBLE);
   if (animate) {
     mAutoLogin.startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.autologin_enter));
   }
 }
 // Set the favicon in the title bar.
 @Override
 public void setFavicon(Tab tab) {
   super.setFavicon(tab);
   mTabBar.onFavicon(tab, tab.getFavicon());
   /*
           if (mActiveTab == tab) {
               int color = NavigationBarBase.getSiteIconColor(tab.getUrl());
               if (tab.hasFavicon()) {
                   color = ColorUtils.getDominantColorForBitmap(tab.getFavicon());
               }
               mActionBar.setBackgroundDrawable(new ColorDrawable(color));
           }
   */
 }
Exemple #17
0
 void hide() {
   if (mUseQuickControls) {
     mParent.removeView(this);
   } else {
     if (!mSkipTitleBarAnimations) {
       cancelTitleBarAnimation(false);
       int visibleHeight = getVisibleTitleHeight();
       mTitleBarAnimator =
           ObjectAnimator.ofFloat(
               this, "translationY", getTranslationY(), (-getEmbeddedHeight() + visibleHeight));
       mTitleBarAnimator.addListener(mHideTileBarAnimatorListener);
       setupTitleBarAnimator(mTitleBarAnimator);
       mTitleBarAnimator.start();
     } else {
       mBaseUi.setTitleGravity(Gravity.NO_GRAVITY);
     }
   }
   mShowing = false;
 }
Exemple #18
0
 void show() {
   if (mUseQuickControls) {
     mParent.addView(this);
   } else {
     if (!mSkipTitleBarAnimations) {
       cancelTitleBarAnimation(false);
       int visibleHeight = getVisibleTitleHeight();
       float startPos = (-getEmbeddedHeight() + visibleHeight);
       if (getTranslationY() != 0) {
         startPos = Math.max(startPos, getTranslationY());
       }
       mTitleBarAnimator = ObjectAnimator.ofFloat(this, "translationY", startPos, 0);
       setupTitleBarAnimator(mTitleBarAnimator);
       mTitleBarAnimator.start();
     }
     mBaseUi.setTitleGravity(Gravity.TOP);
   }
   mShowing = true;
 }
 @Override
 protected void onPause() {
   webView.stopLoading();
   super.onPause();
 }
 @Override
 public void showWeb(boolean animate) {
   super.showWeb(animate);
   hideComboView();
 }
 @Override
 public void onResume() {
   super.onResume();
   mNavBar.clearCompletions();
 }
 @Override
 public void removeTab(Tab tab) {
   super.removeTab(tab);
   mTabBar.onRemoveTab(tab);
 }
Exemple #23
0
 private int getVisibleTitleHeight() {
   Tab tab = mBaseUi.getActiveTab();
   WebView webview = tab != null ? tab.getWebView() : null;
   return webview != null ? webview.getVisibleTitleHeight() : 0;
 }
 @Override
 public void editUrl(boolean clearInput, boolean forceIME) {
   super.editUrl(clearInput, forceIME);
 }
 @Override
 public void setUrlTitle(Tab tab) {
   super.setUrlTitle(tab);
   mTabBar.onUrlAndTitle(tab, tab.getUrl(), tab.getTitle());
 }
 public void setFavicon(Bitmap icon) {
   if (mFavicon == null) return;
   mFavicon.setImageDrawable(mBaseUi.getFaviconDrawable(icon));
 }
 @Override
 public void onHideCustomView() {
   super.onHideCustomView();
   if (mActionBar != null) mActionBar.show();
   mTitleBar.setTranslationY(0);
 }