diff options
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(); + } |