@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(); }
@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(); } }
/** * 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(); } }
/** 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(); }
// Tab callbacks @Override public void onTabDataChanged(Tab tab) { setUrlTitle(tab); setFavicon(tab); updateLockIconToLatest(tab); updateNavigationState(tab); mTitleBar.onTabDataChanged(tab); mNavigationBar.onTabDataChanged(tab); onProgressChanged(tab); }
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); }
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); }
/** * Attaches the <code>controller</code> to the titleBar. * * @param controller An instance of {@link DialogControl}. */ void attachMouseMotionListener(MouseMotionListener controller) { titleBar.addMouseMotionListener(controller); }
protected void updateAutoLogin(Tab tab, boolean animate) { mTitleBar.updateAutoLogin(tab, animate); }
public boolean isEditingUrl() { return mTitleBar.isEditingUrl(); }
protected boolean isTitleBarShowing() { return mTitleBar.isShowing(); }
protected void hideTitleBar() { if (mTitleBar.isShowing()) { mTitleBar.hide(); } }
protected void showTitleBar() { mHandler.removeMessages(MSG_HIDE_TITLEBAR); if (canShowTitleBar()) { mTitleBar.show(); } }
/** Updates and repaints the title bar. */ void updateTitleBar() { titleBar.update(window.getTitle()); }
/** * 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); }
/** * 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); }
/** * Derives the default font of the title bar. * * @param style The new style to set. */ void setFontStyle(int style) { titleBar.setFontStyle(style); }
/** * 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()); }