Merge "Update Move To icon on action bar" into ub-gmail-ur14-dev
diff --git a/res/layout/search_suggestion_item.xml b/res/layout/search_suggestion_item.xml
index 49b0256..2d6caab 100644
--- a/res/layout/search_suggestion_item.xml
+++ b/res/layout/search_suggestion_item.xml
@@ -18,30 +18,24 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="@dimen/search_suggestion_height"
- android:orientation="vertical">
+ android:layout_height="wrap_content"
+ android:paddingTop="@dimen/search_suggestion_padding"
+ android:paddingBottom="@dimen/search_suggestion_padding">
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center_vertical"
- android:paddingRight="16dp">
+ <ImageView
+ android:id="@+id/search_overlay_item_icon"
+ android:layout_width="@dimen/search_leading_button_width"
+ android:layout_height="wrap_content"
+ style="@style/SearchViewLeadingButton" />
- <ImageView
- android:id="@+id/search_overlay_item_icon"
- android:layout_width="@dimen/search_leading_button_width"
- android:layout_height="match_parent"
- style="@style/SearchViewLeadingButton" />
-
- <TextView
- android:id="@+id/search_overlay_item_text"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:layout_weight="1"
- android:textColor="@color/search_suggestion_item_text"
- android:textSize="16sp" />
-
- </LinearLayout>
+ <TextView
+ android:id="@+id/search_overlay_item_text"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:layout_weight="1"
+ android:textColor="@color/search_suggestion_item_text"
+ android:textSize="16sp"
+ style="@style/SearchSuggestionTextStyle" />
</LinearLayout>
\ No newline at end of file
diff --git a/res/values-ldrtl/styles-ldrtl.xml b/res/values-ldrtl/styles-ldrtl.xml
index 69e86f8..54df227 100644
--- a/res/values-ldrtl/styles-ldrtl.xml
+++ b/res/values-ldrtl/styles-ldrtl.xml
@@ -384,12 +384,15 @@
</style>
<style name="SearchViewLeadingButton">
- <item name="android:layout_gravity">center_vertical</item>
- <item name="android:paddingStart">16dp</item>
- <item name="android:paddingEnd">32dp</item>
+ <item name="android:paddingStart">@dimen/search_leading_button_padding_start</item>
+ <item name="android:paddingEnd">@dimen/search_leading_button_padding_end</item>
<item name="android:scaleType">center</item>
</style>
+ <style name="SearchSuggestionTextStyle">
+ <item name="android:paddingEnd">@dimen/search_suggestion_padding</item>
+ </style>
+
<style name="AccountItemNameStyle">
<item name="android:paddingStart">@dimen/account_item_name_start_padding</item>
<item name="android:paddingEnd">@dimen/account_item_name_end_padding</item>
diff --git a/res/values-sw600dp-land/constants.xml b/res/values-sw600dp-land/constants.xml
index 7d9fb02..8b3aa15 100644
--- a/res/values-sw600dp-land/constants.xml
+++ b/res/values-sw600dp-land/constants.xml
@@ -15,8 +15,8 @@
limitations under the License.
-->
<resources>
- <!-- Whether the list is collapsible in conversation view mode -->
- <bool name="list_collapsible">false</bool>
+ <!-- Whether we are in landscape mode on a tablet or not -->
+ <bool name="is_tablet_landscape">true</bool>
<!-- Whether to show single or 2 pane search results -->
<bool name="show_two_pane_search_results">true</bool>
diff --git a/res/values/constants.xml b/res/values/constants.xml
index a92445a..8b4817b 100644
--- a/res/values/constants.xml
+++ b/res/values/constants.xml
@@ -55,8 +55,8 @@
<integer name="conversation_unstyled_font_size_px">13</integer>
<integer name="conversation_webview_viewport_px">980</integer>
- <!-- Whether the list is collapsible in conversation view mode -->
- <bool name="list_collapsible">true</bool>
+ <!-- Whether we are in landscape mode on a tablet or not -->
+ <bool name="is_tablet_landscape">false</bool>
<!-- Whether to show single or 2 pane search results -->
<bool name="show_two_pane_search_results">false</bool>
diff --git a/res/values/dimen.xml b/res/values/dimen.xml
index 777b796..5720c71 100644
--- a/res/values/dimen.xml
+++ b/res/values/dimen.xml
@@ -150,8 +150,10 @@
<dimen name="widget_attachment_padding_end">8dp</dimen>
<dimen name="search_leading_button_width">72dp</dimen>
+ <dimen name="search_leading_button_padding_start">16dp</dimen>
+ <dimen name="search_leading_button_padding_end">32dp</dimen>
<dimen name="search_ending_button_width">56dp</dimen>
- <dimen name="search_suggestion_height">56dp</dimen>
+ <dimen name="search_suggestion_padding">16dp</dimen>
<dimen name="search_results_padding">16dp</dimen>
<dimen name="search_banner_text_size">12sp</dimen>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index c305241..484ec52 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -973,12 +973,15 @@
</style>
<style name="SearchViewLeadingButton">
- <item name="android:layout_gravity">center_vertical</item>
- <item name="android:paddingLeft">16dp</item>
- <item name="android:paddingRight">32dp</item>
+ <item name="android:paddingLeft">@dimen/search_leading_button_padding_start</item>
+ <item name="android:paddingRight">@dimen/search_leading_button_padding_end</item>
<item name="android:scaleType">center</item>
</style>
+ <style name="SearchSuggestionTextStyle">
+ <item name="android:paddingRight">@dimen/search_suggestion_padding</item>
+ </style>
+
<style name="AccountItemNameStyle">
<item name="android:paddingLeft">@dimen/account_item_name_start_padding</item>
<item name="android:paddingRight">@dimen/account_item_name_end_padding</item>
diff --git a/src/com/android/mail/browse/ConversationItemView.java b/src/com/android/mail/browse/ConversationItemView.java
index 507d808..aae00e2 100644
--- a/src/com/android/mail/browse/ConversationItemView.java
+++ b/src/com/android/mail/browse/ConversationItemView.java
@@ -444,7 +444,7 @@
mContext = context.getApplicationContext();
final Resources res = mContext.getResources();
mTabletDevice = Utils.useTabletUI(res);
- mListCollapsible = res.getBoolean(R.bool.list_collapsible);
+ mListCollapsible = !res.getBoolean(R.bool.is_tablet_landscape);
mAccount = account;
getItemViewResources(mContext);
diff --git a/src/com/android/mail/ui/ActionBarController.java b/src/com/android/mail/ui/ActionBarController.java
index 32b0032..cfa006e 100644
--- a/src/com/android/mail/ui/ActionBarController.java
+++ b/src/com/android/mail/ui/ActionBarController.java
@@ -181,6 +181,9 @@
@Override
public void onViewModeChanged(int newMode) {
+ final boolean mIsTabletLandscape =
+ mContext.getResources().getBoolean(R.bool.is_tablet_landscape);
+
mActivity.supportInvalidateOptionsMenu();
// Check if we are either on a phone, or in Conversation mode on tablet. For these, the
// recent folders is enabled.
@@ -195,6 +198,13 @@
setEmptyMode();
break;
case ViewMode.CONVERSATION:
+ // If on tablet landscape, show current folder instead of emptying the action bar
+ if (mIsTabletLandscape) {
+ mActionBar.setDisplayHomeAsUpEnabled(true);
+ showNavList();
+ break;
+ }
+ // Otherwise, fall through to default behavior, shared with Ads ViewMode.
case ViewMode.AD:
mActionBar.setDisplayHomeAsUpEnabled(true);
setEmptyMode();
diff --git a/src/com/android/mail/ui/MiniDrawerView.java b/src/com/android/mail/ui/MiniDrawerView.java
index 83c8f5d..0f0abe0 100644
--- a/src/com/android/mail/ui/MiniDrawerView.java
+++ b/src/com/android/mail/ui/MiniDrawerView.java
@@ -17,7 +17,6 @@
package com.android.mail.ui;
import android.content.Context;
-import android.support.annotation.LayoutRes;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
@@ -29,9 +28,6 @@
import com.android.mail.content.ObjectCursor;
import com.android.mail.providers.Account;
import com.android.mail.providers.Folder;
-import com.google.common.collect.Lists;
-
-import java.util.List;
/**
* A smaller version of the account- and folder-switching drawer view for tablet UIs.
@@ -39,7 +35,6 @@
public class MiniDrawerView extends LinearLayout {
private FolderListFragment mController;
- private final int mDrawWidth;
// use the same dimen as AccountItemView to participate in recycling
// TODO: but Material account switcher doesn't recycle...
private final int mAvatarDecodeSize;
@@ -48,7 +43,6 @@
private View mSpacer;
private AccountItem mCurrentAccount;
- private final List<AccountItem> mRecentAccounts = Lists.newArrayList();
private final LayoutInflater mInflater;
@@ -61,7 +55,6 @@
public MiniDrawerView(Context context, AttributeSet attrs) {
super(context, attrs);
- mDrawWidth = getResources().getDimensionPixelSize(R.dimen.two_pane_drawer_width_mini);
mAvatarDecodeSize = getResources().getDimensionPixelSize(R.dimen.account_avatar_dimension);
mInflater = LayoutInflater.from(context);
@@ -116,7 +109,7 @@
if (count >= NUM_RECENT_ACCOUNTS) {
break;
}
- if (currentAccount.uri.equals(a.uri)) {
+ if (currentAccount != null && currentAccount.uri.equals(a.uri)) {
continue;
}
final ImageView iv = (ImageView) mInflater.inflate(
diff --git a/src/com/android/mail/ui/TwoPaneController.java b/src/com/android/mail/ui/TwoPaneController.java
index 6e167f9..3238c02 100644
--- a/src/com/android/mail/ui/TwoPaneController.java
+++ b/src/com/android/mail/ui/TwoPaneController.java
@@ -161,7 +161,7 @@
mLayout.setConversationListLayoutListener(mConversationListLayoutListener);
mLayout.setController(this, Intent.ACTION_SEARCH.equals(mActivity.getIntent().getAction()));
mActivity.getWindow().setBackgroundDrawable(null);
- mIsTabletLandscape = !mActivity.getResources().getBoolean(R.bool.list_collapsible);
+ mIsTabletLandscape = mActivity.getResources().getBoolean(R.bool.is_tablet_landscape);
final FolderListFragment flf = getFolderListFragment();
flf.setMiniDrawerEnabled(true);
diff --git a/src/com/android/mail/ui/TwoPaneLayout.java b/src/com/android/mail/ui/TwoPaneLayout.java
index 571311f..1430898 100644
--- a/src/com/android/mail/ui/TwoPaneLayout.java
+++ b/src/com/android/mail/ui/TwoPaneLayout.java
@@ -118,7 +118,7 @@
// The conversation list might be visible now, depending on the layout: in portrait we
// don't show the conversation list, but in landscape we do. This information is stored
// in the constants
- mListCollapsible = res.getBoolean(R.bool.list_collapsible);
+ mListCollapsible = !res.getBoolean(R.bool.is_tablet_landscape);
mDrawerWidthMini = res.getDimensionPixelSize(R.dimen.two_pane_drawer_width_mini);
mDrawerWidthOpen = res.getDimensionPixelSize(R.dimen.two_pane_drawer_width_open);