Merge "Single Actionbar: no more split" into jb-ub-mail-ur9
diff --git a/res/layout-sw600dp/account_switch_spinner_item.xml b/res/layout-sw600dp/account_switch_spinner_item.xml
deleted file mode 100644
index c6ee7c1..0000000
--- a/res/layout-sw600dp/account_switch_spinner_item.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2011 Google Inc.
- Licensed to The Android Open Source Project.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- View shown in the navigation spinner in the actionbar. -->
-<RelativeLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="match_parent"
- android:paddingLeft="0dip"
- android:layout_marginLeft="0dip"
- android:layout_width="match_parent">
-
- <LinearLayout
- android:layout_height="match_parent"
- android:id="@+id/account_spinner_container"
- android:orientation="vertical"
- android:gravity="center_vertical"
- android:background="@drawable/spinner_ab_holo_light"
- android:duplicateParentState="false"
- android:layout_alignParentLeft="true"
- android:focusable="true"
- android:focusableInTouchMode="false"
- style="@style/AccountSpinnerStyle">
- <TextView
- android:id="@+id/account_first"
- style="@style/AccountSpinnerAnchorTextPrimary"
- android:singleLine="true"
- android:ellipsize="end"
- android:includeFontPadding="false"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
- <TextView
- android:id="@+id/account_second"
- style="@style/AccountSpinnerAnchorTextSecondary"
- android:singleLine="true"
- android:ellipsize="end"
- android:includeFontPadding="false"
- android:layout_marginRight="4dp"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
- </LinearLayout>
-
- <TextView
- android:id="@+id/account_unread"
- android:layout_toRightOf="@id/account_spinner_container"
- style="@style/unreadCountActionBarTablet"/>
-</RelativeLayout>
diff --git a/res/layout/account_switch_spinner_item.xml b/res/layout/account_switch_spinner_item.xml
deleted file mode 100644
index 7681665..0000000
--- a/res/layout/account_switch_spinner_item.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2011 Google Inc.
- Licensed to The Android Open Source Project.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- View shown in the navigation spinner in the actionbar. -->
-<RelativeLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="match_parent"
- android:paddingLeft="0dip"
- android:layout_marginLeft="0dip"
- android:layout_width="match_parent">
-
- <!-- Place the unread count first, taking all the space it needs
- to fit its content -->
- <TextView
- android:id="@+id/account_unread"
- android:layout_alignParentRight="true"
- android:layout_width="wrap_content"
- android:layout_marginLeft="4dp"
- style="@style/UnreadCountActionBar"/>
-
- <!-- Container to soak up space and ensure that the caret attaches
- to a short label name. This container should be anonymous because nothing
- should reference it.
- Phone only: On tablets, the width of the spinner is a constant for each
- orientation. -->
- <LinearLayout
- android:layout_height="match_parent"
- android:orientation="horizontal"
- android:layout_width="fill_parent"
- android:gravity="center_vertical"
- android:clickable="false"
- android:focusable="false"
- android:layout_toLeftOf="@id/account_unread">
-
- <!-- In the container, the label name takes up as much space
- as it needs to show its content: this is to ensure that the
- dropdown caret is flush with the label name. -->
- <LinearLayout
- android:layout_height="match_parent"
- android:id="@+id/account_spinner_container"
- android:orientation="vertical"
- android:gravity="center_vertical"
- android:background="@drawable/spinner_ab_holo_light"
- android:focusable="true"
- android:focusableInTouchMode="false"
- style="@style/AccountSpinnerStyle">
- <TextView
- android:id="@+id/account_first"
- style="@style/AccountSpinnerAnchorTextPrimary"
- android:singleLine="true"
- android:ellipsize="end"
- android:includeFontPadding="false"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
- <TextView
- android:id="@+id/account_second"
- style="@style/AccountSpinnerAnchorTextSecondary"
- android:singleLine="true"
- android:ellipsize="end"
- android:includeFontPadding="false"
- android:layout_marginRight="4dp"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
- </LinearLayout>
- </LinearLayout>
-</RelativeLayout>
diff --git a/res/layout/actionbar_view.xml b/res/layout/actionbar_view.xml
index ffb6c64..7d4b792 100644
--- a/res/layout/actionbar_view.xml
+++ b/res/layout/actionbar_view.xml
@@ -21,16 +21,10 @@
label, and subject).
-->
<com.android.mail.ui.MailActionBarView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
+ android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal" >
-
- <com.android.mail.ui.MailSpinner
- android:id="@+id/account_spinner"
- android:layout_height="match_parent"
- style="@style/AccountSwitchSpinnerItem"
- android:clickable="true"/>
-
+ <!-- Only used for displaying a subject view -->
<include layout="@layout/actionbar_subject" />
</com.android.mail.ui.MailActionBarView>
diff --git a/res/layout/search_actionbar_view.xml b/res/layout/search_actionbar_view.xml
index 93d8de8..613d8c4 100644
--- a/res/layout/search_actionbar_view.xml
+++ b/res/layout/search_actionbar_view.xml
@@ -26,15 +26,6 @@
android:layout_height="match_parent"
android:orientation="horizontal" >
- <com.android.mail.ui.MailSpinner
- android:id="@+id/account_spinner"
- android:layout_height="match_parent"
- android:layout_width="wrap_content"
- style="@style/PlainSpinnerDropdown"
- android:focusableInTouchMode="false"
- android:focusable="false"
- android:clickable="true"/>
-
<include layout="@layout/actionbar_subject" />
</com.android.mail.ui.SearchMailActionBarView>
\ No newline at end of file
diff --git a/res/menu/conversation_list_menu.xml b/res/menu/conversation_list_menu.xml
index 589097a..76ae716 100644
--- a/res/menu/conversation_list_menu.xml
+++ b/res/menu/conversation_list_menu.xml
@@ -34,7 +34,7 @@
<!-- Always available -->
<item android:id="@+id/show_all_folders"
android:title="@string/show_all_folders"
- android:showAsAction="ifRoom"
+ android:showAsAction="never"
android:icon="@drawable/ic_menu_folders_holo_light" />
<!-- Always available -->
diff --git a/src/com/android/mail/ui/AbstractActivityController.java b/src/com/android/mail/ui/AbstractActivityController.java
index 60eb113..f2f86fb 100644
--- a/src/com/android/mail/ui/AbstractActivityController.java
+++ b/src/com/android/mail/ui/AbstractActivityController.java
@@ -465,11 +465,10 @@
if (actionBar != null && mActionBarView != null) {
actionBar.setCustomView(mActionBarView, new ActionBar.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
- // Show a custom view and home icon, but remove the title
+ // Show a custom view and home icon, keep the title and subttitle
final int mask = ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_TITLE
| ActionBar.DISPLAY_SHOW_HOME;
- final int enabled = ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME;
- actionBar.setDisplayOptions(enabled, mask);
+ actionBar.setDisplayOptions(mask, mask);
mActionBarView.attach();
}
mViewMode.addListener(mActionBarView);
@@ -2131,7 +2130,6 @@
// accounts in the ActionBar.
mAllAccounts = allAccounts;
mAllAccountObservers.notifyChanged();
- mActionBarView.setAccounts(allAccounts);
return (allAccounts.length > 0);
}
diff --git a/src/com/android/mail/ui/MailActionBarView.java b/src/com/android/mail/ui/MailActionBarView.java
index d468156..1248017 100644
--- a/src/com/android/mail/ui/MailActionBarView.java
+++ b/src/com/android/mail/ui/MailActionBarView.java
@@ -17,6 +17,22 @@
package com.android.mail.ui;
+import com.android.mail.ConversationListContext;
+import com.android.mail.R;
+import com.android.mail.browse.SnippetTextView;
+import com.android.mail.providers.Account;
+import com.android.mail.providers.AccountObserver;
+import com.android.mail.providers.Conversation;
+import com.android.mail.providers.Folder;
+import com.android.mail.providers.FolderObserver;
+import com.android.mail.providers.SearchRecentSuggestionsProvider;
+import com.android.mail.providers.UIProvider;
+import com.android.mail.providers.UIProvider.AccountCapabilities;
+import com.android.mail.providers.UIProvider.FolderCapabilities;
+import com.android.mail.utils.LogTag;
+import com.android.mail.utils.LogUtils;
+import com.android.mail.utils.Utils;
+
import android.app.ActionBar;
import android.app.SearchManager;
import android.app.SearchableInfo;
@@ -39,23 +55,7 @@
import android.widget.SearchView;
import android.widget.SearchView.OnQueryTextListener;
import android.widget.SearchView.OnSuggestionListener;
-
-import com.android.mail.AccountSpinnerAdapter;
-import com.android.mail.ConversationListContext;
-import com.android.mail.R;
-import com.android.mail.browse.SnippetTextView;
-import com.android.mail.providers.Account;
-import com.android.mail.providers.AccountObserver;
-import com.android.mail.providers.Conversation;
-import com.android.mail.providers.Folder;
-import com.android.mail.providers.FolderObserver;
-import com.android.mail.providers.SearchRecentSuggestionsProvider;
-import com.android.mail.providers.UIProvider;
-import com.android.mail.providers.UIProvider.AccountCapabilities;
-import com.android.mail.providers.UIProvider.FolderCapabilities;
-import com.android.mail.utils.LogTag;
-import com.android.mail.utils.LogUtils;
-import com.android.mail.utils.Utils;
+import android.widget.TextView;
/**
* View to manage the various states of the Mail Action Bar.
@@ -79,8 +79,6 @@
private int mMode = ViewMode.UNKNOWN;
private MenuItem mSearch;
- private AccountSpinnerAdapter mSpinnerAdapter;
- private MailSpinner mSpinner;
/**
* The account currently being shown
*/
@@ -99,10 +97,6 @@
private View mRefreshActionView;
private boolean mRefreshInProgress;
private Conversation mCurrentConversation;
- /**
- * True if we are running on tablet.
- */
- private final boolean mIsOnTablet;
public static final String LOG_TAG = LogTag.getLogTag();
@@ -120,7 +114,6 @@
@Override
public void onChanged(Account newAccount) {
updateAccount(newAccount);
- mSpinner.setAccount(mAccount);
}
};
@@ -166,9 +159,6 @@
return reports;
}
- /** True if the application has more than one account. */
- private boolean mHasManyAccounts;
-
// Created via view inflation.
@SuppressWarnings("unused")
public MailActionBarView(Context context) {
@@ -183,13 +173,11 @@
super(context, attrs, defStyle);
final Resources r = getResources();
mShowConversationSubject = r.getBoolean(R.bool.show_conversation_subject);
- mIsOnTablet = Utils.useTabletUI(r);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
-
mSubjectView = (SnippetTextView) findViewById(R.id.conversation_subject);
}
@@ -281,24 +269,21 @@
}
};
mFolderObserver.initialize(mController);
- // We don't want to include the "Show all folders" menu item on tablet devices
- final Context context = getContext();
- final boolean showAllFolders = !Utils.useTabletUI(context.getResources());
- mSpinnerAdapter = new AccountSpinnerAdapter(activity, context, showAllFolders);
- mSpinner = (MailSpinner) findViewById(R.id.account_spinner);
- mSpinner.setAdapter(mSpinnerAdapter);
- mSpinner.setController(mController);
updateAccount(mAccountObserver.initialize(activity.getAccountController()));
}
private void updateAccount(Account account) {
mAccount = account;
+ // Always show the name: TODO(viki) Only show if multiple accounts.
if (mAccount != null) {
- ContentResolver resolver = mActivity.getActivityContext().getContentResolver();
- Bundle bundle = new Bundle(1);
+ final ContentResolver resolver = mActivity.getActivityContext().getContentResolver();
+ final Bundle bundle = new Bundle(1);
bundle.putParcelable(UIProvider.SetCurrentAccountColumns.ACCOUNT, account);
resolver.call(mAccount.uri, UIProvider.AccountCallMethods.SET_CURRENT_ACCOUNT,
mAccount.uri.toString(), bundle);
+ if (mActionBar != null) {
+ mActionBar.setSubtitle(account.name);
+ }
}
}
@@ -310,45 +295,13 @@
}
/**
- * Sets the array of accounts to the value provided here.
- * @param accounts array of all accounts on the device.
- */
- public void setAccounts(Account[] accounts) {
- mSpinnerAdapter.setAccountArray(accounts);
- mHasManyAccounts = accounts.length > 1;
- enableDisableSpinnner();
- }
-
- /**
- * Changes the spinner state according to the following logic. On phone we always show recent
- * labels: pre-populating if necessary. So on phone we always want to enable the spinner.
- * On tablet, we enable the spinner when the Folder list is NOT visible: In conversation view,
- * and search conversation view.
- */
- private void enableDisableSpinnner() {
- // Spinner is always shown on phone, and it is enabled by default, so don't mess with it.
- // By default the drawable is set in the XML layout, and the view is enabled.
- if (!mIsOnTablet) {
- return;
- }
- // We do not populate default recent folders on tablet, so we need to check that in the
- // conversation mode we have some recent folders. If we don't have any, then we should
- // disable the spinner.
- final boolean hasRecentsInConvView = ViewMode.isConversationMode(mMode)
- && mSpinnerAdapter.hasRecentFolders();
- // More than one account, OR has recent folders in conversation view.
- final boolean enabled = mHasManyAccounts || hasRecentsInConvView;
- mSpinner.changeEnabledState(enabled);
- }
-
- /**
* Called by the owner of the ActionBar to set the
* folder that is currently being displayed.
*/
public void setFolder(Folder folder) {
setRefreshInProgress(false);
mFolder = folder;
- mSpinner.setFolder(folder);
+ updateFolder(folder);
mActivity.invalidateOptionsMenu();
}
@@ -357,25 +310,15 @@
mFolderObserver.unregisterAndDestroy();
mFolderObserver = null;
}
- mSpinnerAdapter.destroy();
mAccountObserver.unregisterAndDestroy();
}
@Override
public void onViewModeChanged(int newMode) {
mMode = newMode;
- // Always update the options menu and redraw. This will read the new mode and redraw
- // the options menu.
- enableDisableSpinnner();
mActivity.invalidateOptionsMenu();
// Check if we are either on a phone, or in Conversation mode on tablet. For these, the
// recent folders is enabled.
- if (mIsOnTablet || mMode == ViewMode.CONVERSATION) {
- mSpinnerAdapter.enableRecentFolders();
- } else {
- mSpinnerAdapter.disableRecentFolders();
- }
-
switch (mMode) {
case ViewMode.UNKNOWN:
closeSearchField();
@@ -478,8 +421,7 @@
* Put the ActionBar in List navigation mode. This starts the spinner up if it is missing.
*/
private void showNavList() {
- setTitleModeFlags(ActionBar.DISPLAY_SHOW_CUSTOM);
- mSpinner.setVisibility(View.VISIBLE);
+ setTitleModeFlags(ActionBar.DISPLAY_SHOW_TITLE);
mSubjectView.setVisibility(View.GONE);
}
@@ -490,7 +432,6 @@
*/
protected void setSnippetMode() {
setTitleModeFlags(ActionBar.DISPLAY_SHOW_CUSTOM);
- mSpinner.setVisibility(View.GONE);
mSubjectView.setVisibility(View.VISIBLE);
mSubjectView.addOnLayoutChangeListener(mSnippetLayoutListener);
@@ -506,8 +447,7 @@
* Set the actionbar mode to empty: no title, no custom content.
*/
protected void setEmptyMode() {
- setTitleModeFlags(ActionBar.DISPLAY_SHOW_CUSTOM);
- mSpinner.setVisibility(View.GONE);
+ setTitleModeFlags(ActionBar.DISPLAY_SHOW_TITLE);
mSubjectView.setVisibility(View.GONE);
}
@@ -615,11 +555,16 @@
return true;
}
+ private void updateFolder(Folder in) {
+ mActionBar.setTitle(in.name);
+ // TODO(viki): Show unread count.
+ }
+
/**
* Notify that the folder has changed.
*/
public void onFolderUpdated(Folder folder) {
- mSpinner.onFolderUpdated(folder);
+ updateFolder(folder);
if (folder.isSyncInProgress()) {
onRefreshStarted();
} else {
@@ -658,7 +603,6 @@
private void setTitleModeFlags(int enabledFlags) {
final int mask = ActionBar.DISPLAY_SHOW_TITLE
| ActionBar.DISPLAY_SHOW_CUSTOM | DISPLAY_TITLE_MULTIPLE_LINES;
-
mActionBar.setDisplayOptions(enabledFlags, mask);
}
diff --git a/src/com/android/mail/ui/MailSpinner.java b/src/com/android/mail/ui/MailSpinner.java
deleted file mode 100644
index 6ddbd06..0000000
--- a/src/com/android/mail/ui/MailSpinner.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/**
- * Copyright (c) 2012, Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.android.mail.ui;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.FrameLayout;
-import android.widget.LinearLayout;
-import android.widget.ListPopupWindow;
-import android.widget.TextView;
-
-import com.android.mail.AccountSpinnerAdapter;
-import com.android.mail.R;
-import com.android.mail.providers.Account;
-import com.android.mail.providers.Folder;
-import com.android.mail.utils.LogTag;
-import com.android.mail.utils.LogUtils;
-import com.android.mail.utils.Utils;
-
-public class MailSpinner extends FrameLayout implements OnItemClickListener, OnClickListener {
- private static final String LOG_TAG = LogTag.getLogTag();
- private final ListPopupWindow mListPopupWindow;
- private AccountSpinnerAdapter mSpinnerAdapter;
- private Account mAccount;
- private ActivityController mController;
- private final TextView mAccountName;
- private final TextView mFolderName;
- private final TextView mFolderCount;
- private final LinearLayout mContainer;
-
- // Created through view inflation.
- @SuppressWarnings("unused")
- public MailSpinner(Context context) {
- this(context, null);
- }
-
- public MailSpinner(Context context, AttributeSet attrs) {
- this(context, attrs, -1);
- }
-
- public MailSpinner(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- mListPopupWindow = new ListPopupWindow(context);
- mListPopupWindow.setOnItemClickListener(this);
- mListPopupWindow.setAnchorView(this);
- final int dropDownWidth = context.getResources().getDimensionPixelSize(
- R.dimen.account_dropdown_dropdownwidth);
- mListPopupWindow.setWidth(dropDownWidth);
- mListPopupWindow.setModal(true);
- addView(LayoutInflater.from(context).inflate(R.layout.account_switch_spinner_item, null));
- mAccountName = (TextView) findViewById(R.id.account_second);
- mFolderName = (TextView) findViewById(R.id.account_first);
- mFolderCount = (TextView) findViewById(R.id.account_unread);
- mContainer = (LinearLayout) findViewById(R.id.account_spinner_container);
- mContainer.setOnClickListener(this);
- }
-
- public void setAdapter(AccountSpinnerAdapter adapter) {
- mSpinnerAdapter = adapter;
- mListPopupWindow.setAdapter(mSpinnerAdapter);
- }
-
- /**
- * Changes the enabled state of the spinner. Not called {@link #setEnabled(boolean)} because
- * that is an existing method on views.
- *
- * @param enabled true if the spinner allows touch events, and shows a little triangle on the
- * bottom right indicating that it is a spinner. False if it is just a view
- * showing the account name.
- */
- public final void changeEnabledState(boolean enabled) {
- setEnabled(enabled);
- if (enabled) {
- mContainer.setBackgroundResource(R.drawable.spinner_ab_holo_light);
- } else {
- mContainer.setBackgroundDrawable(null);
- }
- }
-
- public void setAccount(Account account) {
- mAccount = account;
- if (mAccount != null) {
- mAccountName.setText(mAccount.name);
- }
- }
-
- public void setFolder(Folder folder) {
- if (folder != null) {
- mFolderName.setText(folder.name);
- final int unreadCount = Utils.getFolderUnreadDisplayCount(folder);
- mFolderCount.setText(Utils.getUnreadCountString(getContext(), unreadCount));
- mFolderCount.setContentDescription(Utils.formatPlural(getContext(),
- R.plurals.unread_mail_count, unreadCount));
-
- if (mSpinnerAdapter != null) {
- // Update the spinner with this current folder, as it could change the recent items
- // that are shown.
- mSpinnerAdapter.setCurrentFolder(folder);
- }
- }
- }
-
- @Override
- public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
- LogUtils.d(LOG_TAG, "onNavigationItemSelected(%d, %d) called", position, id);
- final int type = mSpinnerAdapter.getItemViewType(position);
- boolean dismiss = false;
- switch (type) {
- case AccountSpinnerAdapter.TYPE_ACCOUNT:
- // Get the capabilities associated with this account.
- final Account account = (Account) mSpinnerAdapter.getItem(position);
- LogUtils.d(LOG_TAG, "onNavigationItemSelected: Selecting account: %s",
- account.name);
- if (mAccount.uri.equals(account.uri)) {
- // The selected account is the same, let's load the default inbox.
- mController.loadAccountInbox();
- } else {
- // Switching accounts.
- mController.changeAccount(account);
- }
- dismiss = true;
- break;
- case AccountSpinnerAdapter.TYPE_FOLDER:
- final Object folder = mSpinnerAdapter.getItem(position);
- assert (folder instanceof Folder);
- LogUtils.d(LOG_TAG, "onNavigationItemSelected: Selecting folder: %s",
- ((Folder)folder).name);
- mController.onFolderChanged((Folder) folder);
- dismiss = true;
- break;
- case AccountSpinnerAdapter.TYPE_ALL_FOLDERS:
- mController.loadFolderList();
- dismiss = true;
- break;
- case AccountSpinnerAdapter.TYPE_HEADER:
- LogUtils.e(LOG_TAG, "MailSpinner.onItemClick(): Got unexpected click on header.");
- break;
- default:
- LogUtils.e(LOG_TAG, "MailSpinner.onItemClick(%d): Strange click ignored: type %d.",
- position, type);
- break;
- }
- if (dismiss) {
- mListPopupWindow.dismiss();
- }
- }
-
- public void setController(ActivityController controller) {
- mController = controller;
- }
-
- @Override
- public void onClick(View arg0) {
- if (isEnabled() && !mListPopupWindow.isShowing()) {
- mListPopupWindow.show();
- // Commit any leave behind items.
- mController.commitDestructiveActions(false);
- }
- }
-
- public void dismiss() {
- mListPopupWindow.dismiss();
- }
-
- public void onFolderUpdated(Folder folder) {
- mSpinnerAdapter.onFolderUpdated(folder);
- setFolder(folder);
- }
-}