示例#1
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();
     }
   }
 }
示例#2
0
 void setShowProgressOnly(boolean progress) {
   if (progress && !wantsToBeVisible()) {
     mNavBar.setVisibility(View.GONE);
   } else {
     mNavBar.setVisibility(View.VISIBLE);
   }
 }
示例#3
0
 private int calculateEmbeddedHeight() {
   int height = mNavBar.getHeight();
   if (mAutoLogin != null && mAutoLogin.getVisibility() == View.VISIBLE) {
     height += mAutoLogin.getHeight();
   }
   return height;
 }
示例#4
0
 @Override
 public void setActiveTab(final Tab tab) {
   mHandler.removeMessages(MSG_HIDE_TITLEBAR);
   if ((tab != mActiveTab) && (mActiveTab != null)) {
     removeTabFromContentView(mActiveTab);
     WebView web = mActiveTab.getWebView();
     if (web != null) {
       web.setOnTouchListener(null);
     }
   }
   mActiveTab = tab;
   WebView web = mActiveTab.getWebView();
   updateUrlBarAutoShowManagerTarget();
   attachTabToContentView(tab);
   setShouldShowErrorConsole(tab, mUiController.shouldShowErrorConsole());
   onTabDataChanged(tab);
   onProgressChanged(tab);
   mNavigationBar.setIncognitoMode(tab.isPrivateBrowsingEnabled());
   updateAutoLogin(tab, false);
   if (web != null
       && web.getVisibleTitleHeight() != mTitleBar.getEmbeddedHeight()
       && !mUseQuickControls) {
     showTitleBarForDuration();
   }
 }
示例#5
0
 @Override
 public void bookmarkedStatusHasChanged(Tab tab) {
   if (tab.inForeground()) {
     boolean isBookmark = tab.isBookmarkedSite();
     mNavigationBar.setCurrentUrlIsBookmark(isBookmark);
   }
 }
示例#6
0
 private void initLayout(Context context) {
   LayoutInflater factory = LayoutInflater.from(context);
   factory.inflate(R.layout.title_bar, this);
   mProgress = (PageProgressView) findViewById(R.id.progress);
   mNavBar = (NavigationBarBase) findViewById(R.id.taburlbar);
   mNavBar.setTitleBar(this);
 }
示例#7
0
 /**
  * Suggest to the UI that the title bar can be hidden. The UI will then decide whether or not to
  * hide based off a number of factors, such as if the user is editing the URL bar or if the page
  * is loading
  */
 public void suggestHideTitleBar() {
   if (!isLoading()
       && !isEditingUrl()
       && !mTitleBar.wantsToBeVisible()
       && !mNavigationBar.isMenuShowing()) {
     hideTitleBar();
   }
 }
示例#8
0
 public void editUrl(boolean clearInput) {
   if (mUiController.isInCustomActionMode()) {
     mUiController.endActionMode();
   }
   showTitleBar();
   if ((getActiveTab() != null) && !getActiveTab().isSnapshot()) {
     mNavigationBar.startEditingUrl(clearInput);
   }
 }
示例#9
0
 // Tab callbacks
 @Override
 public void onTabDataChanged(Tab tab) {
   setUrlTitle(tab);
   setFavicon(tab);
   updateLockIconToLatest(tab);
   updateNavigationState(tab);
   mTitleBar.onTabDataChanged(tab);
   mNavigationBar.onTabDataChanged(tab);
   onProgressChanged(tab);
 }
示例#10
0
 protected void setUrlTitle(Tab tab) {
   String url = tab.getUrl();
   String title = tab.getTitle();
   if (TextUtils.isEmpty(title)) {
     title = url;
   }
   if (tab.isInVoiceSearchMode()) return;
   if (tab.inForeground()) {
     mNavigationBar.setDisplayTitle(url);
   }
 }
示例#11
0
 /** Updates the lock-icon image in the title-bar. */
 private void updateLockIconImage(SecurityState securityState) {
   Drawable d = null;
   if (securityState == SecurityState.SECURITY_STATE_SECURE) {
     d = mLockIconSecure;
   } else if (securityState == SecurityState.SECURITY_STATE_MIXED
       || securityState == SecurityState.SECURITY_STATE_BAD_CERTIFICATE) {
     // TODO: It would be good to have different icons for insecure vs mixed content.
     // See http://b/5403800
     d = mLockIconMixed;
   }
   mNavigationBar.setLock(d);
 }
示例#12
0
 /**
  * ***********************************
  *
  * <p>ActionsCode(author:hexibin, change_code)
  */
 void hide() {
   if (mUseQuickControls) {
     // ActionsCode(hexibin, bugfix BUG00297099)
     // this.setVisibility(View.GONE);
     setTranslationY(-mNavBar.getHeight());
   } else {
     if (mIsFixedTitleBar) return;
     if (!mSkipTitleBarAnimations) {
       cancelTitleBarAnimation(false);
       int visibleHeight = getVisibleTitleHeight();
       mTitleBarAnimator =
           ObjectAnimator.ofFloat(
               this, "translationY", getTranslationY(), (-getEmbeddedHeight() + visibleHeight));
       mTitleBarAnimator.addListener(mHideTileBarAnimatorListener);
       setupTitleBarAnimator(mTitleBarAnimator);
       mTitleBarAnimator.start();
     } else {
       onScrollChanged();
     }
   }
   mShowing = false;
 }
示例#13
0
 // Set the favicon in the title bar.
 protected void setFavicon(Tab tab) {
   if (tab.inForeground()) {
     Bitmap icon = tab.getFavicon();
     mNavigationBar.setFavicon(icon);
   }
 }
示例#14
0
 public void onTabDataChanged(Tab tab) {
   mNavBar.setVisibility(VISIBLE);
 }
示例#15
0
 public boolean isEditingUrl() {
   return mNavBar.isEditingUrl();
 }
示例#16
0
 @Override
 public void showVoiceTitleBar(String title, List<String> results) {
   mNavigationBar.setInVoiceMode(true, results);
   mNavigationBar.setDisplayTitle(title);
 }
示例#17
0
 @Override
 public void revertVoiceTitleBar(Tab tab) {
   mNavigationBar.setInVoiceMode(false, null);
   String url = tab.getUrl();
   mNavigationBar.setDisplayTitle(url);
 }
示例#18
0
 @Override
 public void registerDropdownChangeListener(DropdownChangeListener d) {
   mNavigationBar.registerDropdownChangeListener(d);
 }