diff options
author | Michael Kolb <kolby@google.com> | 2010-12-09 10:51:49 -0800 |
---|---|---|
committer | Michael Kolb <kolby@google.com> | 2010-12-10 10:06:18 -0800 |
commit | 843510fb4f36a9a834c69d8773156db20ca3d740 (patch) | |
tree | 4cfafdd87dda1557a18b4e0ac9cdf6130f36cb39 /src | |
parent | f23451a7daef689c238a799c8bd070a6820102bd (diff) | |
download | packages_apps_Browser-843510fb4f36a9a834c69d8773156db20ca3d740.zip packages_apps_Browser-843510fb4f36a9a834c69d8773156db20ca3d740.tar.gz packages_apps_Browser-843510fb4f36a9a834c69d8773156db20ca3d740.tar.bz2 |
Warn user when max number of tabs is reached
Bug: http://b/issue?id=3123994
A toast is shown when the max number of tabs is reached
Change-Id: I5008e227c91139147920fd214f184061f816a353
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/browser/BaseUi.java | 8 | ||||
-rw-r--r-- | src/com/android/browser/Controller.java | 21 | ||||
-rw-r--r-- | src/com/android/browser/UI.java | 3 |
3 files changed, 25 insertions, 7 deletions
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java index b9ccd72..b7c5a82 100644 --- a/src/com/android/browser/BaseUi.java +++ b/src/com/android/browser/BaseUi.java @@ -932,4 +932,12 @@ public class BaseUi implements UI, WebViewFactory { return mVideoProgressView; } + @Override + public void showMaxTabsWarning() { + Toast warning = Toast.makeText(mActivity, + mActivity.getString(R.string.max_tabs_warning), + Toast.LENGTH_SHORT); + warning.show(); + } + } diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java index e4b0982..4b341da 100644 --- a/src/com/android/browser/Controller.java +++ b/src/com/android/browser/Controller.java @@ -2107,9 +2107,19 @@ public class Controller } } + @Override + public Tab openTabToHomePage() { + // check for max tabs + if (mTabControl.canCreateNewTab()) { + return openTabAndShow(mSettings.getHomePage(), false, null); + } else { + mUi.showMaxTabsWarning(); + return null; + } + } + // A wrapper function of {@link #openTabAndShow(UrlData, boolean, String)} // that accepts url as string. - protected Tab openTabAndShow(String url, boolean closeOnExit, String appId) { return openTabAndShow(new UrlData(url), closeOnExit, appId); } @@ -2166,8 +2176,10 @@ public class Controller addTab(tab); setActiveTab(tab); return tab; + } else { + mUi.showMaxTabsWarning(); + return null; } - return null; } /** @@ -2191,11 +2203,6 @@ public class Controller } @Override - public Tab openTabToHomePage() { - return openTabAndShow(mSettings.getHomePage(), false, null); - } - - @Override public void closeCurrentTab() { // hide combo view if open removeComboView(); diff --git a/src/com/android/browser/UI.java b/src/com/android/browser/UI.java index 2bfec44..b56ba30 100644 --- a/src/com/android/browser/UI.java +++ b/src/com/android/browser/UI.java @@ -131,4 +131,7 @@ public interface UI extends ScrollListener { View getVideoLoadingProgressView(); void bookmarkedStatusHasChanged(Tab tab); + + void showMaxTabsWarning(); + } |