Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.android.browser; |
| 18 | |
| 19 | import android.app.Activity; |
Michael Kolb | 4bd767d | 2011-05-27 11:33:55 -0700 | [diff] [blame] | 20 | import android.os.Bundle; |
Michael Kolb | 376b541 | 2010-12-15 11:52:57 -0800 | [diff] [blame] | 21 | import android.util.Log; |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 22 | import android.view.ActionMode; |
| 23 | import android.view.Gravity; |
Michael Kolb | a418306 | 2011-01-16 10:43:21 -0800 | [diff] [blame] | 24 | import android.view.KeyEvent; |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 25 | import android.view.Menu; |
| 26 | import android.view.View; |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 27 | import android.webkit.WebView; |
Michael Kolb | fdb7024 | 2011-03-24 09:41:11 -0700 | [diff] [blame] | 28 | import android.widget.FrameLayout; |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 29 | |
| 30 | /** |
| 31 | * Ui for regular phone screen sizes |
| 32 | */ |
| 33 | public class PhoneUi extends BaseUi { |
| 34 | |
| 35 | private static final String LOGTAG = "PhoneUi"; |
| 36 | |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 37 | private ActiveTabsPage mActiveTabsPage; |
Michael Kolb | 0241e75 | 2011-07-07 14:58:50 -0700 | [diff] [blame] | 38 | private PieControlPhone mPieControl; |
Michael Kolb | f205560 | 2011-04-09 17:20:03 -0700 | [diff] [blame] | 39 | private NavScreen mNavScreen; |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 40 | private NavigationBarPhone mNavigationBar; |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 41 | |
| 42 | boolean mExtendedMenuOpen; |
| 43 | boolean mOptionsMenuOpen; |
Michael Kolb | 08a687a | 2011-04-22 16:13:02 -0700 | [diff] [blame] | 44 | boolean mAnimating; |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 45 | |
| 46 | /** |
| 47 | * @param browser |
| 48 | * @param controller |
| 49 | */ |
| 50 | public PhoneUi(Activity browser, UiController controller) { |
| 51 | super(browser, controller); |
John Reck | 285ef04 | 2011-02-11 15:44:17 -0800 | [diff] [blame] | 52 | mActivity.getActionBar().hide(); |
Michael Kolb | fdb7024 | 2011-03-24 09:41:11 -0700 | [diff] [blame] | 53 | setUseQuickControls(BrowserSettings.getInstance().useQuickControls()); |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 54 | mNavigationBar = (NavigationBarPhone) mTitleBar.getNavigationBar(); |
John Reck | 285ef04 | 2011-02-11 15:44:17 -0800 | [diff] [blame] | 55 | } |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 56 | |
John Reck | 285ef04 | 2011-02-11 15:44:17 -0800 | [diff] [blame] | 57 | @Override |
| 58 | public void hideComboView() { |
| 59 | super.hideComboView(); |
| 60 | mActivity.getActionBar().hide(); |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 61 | } |
| 62 | |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 63 | // lifecycle |
| 64 | |
| 65 | @Override |
| 66 | public void onPause() { |
| 67 | // FIXME: This removes the active tabs page and resets the menu to |
| 68 | // MAIN_MENU. A better solution might be to do this work in onNewIntent |
| 69 | // but then we would need to save it in onSaveInstanceState and restore |
| 70 | // it in onCreate/onRestoreInstanceState |
| 71 | if (mActiveTabsPage != null) { |
| 72 | mUiController.removeActiveTabsPage(true); |
| 73 | } |
| 74 | super.onPause(); |
| 75 | } |
| 76 | |
| 77 | @Override |
| 78 | public void onDestroy() { |
Michael Kolb | 7cdc490 | 2011-02-03 17:54:40 -0800 | [diff] [blame] | 79 | hideTitleBar(); |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | @Override |
Michael Kolb | dc2ee1b | 2011-02-14 14:34:40 -0800 | [diff] [blame] | 83 | public void editUrl(boolean clearInput) { |
Michael Kolb | 46f987e | 2011-04-05 10:39:10 -0700 | [diff] [blame] | 84 | if (mUseQuickControls) { |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 85 | mTitleBar.setShowProgressOnly(false); |
Michael Kolb | 46f987e | 2011-04-05 10:39:10 -0700 | [diff] [blame] | 86 | } |
| 87 | super.editUrl(clearInput); |
Michael Kolb | dc2ee1b | 2011-02-14 14:34:40 -0800 | [diff] [blame] | 88 | } |
| 89 | |
| 90 | @Override |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 91 | public boolean onBackKey() { |
| 92 | if (mActiveTabsPage != null) { |
| 93 | // if tab page is showing, hide it |
| 94 | mUiController.removeActiveTabsPage(true); |
| 95 | return true; |
Michael Kolb | f205560 | 2011-04-09 17:20:03 -0700 | [diff] [blame] | 96 | } else if (mNavScreen != null) { |
| 97 | mNavScreen.close(); |
| 98 | return true; |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 99 | } |
| 100 | return super.onBackKey(); |
| 101 | } |
| 102 | |
| 103 | @Override |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 104 | public boolean onMenuKey() { |
Michael Kolb | 4bd767d | 2011-05-27 11:33:55 -0700 | [diff] [blame] | 105 | if (!isComboViewShowing()) { |
| 106 | if (mNavScreen == null) { |
| 107 | showNavScreen(); |
| 108 | } else { |
| 109 | mNavScreen.close(); |
| 110 | } |
| 111 | return true; |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 112 | } else { |
Michael Kolb | 4bd767d | 2011-05-27 11:33:55 -0700 | [diff] [blame] | 113 | return false; |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 114 | } |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | @Override |
Michael Kolb | f205560 | 2011-04-09 17:20:03 -0700 | [diff] [blame] | 118 | public boolean dispatchKey(int code, KeyEvent event) { |
| 119 | if (!isComboViewShowing()) { |
Michael Kolb | f205560 | 2011-04-09 17:20:03 -0700 | [diff] [blame] | 120 | } |
| 121 | return false; |
| 122 | } |
| 123 | |
| 124 | @Override |
John Reck | 30c714c | 2010-12-16 17:30:34 -0800 | [diff] [blame] | 125 | public void onProgressChanged(Tab tab) { |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 126 | if (tab.inForeground()) { |
John Reck | 30c714c | 2010-12-16 17:30:34 -0800 | [diff] [blame] | 127 | int progress = tab.getLoadProgress(); |
Michael Kolb | 7cdc490 | 2011-02-03 17:54:40 -0800 | [diff] [blame] | 128 | mTitleBar.setProgress(progress); |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 129 | if (progress == 100) { |
| 130 | if (!mOptionsMenuOpen || !mExtendedMenuOpen) { |
John Reck | 5d43ce8 | 2011-06-21 17:16:51 -0700 | [diff] [blame] | 131 | suggestHideTitleBar(); |
Michael Kolb | c16c595 | 2011-03-29 15:37:03 -0700 | [diff] [blame] | 132 | if (mUseQuickControls) { |
| 133 | mTitleBar.setShowProgressOnly(false); |
| 134 | } |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 135 | } |
| 136 | } else { |
| 137 | if (!mOptionsMenuOpen || mExtendedMenuOpen) { |
Michael Kolb | c16c595 | 2011-03-29 15:37:03 -0700 | [diff] [blame] | 138 | if (mUseQuickControls && !mTitleBar.isEditingUrl()) { |
| 139 | mTitleBar.setShowProgressOnly(true); |
| 140 | setTitleGravity(Gravity.TOP); |
| 141 | } |
Michael Kolb | 7cdc490 | 2011-02-03 17:54:40 -0800 | [diff] [blame] | 142 | showTitleBar(); |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 143 | } |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | @Override |
Michael Kolb | fdb7024 | 2011-03-24 09:41:11 -0700 | [diff] [blame] | 149 | public void setActiveTab(final Tab tab) { |
John Reck | 88a42b7 | 2011-03-21 16:30:12 -0700 | [diff] [blame] | 150 | captureTab(mActiveTab); |
John Reck | 5d43ce8 | 2011-06-21 17:16:51 -0700 | [diff] [blame] | 151 | super.setActiveTab(tab); |
Michael Kolb | fdb7024 | 2011-03-24 09:41:11 -0700 | [diff] [blame] | 152 | BrowserWebView view = (BrowserWebView) tab.getWebView(); |
Michael Kolb | 376b541 | 2010-12-15 11:52:57 -0800 | [diff] [blame] | 153 | // TabControl.setCurrentTab has been called before this, |
| 154 | // so the tab is guaranteed to have a webview |
| 155 | if (view == null) { |
| 156 | Log.e(LOGTAG, "active tab with no webview detected"); |
| 157 | return; |
| 158 | } |
Michael Kolb | fdb7024 | 2011-03-24 09:41:11 -0700 | [diff] [blame] | 159 | // Request focus on the top window. |
| 160 | if (mUseQuickControls) { |
| 161 | mPieControl.forceToTop(mContentView); |
Michael Kolb | fdb7024 | 2011-03-24 09:41:11 -0700 | [diff] [blame] | 162 | } else { |
| 163 | // check if title bar is already attached by animation |
| 164 | if (mTitleBar.getParent() == null) { |
| 165 | view.setEmbeddedTitleBar(mTitleBar); |
| 166 | } |
| 167 | } |
Michael Kolb | 376b541 | 2010-12-15 11:52:57 -0800 | [diff] [blame] | 168 | if (tab.isInVoiceSearchMode()) { |
Michael Kolb | fdb7024 | 2011-03-24 09:41:11 -0700 | [diff] [blame] | 169 | showVoiceTitleBar(tab.getVoiceDisplayTitle(), tab.getVoiceSearchResults()); |
Michael Kolb | 376b541 | 2010-12-15 11:52:57 -0800 | [diff] [blame] | 170 | } else { |
| 171 | revertVoiceTitleBar(tab); |
| 172 | } |
Michael Kolb | fdb7024 | 2011-03-24 09:41:11 -0700 | [diff] [blame] | 173 | updateLockIconToLatest(tab); |
Michael Kolb | 376b541 | 2010-12-15 11:52:57 -0800 | [diff] [blame] | 174 | tab.getTopWindow().requestFocus(); |
| 175 | } |
| 176 | |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 177 | /** |
| 178 | * Suggest to the UI that the title bar can be hidden. The UI will then |
| 179 | * decide whether or not to hide based off a number of factors, such |
| 180 | * as if the user is editing the URL bar or if the page is loading |
| 181 | */ |
| 182 | @Override |
| 183 | public void suggestHideTitleBar() { |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 184 | if (!mNavigationBar.isMenuShowing()) { |
| 185 | super.suggestHideTitleBar(); |
Michael Kolb | 017ffab | 2011-07-11 15:26:47 -0700 | [diff] [blame] | 186 | } |
| 187 | } |
| 188 | |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 189 | // active tabs page |
| 190 | |
| 191 | @Override |
| 192 | public void showActiveTabsPage() { |
John Reck | 88a42b7 | 2011-03-21 16:30:12 -0700 | [diff] [blame] | 193 | captureTab(mActiveTab); |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 194 | mActiveTabsPage = new ActiveTabsPage(mActivity, mUiController); |
| 195 | mTitleBar.setVisibility(View.GONE); |
Michael Kolb | 7cdc490 | 2011-02-03 17:54:40 -0800 | [diff] [blame] | 196 | hideTitleBar(); |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 197 | mContentView.addView(mActiveTabsPage, COVER_SCREEN_PARAMS); |
| 198 | mActiveTabsPage.requestFocus(); |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * Remove the active tabs page. |
| 203 | */ |
| 204 | @Override |
| 205 | public void removeActiveTabsPage() { |
| 206 | mContentView.removeView(mActiveTabsPage); |
| 207 | mTitleBar.setVisibility(View.VISIBLE); |
| 208 | mActiveTabsPage = null; |
| 209 | } |
| 210 | |
| 211 | @Override |
John Reck | 2bc8042 | 2011-06-30 15:11:49 -0700 | [diff] [blame] | 212 | public void showComboView(ComboViews startWith, Bundle extras) { |
Michael Kolb | 4bd767d | 2011-05-27 11:33:55 -0700 | [diff] [blame] | 213 | if (mNavScreen != null) { |
| 214 | hideNavScreen(false); |
| 215 | } |
John Reck | 2bc8042 | 2011-06-30 15:11:49 -0700 | [diff] [blame] | 216 | super.showComboView(startWith, extras); |
Michael Kolb | 4bd767d | 2011-05-27 11:33:55 -0700 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | @Override |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 220 | public boolean showsWeb() { |
| 221 | return super.showsWeb() && mActiveTabsPage == null; |
| 222 | } |
| 223 | |
| 224 | // menu handling callbacks |
| 225 | |
| 226 | @Override |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 227 | public void onContextMenuCreated(Menu menu) { |
Michael Kolb | 7cdc490 | 2011-02-03 17:54:40 -0800 | [diff] [blame] | 228 | hideTitleBar(); |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 229 | } |
| 230 | |
| 231 | @Override |
| 232 | public void onContextMenuClosed(Menu menu, boolean inLoad) { |
| 233 | if (inLoad) { |
Michael Kolb | 7cdc490 | 2011-02-03 17:54:40 -0800 | [diff] [blame] | 234 | showTitleBar(); |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 235 | } |
| 236 | } |
| 237 | |
| 238 | // action mode callbacks |
| 239 | |
| 240 | @Override |
| 241 | public void onActionModeStarted(ActionMode mode) { |
Michael Kolb | 7cdc490 | 2011-02-03 17:54:40 -0800 | [diff] [blame] | 242 | hideTitleBar(); |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 243 | } |
| 244 | |
Michael Kolb | a418306 | 2011-01-16 10:43:21 -0800 | [diff] [blame] | 245 | @Override |
John Reck | 6cda7b1 | 2011-03-18 15:57:13 -0700 | [diff] [blame] | 246 | public void onActionModeFinished(boolean inLoad) { |
Michael Kolb | c16c595 | 2011-03-29 15:37:03 -0700 | [diff] [blame] | 247 | if (inLoad) { |
| 248 | if (mUseQuickControls) { |
| 249 | mTitleBar.setShowProgressOnly(true); |
John Reck | 6cda7b1 | 2011-03-18 15:57:13 -0700 | [diff] [blame] | 250 | } |
Michael Kolb | c16c595 | 2011-03-29 15:37:03 -0700 | [diff] [blame] | 251 | showTitleBar(); |
| 252 | } |
| 253 | mActivity.getActionBar().hide(); |
John Reck | 6cda7b1 | 2011-03-18 15:57:13 -0700 | [diff] [blame] | 254 | } |
| 255 | |
| 256 | @Override |
Michael Kolb | fdb7024 | 2011-03-24 09:41:11 -0700 | [diff] [blame] | 257 | protected void setTitleGravity(int gravity) { |
| 258 | if (mUseQuickControls) { |
| 259 | FrameLayout.LayoutParams lp = |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 260 | (FrameLayout.LayoutParams) mTitleBar.getLayoutParams(); |
Michael Kolb | fdb7024 | 2011-03-24 09:41:11 -0700 | [diff] [blame] | 261 | lp.gravity = gravity; |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 262 | mTitleBar.setLayoutParams(lp); |
Michael Kolb | fdb7024 | 2011-03-24 09:41:11 -0700 | [diff] [blame] | 263 | } else { |
| 264 | super.setTitleGravity(gravity); |
| 265 | } |
| 266 | } |
| 267 | |
Michael Kolb | 0241e75 | 2011-07-07 14:58:50 -0700 | [diff] [blame] | 268 | @Override |
| 269 | public void setUseQuickControls(boolean useQuickControls) { |
Michael Kolb | fdb7024 | 2011-03-24 09:41:11 -0700 | [diff] [blame] | 270 | mUseQuickControls = useQuickControls; |
John Reck | 0f602f3 | 2011-07-07 15:38:43 -0700 | [diff] [blame] | 271 | mTitleBar.setUseQuickControls(mUseQuickControls); |
Michael Kolb | fdb7024 | 2011-03-24 09:41:11 -0700 | [diff] [blame] | 272 | if (useQuickControls) { |
Michael Kolb | 0241e75 | 2011-07-07 14:58:50 -0700 | [diff] [blame] | 273 | mPieControl = new PieControlPhone(mActivity, mUiController, this); |
Michael Kolb | fdb7024 | 2011-03-24 09:41:11 -0700 | [diff] [blame] | 274 | mPieControl.attachToContainer(mContentView); |
Michael Kolb | 46f987e | 2011-04-05 10:39:10 -0700 | [diff] [blame] | 275 | WebView web = getWebView(); |
| 276 | if (web != null) { |
| 277 | web.setEmbeddedTitleBar(null); |
Michael Kolb | 0241e75 | 2011-07-07 14:58:50 -0700 | [diff] [blame] | 278 | // don't show url bar on scrolling |
| 279 | web.setOnTouchListener(null); |
Michael Kolb | fdb7024 | 2011-03-24 09:41:11 -0700 | [diff] [blame] | 280 | } |
| 281 | } else { |
Michael Kolb | fdb7024 | 2011-03-24 09:41:11 -0700 | [diff] [blame] | 282 | if (mPieControl != null) { |
| 283 | mPieControl.removeFromContainer(mContentView); |
| 284 | } |
Michael Kolb | 46f987e | 2011-04-05 10:39:10 -0700 | [diff] [blame] | 285 | WebView web = getWebView(); |
Michael Kolb | fdb7024 | 2011-03-24 09:41:11 -0700 | [diff] [blame] | 286 | if (web != null) { |
| 287 | web.setEmbeddedTitleBar(mTitleBar); |
Michael Kolb | 0241e75 | 2011-07-07 14:58:50 -0700 | [diff] [blame] | 288 | // show url bar on scrolling |
| 289 | web.setOnTouchListener(this); |
Michael Kolb | fdb7024 | 2011-03-24 09:41:11 -0700 | [diff] [blame] | 290 | } |
| 291 | setTitleGravity(Gravity.NO_GRAVITY); |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | @Override |
Michael Kolb | fdb7024 | 2011-03-24 09:41:11 -0700 | [diff] [blame] | 296 | protected void captureTab(final Tab tab) { |
Michael Kolb | a4261fd | 2011-05-05 11:27:37 -0700 | [diff] [blame] | 297 | if (tab == null) return; |
Michael Kolb | 4bd767d | 2011-05-27 11:33:55 -0700 | [diff] [blame] | 298 | BrowserWebView web = (BrowserWebView) tab.getWebView(); |
| 299 | if (web != null) { |
| 300 | tab.setScreenshot(web.capture()); |
Michael Kolb | fdb7024 | 2011-03-24 09:41:11 -0700 | [diff] [blame] | 301 | } |
| 302 | } |
Michael Kolb | 4bd767d | 2011-05-27 11:33:55 -0700 | [diff] [blame] | 303 | |
Michael Kolb | f205560 | 2011-04-09 17:20:03 -0700 | [diff] [blame] | 304 | void showNavScreen() { |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 305 | detachTab(mActiveTab); |
Michael Kolb | f205560 | 2011-04-09 17:20:03 -0700 | [diff] [blame] | 306 | mNavScreen = new NavScreen(mActivity, mUiController, this); |
Michael Kolb | f205560 | 2011-04-09 17:20:03 -0700 | [diff] [blame] | 307 | // Add the custom view to its container. |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 308 | mCustomViewContainer.addView(mNavScreen, COVER_SCREEN_PARAMS); |
Michael Kolb | f205560 | 2011-04-09 17:20:03 -0700 | [diff] [blame] | 309 | mContentView.setVisibility(View.GONE); |
Michael Kolb | f205560 | 2011-04-09 17:20:03 -0700 | [diff] [blame] | 310 | mCustomViewContainer.setVisibility(View.VISIBLE); |
| 311 | mCustomViewContainer.bringToFront(); |
| 312 | } |
| 313 | |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 314 | void hideNavScreen(boolean animate) { |
Michael Kolb | 09bf24f | 2011-06-09 14:34:30 -0700 | [diff] [blame] | 315 | if (mNavScreen == null) return; |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 316 | Tab tab = mNavScreen.getSelectedTab(); |
Michael Kolb | f205560 | 2011-04-09 17:20:03 -0700 | [diff] [blame] | 317 | mCustomViewContainer.removeView(mNavScreen); |
| 318 | mNavScreen = null; |
| 319 | mCustomViewContainer.setVisibility(View.GONE); |
Michael Kolb | 2814a36 | 2011-05-19 15:49:41 -0700 | [diff] [blame] | 320 | mUiController.setActiveTab(tab); |
Michael Kolb | f205560 | 2011-04-09 17:20:03 -0700 | [diff] [blame] | 321 | // Show the content view. |
| 322 | mContentView.setVisibility(View.VISIBLE); |
| 323 | } |
| 324 | |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 325 | } |