summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/ActiveTabsPage.java
diff options
context:
space:
mode:
authorMichael Kolb <kolby@google.com>2010-10-26 16:08:53 -0700
committerMichael Kolb <kolby@google.com>2010-11-17 13:27:05 -0800
commit8233facddcc51865d612a919d450db6954aa48e3 (patch)
tree049b5f9ac93146d842aa1c28a168e93783ea578a /src/com/android/browser/ActiveTabsPage.java
parentd9fb57958a0bea503b43d740057e3a4623c91d12 (diff)
downloadpackages_apps_Browser-8233facddcc51865d612a919d450db6954aa48e3.zip
packages_apps_Browser-8233facddcc51865d612a919d450db6954aa48e3.tar.gz
packages_apps_Browser-8233facddcc51865d612a919d450db6954aa48e3.tar.bz2
Controller Refactor
Bug: 3170671 First step towards a model/view/control design in Browser introduced Controller object started separating UI code represent state of the app in one place only Change-Id: Ica387d6bde2dcf1a4993c3db0cce498cf34ff60f
Diffstat (limited to 'src/com/android/browser/ActiveTabsPage.java')
-rw-r--r--src/com/android/browser/ActiveTabsPage.java33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/com/android/browser/ActiveTabsPage.java b/src/com/android/browser/ActiveTabsPage.java
index e450a99..fb5ed3b 100644
--- a/src/com/android/browser/ActiveTabsPage.java
+++ b/src/com/android/browser/ActiveTabsPage.java
@@ -21,7 +21,6 @@ import android.graphics.Bitmap;
import android.os.Handler;
import android.util.AttributeSet;
import android.util.Log;
-import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -33,17 +32,19 @@ import android.widget.ListView;
import android.widget.TextView;
public class ActiveTabsPage extends LinearLayout {
+
private static final String LOGTAG = "TabPicker";
- private final BrowserActivity mBrowserActivity;
- private final LayoutInflater mFactory;
- private final TabControl mControl;
- private final TabsListAdapter mAdapter;
- private final ListView mListView;
- public ActiveTabsPage(BrowserActivity context, TabControl control) {
+ private final LayoutInflater mFactory;
+ private final UiController mUiController;
+ private final TabControl mControl;
+ private final TabsListAdapter mAdapter;
+ private final ListView mListView;
+
+ public ActiveTabsPage(Context context, UiController control) {
super(context);
- mBrowserActivity = context;
- mControl = control;
+ mUiController = control;
+ mControl = control.getTabControl();
mFactory = LayoutInflater.from(context);
mFactory.inflate(R.layout.active_tabs, this);
mListView = (ListView) findViewById(R.id.list);
@@ -58,19 +59,19 @@ public class ActiveTabsPage extends LinearLayout {
boolean needToAttach = false;
if (position == -2) {
// Create a new tab
- mBrowserActivity.openTabToHomePage();
+ mUiController.openTabToHomePage();
} else if (position == -1) {
// Create a new incognito tab
- mBrowserActivity.openIncognitoTab();
+ mUiController.openIncognitoTab();
} else {
// Open the corresponding tab
// If the tab is the current one, switchToTab will
// do nothing and return, so we need to make sure
// it gets attached back to its mContentView in
// removeActiveTabPage
- needToAttach = !mBrowserActivity.switchToTab(position);
+ needToAttach = !mUiController.switchToTab(position);
}
- mBrowserActivity.removeActiveTabPage(needToAttach);
+ mUiController.removeActiveTabsPage(needToAttach);
}
});
}
@@ -186,11 +187,11 @@ public class ActiveTabsPage extends LinearLayout {
final int closePosition = position;
close.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
- mBrowserActivity.closeTab(
+ mUiController.closeTab(
mControl.getTab(closePosition));
if (tabCount == 1) {
- mBrowserActivity.openTabToHomePage();
- mBrowserActivity.removeActiveTabPage(false);
+ mUiController.openTabToHomePage();
+ mUiController.removeActiveTabsPage(false);
} else {
mNotified = true;
notifyDataSetChanged();