@Override
 protected void onStart() {
   try {
     viewTitle = findViewById(R.id.rl_titlebar);
     mTitleCtv = (AppCompatCheckedTextView) viewTitle.findViewById(R.id.ctv_bgatitlebar_title);
     mBackCtv = (AppCompatCheckedTextView) viewTitle.findViewById(R.id.ctv_bgatitlebar_left);
     mMenuCtv = (AppCompatCheckedTextView) viewTitle.findViewById(R.id.ctv_bgatitlebar_right);
     titleBar = new TitleBar();
     titleBar.title = viewTitle;
     titleBar.backCtv = mBackCtv;
     titleBar.titleCtv = mTitleCtv;
     titleBar.menuCtv = mMenuCtv;
     mBackCtv.setOnClickListener(
         new View.OnClickListener() {
           @Override
           public void onClick(View v) {
             onBackClick();
           }
         });
     mMenuCtv.setOnClickListener(
         new View.OnClickListener() {
           @Override
           public void onClick(View v) {
             onMenuClick();
           }
         });
   } catch (NullPointerException e) {
     throw new NullPointerException("TitleBar Notfound from Activity layout");
   }
   super.onStart();
 }
Example #2
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();
   }
 }
Example #3
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();
   }
 }
Example #4
0
 /** Repaints the window according to whether the window is currently collapsed or expanded. */
 void updateCollapsedState() {
   SizeButton button = (SizeButton) titleBar.getButton(TitleBar.SIZE_BUTTON);
   if (window.isCollapsed()) {
     removeComponent(canvas);
     Dimension d = new Dimension(window.getWidth(), TitleBar.HEIGHT + 2 * BORDER_THICKNESS);
     titleBar.setPreferredSize(d);
     button.setActionType(SizeButton.EXPAND);
     window.setSize(d.width, d.height);
   } else {
     addComponent(canvas);
     button.setActionType(SizeButton.COLLAPSE);
     Dimension dT = titleBar.getPreferredSize();
     Dimension dW = window.getRestoreSize();
     window.setSize(dT.width, dW.height);
   }
   window.validate();
   window.repaint();
 }
Example #5
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);
 }
Example #6
0
 public BaseUi(Activity browser, UiController controller) {
   mActivity = browser;
   mUiController = controller;
   mTabControl = controller.getTabControl();
   Resources res = mActivity.getResources();
   mInputManager = (InputMethodManager) browser.getSystemService(Activity.INPUT_METHOD_SERVICE);
   mLockIconSecure = res.getDrawable(R.drawable.ic_secure_holo_dark);
   mLockIconMixed = res.getDrawable(R.drawable.ic_secure_partial_holo_dark);
   FrameLayout frameLayout =
       (FrameLayout) mActivity.getWindow().getDecorView().findViewById(android.R.id.content);
   LayoutInflater.from(mActivity).inflate(R.layout.custom_screen, frameLayout);
   mContentView = (FrameLayout) frameLayout.findViewById(R.id.main_content);
   mCustomViewContainer = (FrameLayout) frameLayout.findViewById(R.id.fullscreen_custom_content);
   mErrorConsoleContainer = (LinearLayout) frameLayout.findViewById(R.id.error_console);
   setFullscreen(BrowserSettings.getInstance().useFullscreen());
   mGenericFavicon = res.getDrawable(R.drawable.app_web_browser_sm);
   mTitleBar = new TitleBar(mActivity, mUiController, this, mContentView);
   mTitleBar.setProgress(100);
   mNavigationBar = mTitleBar.getNavigationBar();
   mUrlBarAutoShowManager = new UrlBarAutoShowManager(this);
 }
Example #7
0
  public BookListSubActivity(
      Context context,
      SubActivityManager manager,
      DatabaseAdapter db,
      ImageDownloadCollection thumbnails) {
    super(context, manager);
    mDb = db;
    mThumbnails = thumbnails;
    setContentView(R.layout.book_list_main);

    final TitleBar titleBar = getTitleBar();
    mCheckButton = new ListViewCheckButton(context);
    titleBar.addLeftContent(mCheckButton);

    mBookList = (BookListView) findViewById(R.id.book_list);
    mBookList.init(mDb, manager, mCheckButton);

    mAddButton = new AddBookButton(context, manager, mBookList);
    titleBar.addLeftContent(mAddButton);

    titleBar.enableFilter(mBookList);
  }
Example #8
0
 /**
  * Attaches the <code>controller</code> to the titleBar.
  *
  * @param controller An instance of {@link DialogControl}.
  */
 void attachMouseMotionListener(MouseMotionListener controller) {
   titleBar.addMouseMotionListener(controller);
 }
Example #9
0
 protected void updateAutoLogin(Tab tab, boolean animate) {
   mTitleBar.updateAutoLogin(tab, animate);
 }
Example #10
0
 public boolean isEditingUrl() {
   return mTitleBar.isEditingUrl();
 }
Example #11
0
 protected boolean isTitleBarShowing() {
   return mTitleBar.isShowing();
 }
Example #12
0
 protected void hideTitleBar() {
   if (mTitleBar.isShowing()) {
     mTitleBar.hide();
   }
 }
Example #13
0
 protected void showTitleBar() {
   mHandler.removeMessages(MSG_HIDE_TITLEBAR);
   if (canShowTitleBar()) {
     mTitleBar.show();
   }
 }
Example #14
0
 /** Updates and repaints the title bar. */
 void updateTitleBar() {
   titleBar.update(window.getTitle());
 }
Example #15
0
 /**
  * Attaches the <code>controller</code> to the buttons of the titleBar.
  *
  * @param controller An instance of {@link DialogControl}.
  */
 void attachActionListener(ActionListener controller) {
   attachButtonListener(controller, titleBar.getButton(TitleBar.SIZE_BUTTON), DialogControl.SIZE);
   attachButtonListener(
       controller, titleBar.getButton(TitleBar.CLOSE_BUTTON), DialogControl.CLOSE);
 }
Example #16
0
 /**
  * Attaches the <code>controller</code> to the buttons of the titleBar.
  *
  * @param controller An instance of {@link DialogControl}.
  */
 public void attachMouseListener(MouseListener controller) {
   titleBar.addMouseListener(controller);
   if (canvas instanceof ThumbnailCanvas) canvas.addMouseListener(controller);
 }
Example #17
0
 /**
  * Derives the default font of the title bar.
  *
  * @param style The new style to set.
  */
 void setFontStyle(int style) {
   titleBar.setFontStyle(style);
 }
Example #18
0
 /**
  * Sets the node's decoration.
  *
  * @param l The collection of <code>component</code>s to add to the <code>TitleBar</code>.
  */
 void setDecoration(List l) {
   if (titleBar == null) return;
   titleBar.setDecoration(l, window.getButtonIndex());
 }