Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [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 | |
John Reck | 30c714c | 2010-12-16 17:30:34 -0800 | [diff] [blame] | 19 | import com.android.browser.Tab.LockIcon; |
John Reck | 74830e1 | 2011-03-14 11:43:05 -0700 | [diff] [blame] | 20 | import com.android.browser.UI.DropdownChangeListener; |
John Reck | 30c714c | 2010-12-16 17:30:34 -0800 | [diff] [blame] | 21 | |
John Reck | 74830e1 | 2011-03-14 11:43:05 -0700 | [diff] [blame] | 22 | import android.animation.Animator; |
| 23 | import android.animation.Animator.AnimatorListener; |
| 24 | import android.animation.ObjectAnimator; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 25 | import android.app.Activity; |
John Reck | b9a051b | 2011-03-18 11:55:48 -0700 | [diff] [blame] | 26 | import android.content.pm.PackageManager; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 27 | import android.content.res.Configuration; |
| 28 | import android.content.res.Resources; |
| 29 | import android.graphics.Bitmap; |
| 30 | import android.graphics.BitmapFactory; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 31 | import android.graphics.drawable.Drawable; |
| 32 | import android.os.Bundle; |
| 33 | import android.text.TextUtils; |
| 34 | import android.util.Log; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 35 | import android.view.Gravity; |
| 36 | import android.view.LayoutInflater; |
| 37 | import android.view.Menu; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 38 | import android.view.View; |
Michael Kolb | 1514bb7 | 2010-11-22 09:11:48 -0800 | [diff] [blame] | 39 | import android.view.View.OnClickListener; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 40 | import android.view.ViewGroup; |
Michael Kolb | 1514bb7 | 2010-11-22 09:11:48 -0800 | [diff] [blame] | 41 | import android.view.ViewGroup.LayoutParams; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 42 | import android.view.WindowManager; |
Michael Kolb | 3a69628 | 2010-12-05 13:23:24 -0800 | [diff] [blame] | 43 | import android.view.inputmethod.InputMethodManager; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 44 | import android.webkit.WebChromeClient; |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 45 | import android.webkit.WebSettings.ZoomDensity; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 46 | import android.webkit.WebView; |
| 47 | import android.widget.FrameLayout; |
Michael Kolb | 1514bb7 | 2010-11-22 09:11:48 -0800 | [diff] [blame] | 48 | import android.widget.ImageButton; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 49 | import android.widget.LinearLayout; |
| 50 | import android.widget.Toast; |
| 51 | |
Michael Kolb | 1bf2313 | 2010-11-19 12:55:12 -0800 | [diff] [blame] | 52 | import java.util.List; |
| 53 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 54 | /** |
| 55 | * UI interface definitions |
| 56 | */ |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 57 | public abstract class BaseUi implements UI, WebViewFactory { |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 58 | |
| 59 | private static final String LOGTAG = "BaseUi"; |
| 60 | |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 61 | protected static final FrameLayout.LayoutParams COVER_SCREEN_PARAMS = |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 62 | new FrameLayout.LayoutParams( |
| 63 | ViewGroup.LayoutParams.MATCH_PARENT, |
| 64 | ViewGroup.LayoutParams.MATCH_PARENT); |
| 65 | |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 66 | protected static final FrameLayout.LayoutParams COVER_SCREEN_GRAVITY_CENTER = |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 67 | new FrameLayout.LayoutParams( |
| 68 | ViewGroup.LayoutParams.MATCH_PARENT, |
| 69 | ViewGroup.LayoutParams.MATCH_PARENT, |
| 70 | Gravity.CENTER); |
| 71 | |
| 72 | Activity mActivity; |
| 73 | UiController mUiController; |
| 74 | TabControl mTabControl; |
Michael Kolb | 377ea31 | 2011-02-17 14:36:56 -0800 | [diff] [blame] | 75 | protected Tab mActiveTab; |
Michael Kolb | 3a69628 | 2010-12-05 13:23:24 -0800 | [diff] [blame] | 76 | private InputMethodManager mInputManager; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 77 | |
| 78 | private Drawable mSecLockIcon; |
| 79 | private Drawable mMixLockIcon; |
| 80 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 81 | private FrameLayout mBrowserFrameLayout; |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 82 | protected FrameLayout mContentView; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 83 | private FrameLayout mCustomViewContainer; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 84 | |
| 85 | private View mCustomView; |
| 86 | private WebChromeClient.CustomViewCallback mCustomViewCallback; |
| 87 | |
| 88 | private CombinedBookmarkHistoryView mComboView; |
| 89 | |
| 90 | private LinearLayout mErrorConsoleContainer = null; |
| 91 | |
| 92 | private Toast mStopToast; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 93 | |
Michael Kolb | 7cdc490 | 2011-02-03 17:54:40 -0800 | [diff] [blame] | 94 | private boolean mTitleShowing; |
| 95 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 96 | // the default <video> poster |
| 97 | private Bitmap mDefaultVideoPoster; |
| 98 | // the video progress view |
| 99 | private View mVideoProgressView; |
| 100 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 101 | private boolean mActivityPaused; |
| 102 | |
| 103 | public BaseUi(Activity browser, UiController controller) { |
| 104 | mActivity = browser; |
| 105 | mUiController = controller; |
| 106 | mTabControl = controller.getTabControl(); |
| 107 | Resources res = mActivity.getResources(); |
Michael Kolb | 3a69628 | 2010-12-05 13:23:24 -0800 | [diff] [blame] | 108 | mInputManager = (InputMethodManager) |
| 109 | browser.getSystemService(Activity.INPUT_METHOD_SERVICE); |
Michael Kolb | 5a72f18 | 2011-01-13 20:35:06 -0800 | [diff] [blame] | 110 | mSecLockIcon = res.getDrawable(R.drawable.ic_secure_holo_dark); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 111 | mMixLockIcon = res.getDrawable(R.drawable.ic_partial_secure); |
| 112 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 113 | FrameLayout frameLayout = (FrameLayout) mActivity.getWindow() |
| 114 | .getDecorView().findViewById(android.R.id.content); |
| 115 | mBrowserFrameLayout = (FrameLayout) LayoutInflater.from(mActivity) |
| 116 | .inflate(R.layout.custom_screen, null); |
| 117 | mContentView = (FrameLayout) mBrowserFrameLayout.findViewById( |
| 118 | R.id.main_content); |
| 119 | mErrorConsoleContainer = (LinearLayout) mBrowserFrameLayout |
| 120 | .findViewById(R.id.error_console); |
| 121 | mCustomViewContainer = (FrameLayout) mBrowserFrameLayout |
| 122 | .findViewById(R.id.fullscreen_custom_content); |
| 123 | frameLayout.addView(mBrowserFrameLayout, COVER_SCREEN_PARAMS); |
Michael Kolb | 7cdc490 | 2011-02-03 17:54:40 -0800 | [diff] [blame] | 124 | mTitleShowing = false; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 125 | } |
| 126 | |
John Reck | b9a051b | 2011-03-18 11:55:48 -0700 | [diff] [blame] | 127 | @Override |
| 128 | public WebView createWebView(boolean privateBrowsing) { |
| 129 | // Create a new WebView |
| 130 | BrowserWebView w = new BrowserWebView(mActivity, null, |
| 131 | android.R.attr.webViewStyle, privateBrowsing); |
| 132 | initWebViewSettings(w); |
| 133 | return w; |
| 134 | } |
| 135 | |
| 136 | @Override |
| 137 | public WebView createSubWebView(boolean privateBrowsing) { |
| 138 | return createWebView(privateBrowsing); |
| 139 | } |
| 140 | |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 141 | /** |
| 142 | * common webview initialization |
| 143 | * @param w the webview to initialize |
| 144 | */ |
| 145 | protected void initWebViewSettings(WebView w) { |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 146 | w.setScrollbarFadingEnabled(true); |
| 147 | w.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY); |
| 148 | w.setMapTrackballToArrowKeys(false); // use trackball directly |
| 149 | // Enable the built-in zoom |
| 150 | w.getSettings().setBuiltInZoomControls(true); |
John Reck | b9a051b | 2011-03-18 11:55:48 -0700 | [diff] [blame] | 151 | boolean supportsMultiTouch = mActivity.getPackageManager() |
| 152 | .hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH); |
| 153 | w.getSettings().setDisplayZoomControls(!supportsMultiTouch); |
| 154 | w.setExpandedTileBounds(true); // smoother scrolling |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 155 | |
| 156 | // Add this WebView to the settings observer list and update the |
| 157 | // settings |
| 158 | final BrowserSettings s = BrowserSettings.getInstance(); |
| 159 | s.addObserver(w.getSettings()).update(s, null); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 160 | } |
| 161 | |
| 162 | private void cancelStopToast() { |
| 163 | if (mStopToast != null) { |
| 164 | mStopToast.cancel(); |
| 165 | mStopToast = null; |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | // lifecycle |
| 170 | |
| 171 | public void onPause() { |
Michael Kolb | 7a5cf47 | 2010-11-30 13:23:53 -0800 | [diff] [blame] | 172 | if (isCustomViewShowing()) { |
| 173 | onHideCustomView(); |
| 174 | } |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 175 | cancelStopToast(); |
| 176 | mActivityPaused = true; |
| 177 | } |
| 178 | |
| 179 | public void onResume() { |
| 180 | mActivityPaused = false; |
| 181 | } |
| 182 | |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 183 | protected boolean isActivityPaused() { |
| 184 | return mActivityPaused; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 185 | } |
| 186 | |
| 187 | public void onConfigurationChanged(Configuration config) { |
| 188 | } |
| 189 | |
Michael Kolb | dc2ee1b | 2011-02-14 14:34:40 -0800 | [diff] [blame] | 190 | public abstract void editUrl(boolean clearInput); |
| 191 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 192 | // key handling |
| 193 | |
| 194 | @Override |
| 195 | public boolean onBackKey() { |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 196 | if (mComboView != null) { |
| 197 | if (!mComboView.onBackPressed()) { |
| 198 | mUiController.removeComboView(); |
| 199 | } |
| 200 | return true; |
| 201 | } |
| 202 | if (mCustomView != null) { |
| 203 | mUiController.hideCustomView(); |
| 204 | return true; |
| 205 | } |
| 206 | return false; |
| 207 | } |
| 208 | |
John Reck | 30c714c | 2010-12-16 17:30:34 -0800 | [diff] [blame] | 209 | // Tab callbacks |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 210 | @Override |
John Reck | 30c714c | 2010-12-16 17:30:34 -0800 | [diff] [blame] | 211 | public void onTabDataChanged(Tab tab) { |
| 212 | setUrlTitle(tab); |
| 213 | setFavicon(tab); |
| 214 | updateLockIconToLatest(tab); |
Michael Kolb | 5a72f18 | 2011-01-13 20:35:06 -0800 | [diff] [blame] | 215 | updateNavigationState(tab); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 216 | } |
| 217 | |
| 218 | @Override |
Leon Scroggins | 4cd9779 | 2010-12-03 15:31:56 -0500 | [diff] [blame] | 219 | public void bookmarkedStatusHasChanged(Tab tab) { |
John Reck | 94b7e04 | 2011-02-15 15:02:33 -0800 | [diff] [blame] | 220 | if (tab.inForeground()) { |
| 221 | boolean isBookmark = tab.isBookmarkedSite(); |
| 222 | getTitleBar().setCurrentUrlIsBookmark(isBookmark); |
| 223 | } |
Leon Scroggins | 4cd9779 | 2010-12-03 15:31:56 -0500 | [diff] [blame] | 224 | } |
| 225 | |
| 226 | @Override |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 227 | public void onPageStopped(Tab tab) { |
| 228 | cancelStopToast(); |
| 229 | if (tab.inForeground()) { |
| 230 | mStopToast = Toast |
| 231 | .makeText(mActivity, R.string.stopping, Toast.LENGTH_SHORT); |
| 232 | mStopToast.show(); |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | @Override |
Michael Kolb | 1bf2313 | 2010-11-19 12:55:12 -0800 | [diff] [blame] | 237 | public boolean needsRestoreAllTabs() { |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 238 | return false; |
Michael Kolb | 1bf2313 | 2010-11-19 12:55:12 -0800 | [diff] [blame] | 239 | } |
| 240 | |
| 241 | @Override |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 242 | public void addTab(Tab tab) { |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 243 | } |
| 244 | |
| 245 | @Override |
Michael Kolb | 377ea31 | 2011-02-17 14:36:56 -0800 | [diff] [blame] | 246 | public void setActiveTab(final Tab tab) { |
| 247 | setActiveTab(tab, true); |
| 248 | } |
| 249 | |
| 250 | void setActiveTab(Tab tab, boolean needsAttaching) { |
Michael Kolb | 77df456 | 2010-11-19 14:49:34 -0800 | [diff] [blame] | 251 | if ((tab != mActiveTab) && (mActiveTab != null)) { |
| 252 | removeTabFromContentView(mActiveTab); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 253 | } |
Michael Kolb | 77df456 | 2010-11-19 14:49:34 -0800 | [diff] [blame] | 254 | mActiveTab = tab; |
Michael Kolb | 377ea31 | 2011-02-17 14:36:56 -0800 | [diff] [blame] | 255 | if (needsAttaching) { |
| 256 | attachTabToContentView(tab); |
| 257 | } |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 258 | setShouldShowErrorConsole(tab, mUiController.shouldShowErrorConsole()); |
John Reck | 30c714c | 2010-12-16 17:30:34 -0800 | [diff] [blame] | 259 | onTabDataChanged(tab); |
| 260 | onProgressChanged(tab); |
John Reck | 117f07d | 2011-01-24 09:39:03 -0800 | [diff] [blame] | 261 | boolean incognito = mActiveTab.getWebView().isPrivateBrowsingEnabled(); |
Michael Kolb | 7cdc490 | 2011-02-03 17:54:40 -0800 | [diff] [blame] | 262 | getTitleBar().setIncognitoMode(incognito); |
Patrick Scott | 9206677 | 2011-03-10 08:46:27 -0500 | [diff] [blame] | 263 | updateAutoLogin(tab, false); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 264 | } |
| 265 | |
Michael Kolb | cfa3af5 | 2010-12-14 10:36:11 -0800 | [diff] [blame] | 266 | Tab getActiveTab() { |
| 267 | return mActiveTab; |
| 268 | } |
| 269 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 270 | @Override |
Michael Kolb | 1bf2313 | 2010-11-19 12:55:12 -0800 | [diff] [blame] | 271 | public void updateTabs(List<Tab> tabs) { |
Michael Kolb | 1bf2313 | 2010-11-19 12:55:12 -0800 | [diff] [blame] | 272 | } |
| 273 | |
| 274 | @Override |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 275 | public void removeTab(Tab tab) { |
Michael Kolb | 77df456 | 2010-11-19 14:49:34 -0800 | [diff] [blame] | 276 | if (mActiveTab == tab) { |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 277 | removeTabFromContentView(tab); |
Michael Kolb | 77df456 | 2010-11-19 14:49:34 -0800 | [diff] [blame] | 278 | mActiveTab = null; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 279 | } |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 280 | } |
| 281 | |
| 282 | @Override |
| 283 | public void detachTab(Tab tab) { |
| 284 | removeTabFromContentView(tab); |
| 285 | } |
| 286 | |
| 287 | @Override |
| 288 | public void attachTab(Tab tab) { |
| 289 | attachTabToContentView(tab); |
| 290 | } |
| 291 | |
Michael Kolb | 377ea31 | 2011-02-17 14:36:56 -0800 | [diff] [blame] | 292 | protected void attachTabToContentView(Tab tab) { |
Michael Kolb | d1e2ccc | 2011-01-24 11:38:31 -0800 | [diff] [blame] | 293 | if ((tab == null) || (tab.getWebView() == null)) { |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 294 | return; |
| 295 | } |
| 296 | View container = tab.getViewContainer(); |
| 297 | WebView mainView = tab.getWebView(); |
| 298 | // Attach the WebView to the container and then attach the |
| 299 | // container to the content view. |
| 300 | FrameLayout wrapper = |
| 301 | (FrameLayout) container.findViewById(R.id.webview_wrapper); |
| 302 | ViewGroup parent = (ViewGroup) mainView.getParent(); |
| 303 | if (parent != wrapper) { |
| 304 | if (parent != null) { |
| 305 | Log.w(LOGTAG, "mMainView already has a parent in" |
| 306 | + " attachTabToContentView!"); |
| 307 | parent.removeView(mainView); |
| 308 | } |
| 309 | wrapper.addView(mainView); |
| 310 | } else { |
| 311 | Log.w(LOGTAG, "mMainView is already attached to wrapper in" |
| 312 | + " attachTabToContentView!"); |
| 313 | } |
| 314 | parent = (ViewGroup) container.getParent(); |
| 315 | if (parent != mContentView) { |
| 316 | if (parent != null) { |
| 317 | Log.w(LOGTAG, "mContainer already has a parent in" |
| 318 | + " attachTabToContentView!"); |
| 319 | parent.removeView(container); |
| 320 | } |
| 321 | mContentView.addView(container, COVER_SCREEN_PARAMS); |
| 322 | } else { |
| 323 | Log.w(LOGTAG, "mContainer is already attached to content in" |
| 324 | + " attachTabToContentView!"); |
| 325 | } |
| 326 | mUiController.attachSubWindow(tab); |
| 327 | } |
| 328 | |
| 329 | private void removeTabFromContentView(Tab tab) { |
Michael Kolb | 7cdc490 | 2011-02-03 17:54:40 -0800 | [diff] [blame] | 330 | hideTitleBar(); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 331 | // Remove the container that contains the main WebView. |
| 332 | WebView mainView = tab.getWebView(); |
| 333 | View container = tab.getViewContainer(); |
| 334 | if (mainView == null) { |
| 335 | return; |
| 336 | } |
| 337 | // Remove the container from the content and then remove the |
| 338 | // WebView from the container. This will trigger a focus change |
| 339 | // needed by WebView. |
Michael Kolb | 20776cc | 2011-01-31 10:19:05 -0800 | [diff] [blame] | 340 | mainView.setEmbeddedTitleBar(null); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 341 | FrameLayout wrapper = |
| 342 | (FrameLayout) container.findViewById(R.id.webview_wrapper); |
| 343 | wrapper.removeView(mainView); |
| 344 | mContentView.removeView(container); |
| 345 | mUiController.endActionMode(); |
| 346 | mUiController.removeSubWindow(tab); |
| 347 | ErrorConsoleView errorConsole = tab.getErrorConsole(false); |
| 348 | if (errorConsole != null) { |
| 349 | mErrorConsoleContainer.removeView(errorConsole); |
| 350 | } |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 351 | } |
| 352 | |
Michael Kolb | a713ec8 | 2010-11-29 17:27:06 -0800 | [diff] [blame] | 353 | @Override |
| 354 | public void onSetWebView(Tab tab, WebView webView) { |
| 355 | View container = tab.getViewContainer(); |
| 356 | if (container == null) { |
| 357 | // The tab consists of a container view, which contains the main |
| 358 | // WebView, as well as any other UI elements associated with the tab. |
| 359 | container = mActivity.getLayoutInflater().inflate(R.layout.tab, |
| 360 | null); |
| 361 | tab.setViewContainer(container); |
| 362 | } |
| 363 | if (tab.getWebView() != webView) { |
| 364 | // Just remove the old one. |
| 365 | FrameLayout wrapper = |
| 366 | (FrameLayout) container.findViewById(R.id.webview_wrapper); |
| 367 | wrapper.removeView(tab.getWebView()); |
| 368 | } |
| 369 | } |
| 370 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 371 | /** |
Michael Kolb | 1514bb7 | 2010-11-22 09:11:48 -0800 | [diff] [blame] | 372 | * create a sub window container and webview for the tab |
| 373 | * Note: this methods operates through side-effects for now |
| 374 | * it sets both the subView and subViewContainer for the given tab |
| 375 | * @param tab tab to create the sub window for |
| 376 | * @param subView webview to be set as a subwindow for the tab |
| 377 | */ |
| 378 | @Override |
| 379 | public void createSubWindow(Tab tab, WebView subView) { |
| 380 | View subViewContainer = mActivity.getLayoutInflater().inflate( |
| 381 | R.layout.browser_subwindow, null); |
| 382 | ViewGroup inner = (ViewGroup) subViewContainer |
| 383 | .findViewById(R.id.inner_container); |
| 384 | inner.addView(subView, new LayoutParams(LayoutParams.MATCH_PARENT, |
| 385 | LayoutParams.MATCH_PARENT)); |
| 386 | final ImageButton cancel = (ImageButton) subViewContainer |
| 387 | .findViewById(R.id.subwindow_close); |
| 388 | final WebView cancelSubView = subView; |
| 389 | cancel.setOnClickListener(new OnClickListener() { |
| 390 | public void onClick(View v) { |
| 391 | cancelSubView.getWebChromeClient().onCloseWindow(cancelSubView); |
| 392 | } |
| 393 | }); |
| 394 | tab.setSubWebView(subView); |
| 395 | tab.setSubViewContainer(subViewContainer); |
| 396 | } |
| 397 | |
| 398 | /** |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 399 | * Remove the sub window from the content view. |
| 400 | */ |
| 401 | @Override |
| 402 | public void removeSubWindow(View subviewContainer) { |
| 403 | mContentView.removeView(subviewContainer); |
| 404 | mUiController.endActionMode(); |
| 405 | } |
| 406 | |
| 407 | /** |
| 408 | * Attach the sub window to the content view. |
| 409 | */ |
| 410 | @Override |
| 411 | public void attachSubWindow(View container) { |
Michael Kolb | 1514bb7 | 2010-11-22 09:11:48 -0800 | [diff] [blame] | 412 | if (container.getParent() != null) { |
| 413 | // already attached, remove first |
| 414 | ((ViewGroup) container.getParent()).removeView(container); |
| 415 | } |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 416 | mContentView.addView(container, COVER_SCREEN_PARAMS); |
| 417 | } |
| 418 | |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 419 | protected void refreshWebView() { |
| 420 | Tab tab = getActiveTab(); |
| 421 | if ((tab != null) && (tab.getWebView() != null)) { |
| 422 | tab.getWebView().invalidate(); |
| 423 | } |
| 424 | } |
| 425 | |
Michael Kolb | 7cdc490 | 2011-02-03 17:54:40 -0800 | [diff] [blame] | 426 | boolean canShowTitleBar() { |
| 427 | return !isTitleBarShowing() |
| 428 | && !isActivityPaused() |
| 429 | && (getActiveTab() != null) |
| 430 | && (getActiveTab().getWebView() != null) |
| 431 | && !mUiController.isInCustomActionMode(); |
| 432 | } |
| 433 | |
| 434 | void showTitleBar() { |
| 435 | mTitleShowing = true; |
| 436 | } |
| 437 | |
| 438 | protected void hideTitleBar() { |
| 439 | mTitleShowing = false; |
| 440 | } |
| 441 | |
| 442 | protected boolean isTitleBarShowing() { |
| 443 | return mTitleShowing; |
| 444 | } |
| 445 | |
| 446 | protected abstract TitleBarBase getTitleBar(); |
| 447 | |
| 448 | protected void setTitleGravity(int gravity) { |
| 449 | getTitleBar().setTitleGravity(gravity); |
| 450 | Tab tab = getActiveTab(); |
| 451 | if ((tab != null) && (tab.getWebView() != null)) { |
| 452 | tab.getWebView().setTitleBarGravity(gravity); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 453 | } |
| 454 | } |
| 455 | |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 456 | @Override |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 457 | public void showVoiceTitleBar(String title, List<String> results) { |
| 458 | getTitleBar().setInVoiceMode(true, results); |
Michael Kolb | 7cdc490 | 2011-02-03 17:54:40 -0800 | [diff] [blame] | 459 | getTitleBar().setDisplayTitle(title); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 460 | } |
| 461 | |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 462 | @Override |
| 463 | public void revertVoiceTitleBar(Tab tab) { |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 464 | getTitleBar().setInVoiceMode(false, null); |
John Reck | 30c714c | 2010-12-16 17:30:34 -0800 | [diff] [blame] | 465 | String url = tab.getUrl(); |
Michael Kolb | 7cdc490 | 2011-02-03 17:54:40 -0800 | [diff] [blame] | 466 | getTitleBar().setDisplayTitle(url); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 467 | } |
| 468 | |
| 469 | @Override |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 470 | public void registerDropdownChangeListener(DropdownChangeListener d) { |
| 471 | getTitleBar().registerDropdownChangeListener(d); |
| 472 | } |
| 473 | |
| 474 | @Override |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 475 | public void showComboView(boolean startWithHistory, Bundle extras) { |
John Reck | 439c9a5 | 2010-12-14 10:04:39 -0800 | [diff] [blame] | 476 | if (mComboView != null) { |
| 477 | return; |
| 478 | } |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 479 | mComboView = new CombinedBookmarkHistoryView(mActivity, |
| 480 | mUiController, |
| 481 | startWithHistory ? |
| 482 | CombinedBookmarkHistoryView.FRAGMENT_ID_HISTORY |
| 483 | : CombinedBookmarkHistoryView.FRAGMENT_ID_BOOKMARKS, |
| 484 | extras); |
Michael Kolb | 47d63f8 | 2011-01-18 10:48:40 -0800 | [diff] [blame] | 485 | FrameLayout wrapper = |
| 486 | (FrameLayout) mContentView.findViewById(R.id.webview_wrapper); |
| 487 | wrapper.setVisibility(View.GONE); |
Michael Kolb | 7cdc490 | 2011-02-03 17:54:40 -0800 | [diff] [blame] | 488 | hideTitleBar(); |
Michael Kolb | 3a69628 | 2010-12-05 13:23:24 -0800 | [diff] [blame] | 489 | dismissIME(); |
| 490 | if (mActiveTab != null) { |
| 491 | WebView web = mActiveTab.getWebView(); |
| 492 | mActiveTab.putInBackground(); |
| 493 | } |
John Reck | 74830e1 | 2011-03-14 11:43:05 -0700 | [diff] [blame] | 494 | mComboView.setAlpha(0f); |
| 495 | ObjectAnimator anim = ObjectAnimator.ofFloat(mComboView, "alpha", 0f, 1f); |
| 496 | Resources res = mActivity.getResources(); |
| 497 | anim.setDuration(res.getInteger(R.integer.comboViewFadeInDuration)); |
| 498 | anim.start(); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 499 | mContentView.addView(mComboView, COVER_SCREEN_PARAMS); |
| 500 | } |
| 501 | |
Michael Kolb | ba23870 | 2011-03-08 10:40:50 -0800 | [diff] [blame] | 502 | public boolean isComboViewShowing() { |
| 503 | return (mComboView != null); |
| 504 | } |
| 505 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 506 | /** |
| 507 | * dismiss the ComboPage |
| 508 | */ |
| 509 | @Override |
| 510 | public void hideComboView() { |
| 511 | if (mComboView != null) { |
| 512 | mContentView.removeView(mComboView); |
Michael Kolb | 47d63f8 | 2011-01-18 10:48:40 -0800 | [diff] [blame] | 513 | FrameLayout wrapper = |
| 514 | (FrameLayout) mContentView.findViewById(R.id.webview_wrapper); |
| 515 | wrapper.setVisibility(View.VISIBLE); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 516 | mComboView = null; |
| 517 | } |
Michael Kolb | 3a69628 | 2010-12-05 13:23:24 -0800 | [diff] [blame] | 518 | if (mActiveTab != null) { |
| 519 | mActiveTab.putInForeground(); |
| 520 | } |
John Reck | b3417f0 | 2011-01-14 11:01:05 -0800 | [diff] [blame] | 521 | mActivity.invalidateOptionsMenu(); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 522 | } |
| 523 | |
| 524 | @Override |
| 525 | public void showCustomView(View view, |
| 526 | WebChromeClient.CustomViewCallback callback) { |
| 527 | // if a view already exists then immediately terminate the new one |
| 528 | if (mCustomView != null) { |
| 529 | callback.onCustomViewHidden(); |
| 530 | return; |
| 531 | } |
| 532 | |
| 533 | // Add the custom view to its container. |
| 534 | mCustomViewContainer.addView(view, COVER_SCREEN_GRAVITY_CENTER); |
| 535 | mCustomView = view; |
| 536 | mCustomViewCallback = callback; |
| 537 | // Hide the content view. |
| 538 | mContentView.setVisibility(View.GONE); |
| 539 | // Finally show the custom view container. |
| 540 | setStatusBarVisibility(false); |
| 541 | mCustomViewContainer.setVisibility(View.VISIBLE); |
| 542 | mCustomViewContainer.bringToFront(); |
| 543 | } |
| 544 | |
| 545 | @Override |
| 546 | public void onHideCustomView() { |
| 547 | if (mCustomView == null) |
| 548 | return; |
| 549 | |
| 550 | // Hide the custom view. |
| 551 | mCustomView.setVisibility(View.GONE); |
| 552 | // Remove the custom view from its container. |
| 553 | mCustomViewContainer.removeView(mCustomView); |
| 554 | mCustomView = null; |
| 555 | mCustomViewContainer.setVisibility(View.GONE); |
| 556 | mCustomViewCallback.onCustomViewHidden(); |
| 557 | // Show the content view. |
| 558 | setStatusBarVisibility(true); |
| 559 | mContentView.setVisibility(View.VISIBLE); |
| 560 | } |
| 561 | |
| 562 | @Override |
| 563 | public boolean isCustomViewShowing() { |
| 564 | return mCustomView != null; |
| 565 | } |
| 566 | |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 567 | protected void dismissIME() { |
Michael Kolb | 3a69628 | 2010-12-05 13:23:24 -0800 | [diff] [blame] | 568 | if (mInputManager.isActive()) { |
| 569 | mInputManager.hideSoftInputFromWindow(mContentView.getWindowToken(), |
| 570 | 0); |
| 571 | } |
| 572 | } |
| 573 | |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 574 | @Override |
| 575 | public boolean showsWeb() { |
| 576 | return mCustomView == null |
| 577 | && mComboView == null; |
| 578 | } |
| 579 | |
Patrick Scott | 9206677 | 2011-03-10 08:46:27 -0500 | [diff] [blame] | 580 | @Override |
| 581 | public void showAutoLogin(Tab tab) { |
| 582 | updateAutoLogin(tab, true); |
| 583 | } |
| 584 | |
| 585 | @Override |
| 586 | public void hideAutoLogin(Tab tab) { |
| 587 | updateAutoLogin(tab, true); |
| 588 | } |
| 589 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 590 | // ------------------------------------------------------------------------- |
| 591 | |
Michael Kolb | 5a72f18 | 2011-01-13 20:35:06 -0800 | [diff] [blame] | 592 | protected void updateNavigationState(Tab tab) { |
| 593 | } |
| 594 | |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 595 | protected void updateAutoLogin(Tab tab, boolean animate) { |
| 596 | getTitleBar().updateAutoLogin(tab, animate); |
| 597 | } |
Patrick Scott | 9206677 | 2011-03-10 08:46:27 -0500 | [diff] [blame] | 598 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 599 | /** |
| 600 | * Update the lock icon to correspond to our latest state. |
| 601 | */ |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 602 | protected void updateLockIconToLatest(Tab t) { |
John Reck | 30c714c | 2010-12-16 17:30:34 -0800 | [diff] [blame] | 603 | if (t != null && t.inForeground()) { |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 604 | updateLockIconImage(t.getLockIconType()); |
| 605 | } |
| 606 | } |
| 607 | |
| 608 | /** |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 609 | * Updates the lock-icon image in the title-bar. |
| 610 | */ |
John Reck | 30c714c | 2010-12-16 17:30:34 -0800 | [diff] [blame] | 611 | private void updateLockIconImage(LockIcon lockIconType) { |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 612 | Drawable d = null; |
John Reck | 30c714c | 2010-12-16 17:30:34 -0800 | [diff] [blame] | 613 | if (lockIconType == LockIcon.LOCK_ICON_SECURE) { |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 614 | d = mSecLockIcon; |
John Reck | 30c714c | 2010-12-16 17:30:34 -0800 | [diff] [blame] | 615 | } else if (lockIconType == LockIcon.LOCK_ICON_MIXED) { |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 616 | d = mMixLockIcon; |
| 617 | } |
Michael Kolb | 7cdc490 | 2011-02-03 17:54:40 -0800 | [diff] [blame] | 618 | getTitleBar().setLock(d); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 619 | } |
| 620 | |
John Reck | 30c714c | 2010-12-16 17:30:34 -0800 | [diff] [blame] | 621 | protected void setUrlTitle(Tab tab) { |
| 622 | String url = tab.getUrl(); |
| 623 | String title = tab.getTitle(); |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 624 | if (TextUtils.isEmpty(title)) { |
| 625 | title = url; |
Michael Kolb | 81b6f83 | 2010-12-12 12:44:27 -0800 | [diff] [blame] | 626 | } |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 627 | if (tab.isInVoiceSearchMode()) return; |
| 628 | if (tab.inForeground()) { |
Michael Kolb | 7cdc490 | 2011-02-03 17:54:40 -0800 | [diff] [blame] | 629 | getTitleBar().setDisplayTitle(url); |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 630 | } |
| 631 | } |
| 632 | |
| 633 | // Set the favicon in the title bar. |
John Reck | 30c714c | 2010-12-16 17:30:34 -0800 | [diff] [blame] | 634 | protected void setFavicon(Tab tab) { |
| 635 | if (tab.inForeground()) { |
| 636 | Bitmap icon = tab.getFavicon(); |
Michael Kolb | 7cdc490 | 2011-02-03 17:54:40 -0800 | [diff] [blame] | 637 | getTitleBar().setFavicon(icon); |
John Reck | 30c714c | 2010-12-16 17:30:34 -0800 | [diff] [blame] | 638 | } |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 639 | } |
| 640 | |
| 641 | @Override |
| 642 | public void onActionModeFinished(boolean inLoad) { |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 643 | } |
| 644 | |
Michael Kolb | 6670653 | 2010-12-12 19:50:22 -0800 | [diff] [blame] | 645 | // active tabs page |
| 646 | |
| 647 | public void showActiveTabsPage() { |
| 648 | } |
| 649 | |
| 650 | /** |
| 651 | * Remove the active tabs page. |
| 652 | */ |
| 653 | public void removeActiveTabsPage() { |
| 654 | } |
| 655 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 656 | // menu handling callbacks |
| 657 | |
| 658 | @Override |
Michael Kolb | 1acef69 | 2011-03-08 14:12:06 -0800 | [diff] [blame] | 659 | public boolean onPrepareOptionsMenu(Menu menu) { |
| 660 | return true; |
| 661 | } |
| 662 | |
| 663 | @Override |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 664 | public void onOptionsMenuOpened() { |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 665 | } |
| 666 | |
| 667 | @Override |
| 668 | public void onExtendedMenuOpened() { |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 669 | } |
| 670 | |
| 671 | @Override |
| 672 | public void onOptionsMenuClosed(boolean inLoad) { |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 673 | } |
| 674 | |
| 675 | @Override |
| 676 | public void onExtendedMenuClosed(boolean inLoad) { |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 677 | } |
| 678 | |
| 679 | @Override |
| 680 | public void onContextMenuCreated(Menu menu) { |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 681 | } |
| 682 | |
| 683 | @Override |
| 684 | public void onContextMenuClosed(Menu menu, boolean inLoad) { |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 685 | } |
| 686 | |
| 687 | // error console |
| 688 | |
| 689 | @Override |
| 690 | public void setShouldShowErrorConsole(Tab tab, boolean flag) { |
Michael Kolb | 9fcefd1 | 2011-02-17 10:55:59 -0800 | [diff] [blame] | 691 | if (tab == null) return; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 692 | ErrorConsoleView errorConsole = tab.getErrorConsole(true); |
| 693 | if (flag) { |
| 694 | // Setting the show state of the console will cause it's the layout |
| 695 | // to be inflated. |
| 696 | if (errorConsole.numberOfErrors() > 0) { |
| 697 | errorConsole.showConsole(ErrorConsoleView.SHOW_MINIMIZED); |
| 698 | } else { |
| 699 | errorConsole.showConsole(ErrorConsoleView.SHOW_NONE); |
| 700 | } |
| 701 | if (errorConsole.getParent() != null) { |
| 702 | mErrorConsoleContainer.removeView(errorConsole); |
| 703 | } |
| 704 | // Now we can add it to the main view. |
| 705 | mErrorConsoleContainer.addView(errorConsole, |
| 706 | new LinearLayout.LayoutParams( |
| 707 | ViewGroup.LayoutParams.MATCH_PARENT, |
| 708 | ViewGroup.LayoutParams.WRAP_CONTENT)); |
| 709 | } else { |
| 710 | mErrorConsoleContainer.removeView(errorConsole); |
| 711 | } |
| 712 | } |
| 713 | |
| 714 | private void setStatusBarVisibility(boolean visible) { |
Joe Onorato | d3bf86f | 2011-01-25 20:07:10 -0800 | [diff] [blame] | 715 | WindowManager.LayoutParams params = mActivity.getWindow().getAttributes(); |
| 716 | params.systemUiVisibility = visible ? View.STATUS_BAR_VISIBLE : View.STATUS_BAR_HIDDEN; |
| 717 | mActivity.getWindow().setAttributes(params); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 718 | } |
| 719 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 720 | // ------------------------------------------------------------------------- |
| 721 | // Helper function for WebChromeClient |
| 722 | // ------------------------------------------------------------------------- |
| 723 | |
| 724 | @Override |
| 725 | public Bitmap getDefaultVideoPoster() { |
| 726 | if (mDefaultVideoPoster == null) { |
| 727 | mDefaultVideoPoster = BitmapFactory.decodeResource( |
| 728 | mActivity.getResources(), R.drawable.default_video_poster); |
| 729 | } |
| 730 | return mDefaultVideoPoster; |
| 731 | } |
| 732 | |
| 733 | @Override |
| 734 | public View getVideoLoadingProgressView() { |
| 735 | if (mVideoProgressView == null) { |
| 736 | LayoutInflater inflater = LayoutInflater.from(mActivity); |
| 737 | mVideoProgressView = inflater.inflate( |
| 738 | R.layout.video_loading_progress, null); |
| 739 | } |
| 740 | return mVideoProgressView; |
| 741 | } |
| 742 | |
Michael Kolb | 843510f | 2010-12-09 10:51:49 -0800 | [diff] [blame] | 743 | @Override |
| 744 | public void showMaxTabsWarning() { |
| 745 | Toast warning = Toast.makeText(mActivity, |
| 746 | mActivity.getString(R.string.max_tabs_warning), |
| 747 | Toast.LENGTH_SHORT); |
| 748 | warning.show(); |
| 749 | } |
| 750 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 751 | } |