diff options
author | Jin Cao <jinyan@google.com> | 2014-08-19 16:32:42 -0700 |
---|---|---|
committer | Jin Cao <jinyan@google.com> | 2014-08-20 17:15:15 -0700 |
commit | 4c59495929c9b8a57fbcc05ad419a329240dbd00 (patch) | |
tree | 5901e8e9f17875b6445ef8ffe5d1cff280534d78 | |
parent | 33ca5c670394671177f82ed049d8d7c6920164a7 (diff) | |
download | android_packages_apps_UnifiedEmail-4c59495929c9b8a57fbcc05ad419a329240dbd00.tar.gz android_packages_apps_UnifiedEmail-4c59495929c9b8a57fbcc05ad419a329240dbd00.tar.bz2 android_packages_apps_UnifiedEmail-4c59495929c9b8a57fbcc05ad419a329240dbd00.zip |
[Quantum TL] nested folders
Update the nested folders UI to reflect the newest redlines.
Also removed all signs of list_edge_tablet since it's no longer
relevant.
b/16017301
Change-Id: I24fcb43984b595a4fed84622e79ce76deaa92d2b
21 files changed, 161 insertions, 358 deletions
diff --git a/res/drawable/ic_collapse_24dp.xml b/res/drawable/ic_collapse_24dp.xml new file mode 100644 index 000000000..903decb36 --- /dev/null +++ b/res/drawable/ic_collapse_24dp.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> + +<rotate xmlns:android="http://schemas.android.com/apk/res/android" + android:drawable="@drawable/ic_expand_more_24dp" + android:fromDegrees="180" + android:toDegrees="180" + android:visible="true" />
\ No newline at end of file diff --git a/res/drawable/list_edge_tablet.xml b/res/drawable/list_edge_tablet.xml deleted file mode 100644 index d6aae7628..000000000 --- a/res/drawable/list_edge_tablet.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2013 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. ---> - -<shape xmlns:android="http://schemas.android.com/apk/res/android"> - <size - android:width="1dp" /> - <solid - android:color="@color/light_gray" /> -</shape> diff --git a/res/layout/conversation_long_press_to_select_tip_view.xml b/res/layout/conversation_long_press_to_select_tip_view.xml index 59b17ff12..dc0f3d077 100644 --- a/res/layout/conversation_long_press_to_select_tip_view.xml +++ b/res/layout/conversation_long_press_to_select_tip_view.xml @@ -48,7 +48,6 @@ android:src="@drawable/ic_cancel_holo_light" style="@style/DismissButtonStyle" /> - <include layout="@layout/teaser_right_edge" /> </LinearLayout> </com.android.mail.ui.ConversationLongPressTipView> diff --git a/res/layout/conversation_outbox_tip_view.xml b/res/layout/conversation_outbox_tip_view.xml index 6277c300f..e10f9232f 100644 --- a/res/layout/conversation_outbox_tip_view.xml +++ b/res/layout/conversation_outbox_tip_view.xml @@ -47,7 +47,6 @@ android:src="@drawable/ic_cancel_holo_light" style="@style/DismissButtonStyle" /> - <include layout="@layout/teaser_right_edge" /> </LinearLayout> </com.android.mail.ui.ConversationsInOutboxTipView> diff --git a/res/layout/conversation_photo_teaser_view.xml b/res/layout/conversation_photo_teaser_view.xml index 6aac4d8a4..f66c16976 100644 --- a/res/layout/conversation_photo_teaser_view.xml +++ b/res/layout/conversation_photo_teaser_view.xml @@ -57,7 +57,6 @@ android:src="@drawable/ic_cancel_holo_light" style="@style/DismissButtonStyle" /> - <include layout="@layout/teaser_right_edge" /> </LinearLayout> </com.android.mail.ui.ConversationPhotoTeaserView> diff --git a/res/layout/conversation_sync_disabled_tip_view.xml b/res/layout/conversation_sync_disabled_tip_view.xml index 1ed63a739..8d96d70ce 100644 --- a/res/layout/conversation_sync_disabled_tip_view.xml +++ b/res/layout/conversation_sync_disabled_tip_view.xml @@ -61,7 +61,6 @@ android:src="@drawable/ic_cancel_holo_light" style="@style/DismissButtonStyle" /> - <include layout="@layout/teaser_right_edge" /> </LinearLayout> </com.android.mail.ui.ConversationSyncDisabledTipView> diff --git a/res/layout/folder_teaser_item.xml b/res/layout/folder_teaser_item.xml index 65bd68030..f949d5d08 100644 --- a/res/layout/folder_teaser_item.xml +++ b/res/layout/folder_teaser_item.xml @@ -15,61 +15,61 @@ --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="56dp" - android:background="@drawable/folder_teaser_item_background"> - - <ImageView - android:id="@+id/folder_imageView" - android:layout_width="24dp" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:duplicateParentState="true" - style="@style/FolderTeaserMarginStartStyle" /> + android:layout_height="wrap_content" + android:background="@drawable/folder_teaser_item_background" + android:orientation="vertical"> <LinearLayout - android:id="@+id/text_layout" - android:layout_width="0dip" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_weight="1" - android:layout_gravity="center_vertical" - android:duplicateParentState="true" - android:orientation="vertical" - style="@style/FolderTeaserLabelMarginStyle" > + android:minHeight="@dimen/folder_teaser_item_height" + style="@style/FolderTeaserMarginEndStyle"> - <TextView - android:id="@+id/folder_textView" - android:layout_width="wrap_content" + <ImageView + android:id="@+id/nested_folder_icon" + android:layout_width="@dimen/folder_teaser_start_margin" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:paddingLeft="24dp" + android:paddingRight="24dp" + android:src="@drawable/ic_drawer_folder_24dp" /> + + <LinearLayout + android:id="@+id/text_layout" + android:layout_width="0dp" android:layout_height="wrap_content" - android:duplicateParentState="true" - android:includeFontPadding="false" - android:textColor="@color/folder_teaser_main_text" - android:textSize="16sp" - android:textStyle="bold" - android:singleLine="true" - android:ellipsize="end" /> + android:layout_weight="1" + android:layout_gravity="center_vertical" + android:orientation="vertical"> + + <TextView + android:id="@+id/folder_textView" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="end" + android:singleLine="true" + android:textSize="16sp" + android:textColor="@color/folder_teaser_main_text"/> + + <TextView + android:id="@+id/senders_textView" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="end" + android:singleLine="true" + android:textSize="14sp" + android:textColor="@color/folder_teaser_sub_text" /> + + </LinearLayout> <TextView - android:id="@+id/senders_textView" + android:id="@+id/count_textView" android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:duplicateParentState="true" - android:includeFontPadding="false" - android:fontFamily="sans-serif-light" - android:textColor="@color/folder_teaser_senders_text" - android:textSize="12sp" - android:singleLine="true" - android:ellipsize="end" /> + android:layout_height="match_parent" + style="@style/FolderTeaserCountTextStyle" /> </LinearLayout> - <TextView - android:id="@+id/count_textView" - android:layout_width="57sp" - android:layout_height="20sp" - android:layout_gravity="center_vertical" - android:gravity="center" - android:textColor="@color/folder_teaser_count_text" - android:textSize="14sp" - style="@style/FolderTeaserMarginEndStyle" /> + <View style="@style/ConversationListDividerStyleIndented" /> </LinearLayout> diff --git a/res/layout/nested_folder_teaser_view.xml b/res/layout/nested_folder_teaser_view.xml index 9e71f61c0..0f0e74745 100644 --- a/res/layout/nested_folder_teaser_view.xml +++ b/res/layout/nested_folder_teaser_view.xml @@ -15,65 +15,56 @@ See the License for the specific language governing permissions and limitations under the License. --> -<com.android.mail.ui.NestedFolderTeaserView xmlns:android="http://schemas.android.com/apk/res/android" + +<com.android.mail.ui.NestedFolderTeaserView + xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="horizontal" > + android:background="@drawable/conversation_item_background_selector" + android:orientation="vertical"> + + <LinearLayout + android:id="@+id/nested_folder_container" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" /> <LinearLayout - android:layout_width="0dp" + android:id="@+id/show_more_folders_row" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_weight="1" - android:background="@drawable/conversation_item_background_selector" - android:orientation="vertical" > + android:layout_gravity="center_vertical" + android:background="@drawable/folder_teaser_item_background" + android:minHeight="@dimen/folder_teaser_item_height" + style="@style/FolderTeaserMarginEndStyle"> - <LinearLayout - android:id="@+id/nested_folder_container" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:divider="?android:dividerHorizontal" - android:showDividers="middle|end" > - </LinearLayout> + <ImageView + android:id="@+id/show_more_folders_icon" + android:layout_width="@dimen/folder_teaser_start_margin" + android:layout_height="match_parent" + android:paddingLeft="24dp" + android:paddingRight="24dp" + android:scaleType="center" /> - <LinearLayout - android:id="@+id/show_more_folders_row" - android:background="@drawable/folder_teaser_item_background" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:paddingBottom="12dp" - android:paddingTop="12dp" > + <TextView + android:id="@+id/show_more_folders_textView" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1" + android:ellipsize="end" + android:gravity="center_vertical" + android:singleLine="true" + android:textSize="16sp" + android:textColor="@color/folder_teaser_main_text" /> - <TextView - android:id="@+id/show_more_folders_textView" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_marginLeft="16dp" - android:layout_weight="1" - android:duplicateParentState="true" - android:ellipsize="end" - android:includeFontPadding="false" - android:singleLine="true" - android:textColor="@color/teaser_main_text" - android:textSize="16sp" - android:textStyle="bold" /> + <TextView + android:id="@+id/show_more_folders_count_textView" + android:layout_width="wrap_content" + android:layout_height="match_parent" + style="@style/FolderTeaserCountTextStyle" /> - <TextView - android:id="@+id/show_more_folders_count_textView" - android:layout_width="wrap_content" - android:layout_height="24sp" - android:layout_marginLeft="12dp" - android:layout_marginRight="16dp" - android:gravity="center" - android:minWidth="@dimen/folder_teaser_count_textview_minwidth" - android:paddingLeft="16dp" - android:paddingRight="16dp" - android:textColor="@color/folder_teaser_count_text" - android:textSize="16sp" /> - </LinearLayout> </LinearLayout> - <include layout="@layout/teaser_right_edge" /> + <View style="@style/ConversationListDividerStyle" /> </com.android.mail.ui.NestedFolderTeaserView>
\ No newline at end of file diff --git a/res/layout/teaser_right_edge.xml b/res/layout/teaser_right_edge.xml deleted file mode 100644 index c3c0270d3..000000000 --- a/res/layout/teaser_right_edge.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2013 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. ---> -<!-- This is used to show the line on the right edge of a list item in tablet ui --> -<ImageView - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/teaser_right_edge" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:src="@drawable/list_edge_tablet"/> diff --git a/res/values-ldrtl/styles-ldrtl.xml b/res/values-ldrtl/styles-ldrtl.xml index a6b45b1c9..675732987 100644 --- a/res/values-ldrtl/styles-ldrtl.xml +++ b/res/values-ldrtl/styles-ldrtl.xml @@ -370,19 +370,14 @@ <item name="android:layout_marginStart">@dimen/quoted_text_checkbox_margin_offset</item> </style> - <style name="FolderTeaserLabelMarginStyle"> - <item name="android:layout_marginStart">@dimen/folder_teaser_label_start_padding</item> - <item name="android:layout_marginEnd">@dimen/folder_teaser_label_end_padding</item> - </style> - - <style name="FolderTeaserMarginStartStyle"> - <item name="android:layout_marginStart">@dimen/folder_teaser_start_padding</item> - </style> - <style name="FolderTeaserMarginEndStyle"> <item name="android:layout_marginEnd">@dimen/folder_teaser_end_padding</item> </style> + <style name="ConversationListDividerStyleIndented" parent="ConversationListDividerStyle"> + <item name="android:layout_marginStart">@dimen/folder_teaser_start_margin</item> + </style> + <style name="ArrowStyle"> <item name="android:layout_marginStart">@dimen/teaser_arrow_margin_start</item> <item name="android:layout_marginEnd">@dimen/teaser_arrow_margin_end</item> diff --git a/res/values/colors.xml b/res/values/colors.xml index ffb2939c5..254392eaa 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -136,13 +136,10 @@ <color name="message_header_background_color">@android:color/white</color> <!-- The color of the section name text in the folder teaser --> - <color name="folder_teaser_main_text">#212121</color> + <color name="folder_teaser_main_text">@color/text_color_black</color> + <color name="folder_teaser_sub_text">@color/text_color_grey</color> <!-- The color of the icon background in the teaser --> <color name="folder_teaser_icon_background">#eeeeee</color> - <!-- The color of the senders text in the teaser --> - <color name="folder_teaser_senders_text">#757575</color> - <!-- The color of the count text in the teaser --> - <color name="folder_teaser_count_text">@android:color/black</color> <color name="vacation_responder_foreground">@android:color/white</color> <color name="vacation_responder_background">#ffe9e9e9</color> diff --git a/res/values/dimen.xml b/res/values/dimen.xml index e8496497d..55af92a01 100644 --- a/res/values/dimen.xml +++ b/res/values/dimen.xml @@ -128,7 +128,10 @@ <dimen name="recipient_summary_margin">16dip</dimen> <!-- Minimum width of the folder teaser count TextView --> - <dimen name="folder_teaser_count_textview_minwidth">68dp</dimen> + <dimen name="folder_teaser_item_height">56dp</dimen> + <dimen name="folder_teaser_count_textview_min_width">48dp</dimen> + <dimen name="folder_teaser_start_margin">72dp</dimen> + <dimen name="folder_teaser_end_padding">16dp</dimen> <dimen name="compose_attachment_text_padding">8dip</dimen> @@ -184,12 +187,6 @@ <dimen name="compose_attachment_tile_text_end_padding">4dip</dimen> - <dimen name="folder_teaser_start_padding">24dp</dimen> - <dimen name="folder_teaser_end_padding">16dp</dimen> - - <dimen name="folder_teaser_label_start_padding">24dp</dimen> - <dimen name="folder_teaser_label_end_padding">16dp</dimen> - <dimen name="teaser_arrow_margin_start">16dip</dimen> <dimen name="teaser_arrow_margin_end">12dip</dimen> diff --git a/res/values/strings.xml b/res/values/strings.xml index 67af422b0..de6ef0c17 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -921,7 +921,7 @@ <string name="turn_auto_sync_on_dialog_confirm_btn">Turn on</string> <!-- Button in conversation list to show more folders [CHAR LIMIT=50] --> - <string name="show_n_more_folders">Show <xliff:g id="number">%1$s</xliff:g> more folders</string> + <string name="show_n_more_folders">Show <xliff:g id="number">%1$s</xliff:g> folders</string> <!-- Button in conversation list to hide folders [CHAR LIMIT=50] --> <string name="hide_folders">Hide folders</string> diff --git a/res/values/styles.xml b/res/values/styles.xml index c195ddaae..61cda6838 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -915,6 +915,16 @@ <style name="ConversationListSpaciousStarStyle"> <item name="android:layout_marginRight">@dimen/conv_list_spacious_star_padding_end</item> </style> + + <style name="ConversationListDividerStyle"> + <item name="android:layout_width">match_parent</item> + <item name="android:layout_height">@dimen/divider_height</item> + <item name="android:background">@color/conversation_list_divider_color</item> + </style> + + <style name="ConversationListDividerStyleIndented" parent="ConversationListDividerStyle"> + <item name="android:layout_marginLeft">@dimen/folder_teaser_start_margin</item> + </style> <!-- END Conversation list styles --> <style name="BadgeTextStyle"> @@ -927,13 +937,11 @@ <item name="android:paddingLeft">@dimen/custom_from_inner_padding</item> </style> - <style name="FolderTeaserLabelMarginStyle"> - <item name="android:layout_marginLeft">@dimen/folder_teaser_label_start_padding</item> - <item name="android:layout_marginRight">@dimen/folder_teaser_label_end_padding</item> - </style> - - <style name="FolderTeaserMarginStartStyle"> - <item name="android:layout_marginLeft">@dimen/folder_teaser_start_padding</item> + <style name="FolderTeaserCountTextStyle"> + <item name="android:gravity">center_vertical|end</item> + <item name="android:minWidth">@dimen/folder_teaser_count_textview_min_width</item> + <item name="android:textColor">@color/folder_teaser_sub_text</item> + <item name="android:textSize">14sp</item> </style> <style name="FolderTeaserMarginEndStyle"> diff --git a/src/com/android/mail/browse/ConversationItemView.java b/src/com/android/mail/browse/ConversationItemView.java index b47a70444..342934c37 100644 --- a/src/com/android/mail/browse/ConversationItemView.java +++ b/src/com/android/mail/browse/ConversationItemView.java @@ -130,7 +130,6 @@ public class ConversationItemView extends View private static Bitmap STATE_REPLIED_AND_FORWARDED; private static Bitmap STATE_CALENDAR_INVITE; private static Drawable VISIBLE_CONVERSATION_HIGHLIGHT; - private static Drawable RIGHT_EDGE_TABLET; private static String sSendersSplitToken; private static String sElidedPaddingToken; @@ -508,7 +507,6 @@ public class ConversationItemView extends View BitmapFactory.decodeResource(res, R.drawable.ic_badge_invite_holo_light); VISIBLE_CONVERSATION_HIGHLIGHT = res.getDrawable( R.drawable.visible_conversation_highlight); - RIGHT_EDGE_TABLET = res.getDrawable(R.drawable.list_edge_tablet); // Initialize colors. sActivatedTextSpan = CharacterStyle.wrap(new ForegroundColorSpan( @@ -1348,24 +1346,6 @@ public class ConversationItemView extends View canvas.drawBitmap(getStarBitmap(), mCoordinates.starX, mCoordinates.starY, sPaint); } - // right-side edge effect when in tablet conversation mode and the list is not collapsed - final boolean isRtl = ViewUtils.isViewRtl(this); - if (Utils.getDisplayListRightEdgeEffect(mTabletDevice, mListCollapsible, - mConfig.getViewMode())) { - RIGHT_EDGE_TABLET.setBounds( - (isRtl) ? 0 : getWidth() - RIGHT_EDGE_TABLET.getIntrinsicWidth(), 0, - (isRtl) ? RIGHT_EDGE_TABLET.getIntrinsicWidth() : getWidth(), getHeight()); - RIGHT_EDGE_TABLET.draw(canvas); - - if (isActivated()) { - final int w = VISIBLE_CONVERSATION_HIGHLIGHT.getIntrinsicWidth(); - VISIBLE_CONVERSATION_HIGHLIGHT.setBounds( - (isRtl) ? getWidth() - w : 0, 0, - (isRtl) ? getWidth() : w, getHeight()); - VISIBLE_CONVERSATION_HIGHLIGHT.draw(canvas); - } - } - // the divider is not drawn below advertisements (only messages) final boolean drawDivider = mHeader.conversation.conversationBaseUri != null; if (drawDivider) { @@ -1374,6 +1354,7 @@ public class ConversationItemView extends View 0 : sDividerInset; // respect RTL and LTR when placing the inset (if one exists) + final boolean isRtl = ViewUtils.isViewRtl(this); final int dividerStartX = isRtl ? 0 : dividerInset; final int dividerEndX = isRtl ? (getWidth() - dividerInset) : getWidth(); final int dividerBottomY = getHeight(); diff --git a/src/com/android/mail/ui/ConversationLongPressTipView.java b/src/com/android/mail/ui/ConversationLongPressTipView.java index 163bdc27e..bc7a84dbc 100644 --- a/src/com/android/mail/ui/ConversationLongPressTipView.java +++ b/src/com/android/mail/ui/ConversationLongPressTipView.java @@ -21,7 +21,6 @@ import com.android.mail.analytics.Analytics; import com.android.mail.browse.ConversationCursor; import com.android.mail.preferences.MailPrefs; import com.android.mail.providers.Folder; -import com.android.mail.utils.Utils; import android.animation.ObjectAnimator; import android.app.LoaderManager; @@ -52,12 +51,6 @@ public class ConversationLongPressTipView extends FrameLayout private boolean mShow; private int mAnimatedHeight = -1; - private View mTeaserRightEdge; - /** Whether we are on a tablet device or not */ - private final boolean mTabletDevice; - /** When in conversation mode, true if the list is hidden */ - private final boolean mListCollapsible; - public ConversationLongPressTipView(final Context context) { this(context, null); } @@ -79,9 +72,6 @@ public class ConversationLongPressTipView extends FrameLayout } mMailPrefs = MailPrefs.get(context); - - mTabletDevice = Utils.useTabletUI(resources); - mListCollapsible = resources.getBoolean(R.bool.list_collapsible); } @Override @@ -94,8 +84,6 @@ public class ConversationLongPressTipView extends FrameLayout dismiss(); } }); - - mTeaserRightEdge = findViewById(R.id.teaser_right_edge); } @Override @@ -240,13 +228,6 @@ public class ConversationLongPressTipView extends FrameLayout @Override protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) { - if (Utils.getDisplayListRightEdgeEffect(mTabletDevice, mListCollapsible, - mAdapter.getViewMode())) { - mTeaserRightEdge.setVisibility(VISIBLE); - } else { - mTeaserRightEdge.setVisibility(GONE); - } - if (mAnimatedHeight == -1) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } else { diff --git a/src/com/android/mail/ui/ConversationPhotoTeaserView.java b/src/com/android/mail/ui/ConversationPhotoTeaserView.java index d12d815f7..dedc1f7b7 100644 --- a/src/com/android/mail/ui/ConversationPhotoTeaserView.java +++ b/src/com/android/mail/ui/ConversationPhotoTeaserView.java @@ -18,7 +18,6 @@ import com.android.mail.analytics.Analytics; import com.android.mail.browse.ConversationCursor; import com.android.mail.preferences.MailPrefs; import com.android.mail.providers.Folder; -import com.android.mail.utils.Utils; /** * A teaser to introduce people to the contact photo check boxes @@ -38,12 +37,6 @@ public class ConversationPhotoTeaserView extends FrameLayout private boolean mNeedLayout; private int mTextTop; - private View mTeaserRightEdge; - /** Whether we are on a tablet device or not */ - private final boolean mTabletDevice; - /** When in conversation mode, true if the list is hidden */ - private final boolean mListCollapsible; - public ConversationPhotoTeaserView(final Context context) { this(context, null); } @@ -69,9 +62,6 @@ public class ConversationPhotoTeaserView extends FrameLayout mMailPrefs = MailPrefs.get(context); mNeedLayout = true; - - mTabletDevice = Utils.useTabletUI(resources); - mListCollapsible = resources.getBoolean(R.bool.list_collapsible); } @Override @@ -84,8 +74,6 @@ public class ConversationPhotoTeaserView extends FrameLayout dismiss(); } }); - - mTeaserRightEdge = findViewById(R.id.teaser_right_edge); } @Override @@ -253,13 +241,6 @@ public class ConversationPhotoTeaserView extends FrameLayout @Override protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) { - if (Utils.getDisplayListRightEdgeEffect(mTabletDevice, mListCollapsible, - mAdapter.getViewMode())) { - mTeaserRightEdge.setVisibility(VISIBLE); - } else { - mTeaserRightEdge.setVisibility(GONE); - } - if (mAnimatedHeight == -1) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } else { diff --git a/src/com/android/mail/ui/ConversationSyncDisabledTipView.java b/src/com/android/mail/ui/ConversationSyncDisabledTipView.java index f9271a33c..30a80be01 100644 --- a/src/com/android/mail/ui/ConversationSyncDisabledTipView.java +++ b/src/com/android/mail/ui/ConversationSyncDisabledTipView.java @@ -76,12 +76,6 @@ public class ConversationSyncDisabledTipView extends FrameLayout private int mReasonSyncOff = ReasonSyncOff.NONE; - private View mTeaserRightEdge; - /** Whether we are on a tablet device or not */ - private final boolean mTabletDevice; - /** When in conversation mode, true if the list is hidden */ - private final boolean mListCollapsible; - public interface ReasonSyncOff { // Background sync is enabled for current account, do not display this tip public static final int NONE = 0; @@ -141,9 +135,6 @@ public class ConversationSyncDisabledTipView extends FrameLayout index, index + subString.length(), 0); - - mTabletDevice = Utils.useTabletUI(resources); - mListCollapsible = resources.getBoolean(R.bool.list_collapsible); } public void bindAccount(Account account, ControllableActivity activity) { @@ -171,8 +162,6 @@ public class ConversationSyncDisabledTipView extends FrameLayout dismiss(); } }); - - mTeaserRightEdge = findViewById(R.id.teaser_right_edge); } @Override @@ -388,13 +377,6 @@ public class ConversationSyncDisabledTipView extends FrameLayout @Override protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) { - if (Utils.getDisplayListRightEdgeEffect(mTabletDevice, mListCollapsible, - mAdapter.getViewMode())) { - mTeaserRightEdge.setVisibility(VISIBLE); - } else { - mTeaserRightEdge.setVisibility(GONE); - } - if (mAnimatedHeight == -1) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } else { diff --git a/src/com/android/mail/ui/ConversationsInOutboxTipView.java b/src/com/android/mail/ui/ConversationsInOutboxTipView.java index 2dc1064db..c0713c210 100644 --- a/src/com/android/mail/ui/ConversationsInOutboxTipView.java +++ b/src/com/android/mail/ui/ConversationsInOutboxTipView.java @@ -41,7 +41,6 @@ import com.android.mail.preferences.AccountPreferences; import com.android.mail.providers.Account; import com.android.mail.providers.Folder; import com.android.mail.providers.UIProvider; -import com.android.mail.utils.Utils; /** * Tip that is displayed in conversation list of 'Sent' folder whenever there are @@ -66,12 +65,6 @@ public class ConversationsInOutboxTipView extends FrameLayout private int mAnimatedHeight = -1; - private View mTeaserRightEdge; - /** Whether we are on a tablet device or not */ - private final boolean mTabletDevice; - /** When in conversation mode, true if the list is hidden */ - private final boolean mListCollapsible; - private static final int LOADER_FOLDER_LIST = AbstractActivityController.LAST_FRAGMENT_LOADER_ID + 100; @@ -94,9 +87,6 @@ public class ConversationsInOutboxTipView extends FrameLayout sShrinkAnimationDuration = resources.getInteger( R.integer.shrink_animation_duration); } - - mTabletDevice = Utils.useTabletUI(resources); - mListCollapsible = resources.getBoolean(R.bool.list_collapsible); } public void bind(final Account account, final FolderSelector folderSelector) { @@ -129,8 +119,6 @@ public class ConversationsInOutboxTipView extends FrameLayout dismiss(); } }); - - mTeaserRightEdge = findViewById(R.id.teaser_right_edge); } private void goToOutbox() { @@ -343,13 +331,6 @@ public class ConversationsInOutboxTipView extends FrameLayout @Override protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) { - if (Utils.getDisplayListRightEdgeEffect(mTabletDevice, mListCollapsible, - mAdapter.getViewMode())) { - mTeaserRightEdge.setVisibility(VISIBLE); - } else { - mTeaserRightEdge.setVisibility(GONE); - } - if (mAnimatedHeight == -1) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } else { diff --git a/src/com/android/mail/ui/NestedFolderTeaserView.java b/src/com/android/mail/ui/NestedFolderTeaserView.java index e221f174a..c63296ab7 100644 --- a/src/com/android/mail/ui/NestedFolderTeaserView.java +++ b/src/com/android/mail/ui/NestedFolderTeaserView.java @@ -21,7 +21,6 @@ import android.app.LoaderManager.LoaderCallbacks; import android.content.Context; import android.content.Loader; import android.content.res.Resources; -import android.graphics.Color; import android.net.Uri; import android.os.Bundle; import android.support.v4.text.BidiFormatter; @@ -77,14 +76,15 @@ public class NestedFolderTeaserView extends LinearLayout implements Conversation private final SparseArrayCompat<FolderHolder> mFolderHolders = new SparseArrayCompat<FolderHolder>(); + private ImmutableSortedSet<FolderHolder> mSortedFolderHolders; private final int mFolderItemUpdateDelayMs; - private int mAnimatedHeight = -1; - + private final LayoutInflater mInflater; private ViewGroup mNestedFolderContainer; private View mShowMoreFoldersRow; + private ImageView mShowMoreFoldersIcon; private TextView mShowMoreFoldersTextView; private TextView mShowMoreFoldersCountTextView; @@ -94,12 +94,6 @@ public class NestedFolderTeaserView extends LinearLayout implements Conversation */ private boolean mCollapsed = true; - private View mTeaserRightEdge; - /** Whether we are on a tablet device or not */ - private final boolean mTabletDevice; - /** When in conversation mode, true if the list is hidden */ - private final boolean mListCollapsible; - /** If <code>true</code>, the list of folders has updated since the view was last shown. */ private boolean mListUpdated; @@ -190,24 +184,23 @@ public class NestedFolderTeaserView extends LinearLayout implements Conversation resources.getInteger(R.integer.nested_folders_collapse_threshold); } - mFolderItemUpdateDelayMs = - resources.getInteger(R.integer.folder_item_refresh_delay_ms); - - mTabletDevice = com.android.mail.utils.Utils.useTabletUI(resources); - mListCollapsible = resources.getBoolean(R.bool.list_collapsible); + mFolderItemUpdateDelayMs = resources.getInteger(R.integer.folder_item_refresh_delay_ms); + mInflater = LayoutInflater.from(context); } @Override protected void onFinishInflate() { mNestedFolderContainer = (ViewGroup) findViewById(R.id.nested_folder_container); - mTeaserRightEdge = findViewById(R.id.teaser_right_edge); mShowMoreFoldersRow = findViewById(R.id.show_more_folders_row); mShowMoreFoldersRow.setOnClickListener(mShowMoreOnClickListener); - mShowMoreFoldersTextView = (TextView) findViewById(R.id.show_more_folders_textView); + mShowMoreFoldersIcon = + (ImageView) mShowMoreFoldersRow.findViewById(R.id.show_more_folders_icon); + mShowMoreFoldersTextView = + (TextView) mShowMoreFoldersRow.findViewById(R.id.show_more_folders_textView); mShowMoreFoldersCountTextView = - (TextView) findViewById(R.id.show_more_folders_count_textView); + (TextView) mShowMoreFoldersRow.findViewById(R.id.show_more_folders_count_textView); } public void bind(final Account account, final FolderSelector listener) { @@ -219,13 +212,8 @@ public class NestedFolderTeaserView extends LinearLayout implements Conversation * Creates a {@link FolderHolder}. */ private FolderHolder createFolderHolder(final CharSequence folderName) { - final View itemView = - LayoutInflater.from(getContext()).inflate(R.layout.folder_teaser_item, null); - - final ImageView imageView = (ImageView) itemView.findViewById(R.id.folder_imageView); - imageView.setImageResource(R.drawable.ic_menu_move_to_holo_light); - // Remove background - imageView.setBackgroundColor(Color.TRANSPARENT); + final View itemView = mInflater.inflate(R.layout.folder_teaser_item, mNestedFolderContainer, + false /* attachToRoot */); ((TextView) itemView.findViewById(R.id.folder_textView)).setText(folderName); final TextView sendersTextView = (TextView) itemView.findViewById(R.id.senders_textView); @@ -282,33 +270,14 @@ public class NestedFolderTeaserView extends LinearLayout implements Conversation // Clear out the folder views mNestedFolderContainer.removeAllViews(); - // Sort the folders by name - // TODO(skennedy) recents? starred? - final ImmutableSortedSet.Builder<FolderHolder> folderHoldersBuilder = - new ImmutableSortedSet.Builder<FolderHolder>(FolderHolder.NAME_COMPARATOR); - - for (int i = 0; i < mFolderHolders.size(); i++) { - folderHoldersBuilder.add(mFolderHolders.valueAt(i)); - } - - final ImmutableSortedSet<FolderHolder> folderHolders = folderHoldersBuilder.build(); - - // Add all folder views to the teaser - int added = 0; - // If we're only over the limit by one, don't truncate the list. - boolean truncate = folderHolders.size() > sCollapsedFolderThreshold + 1; - for (final FolderHolder folderHolder : folderHolders) { - mNestedFolderContainer.addView(folderHolder.getItemView()); - added++; - - if (truncate && added >= sCollapsedFolderThreshold && mCollapsed) { - // We will display the rest when "Show more" is clicked - break; + // We either show all folders if it's not over the threshold, or we show none. + if (mSortedFolderHolders.size() <= sCollapsedFolderThreshold || !mCollapsed) { + for (final FolderHolder folderHolder : mSortedFolderHolders) { + mNestedFolderContainer.addView(folderHolder.getItemView()); } } updateShowMoreView(); - mListUpdated = false; } } @@ -325,32 +294,28 @@ public class NestedFolderTeaserView extends LinearLayout implements Conversation private void updateShowMoreView() { final int total = mFolderHolders.size(); final int displayed = mNestedFolderContainer.getChildCount(); - final int notShown = total - displayed; - if (notShown > 0) { + if (displayed == 0) { // We are not displaying all the folders mShowMoreFoldersRow.setVisibility(VISIBLE); + mShowMoreFoldersIcon.setImageResource(R.drawable.ic_drawer_folder_24dp); mShowMoreFoldersTextView.setText(String.format( - getContext().getString(R.string.show_n_more_folders), notShown)); + getContext().getString(R.string.show_n_more_folders), total)); mShowMoreFoldersCountTextView.setVisibility(VISIBLE); // Get a count of unread messages in other folders int unreadCount = 0; for (int i = 0; i < mFolderHolders.size(); i++) { final FolderHolder holder = mFolderHolders.valueAt(i); - - if (holder.getItemView().getParent() == null) { - // This view is not shown, so we want to use its unread count - // TODO(skennedy) We want a "nested" unread count, that includes the unread - // count of nested folders - unreadCount += holder.getFolder().unreadCount; - } + // TODO(skennedy) We want a "nested" unread count, that includes the unread + // count of nested folders + unreadCount += holder.getFolder().unreadCount; } - mShowMoreFoldersCountTextView.setText(Integer.toString(unreadCount)); - } else if (displayed > sCollapsedFolderThreshold + 1) { + } else if (displayed > sCollapsedFolderThreshold) { // We are expanded mShowMoreFoldersRow.setVisibility(VISIBLE); + mShowMoreFoldersIcon.setImageResource(R.drawable.ic_collapse_24dp); mShowMoreFoldersTextView.setText(R.string.hide_folders); mShowMoreFoldersCountTextView.setVisibility(GONE); } else { @@ -362,13 +327,21 @@ public class NestedFolderTeaserView extends LinearLayout implements Conversation private void updateViews(final FolderHolder folderHolder) { final Folder folder = folderHolder.getFolder(); + // Update unread count final String unreadText = Utils.getUnreadCountString(getContext(), folder.unreadCount); folderHolder.getCountTextView().setText(unreadText.isEmpty() ? "0" : unreadText); + // Update unread senders final String sendersText = TextUtils.join( getResources().getString(R.string.enumeration_comma), folderHolder.getUnreadSenders()); - folderHolder.getSendersTextView().setText(sendersText); + final TextView sendersTextView = folderHolder.getSendersTextView(); + if (!TextUtils.isEmpty(sendersText)) { + sendersTextView.setVisibility(VISIBLE); + sendersTextView.setText(sendersText); + } else { + sendersTextView.setVisibility(GONE); + } } @Override @@ -431,22 +404,6 @@ public class NestedFolderTeaserView extends LinearLayout implements Conversation return false; } - @Override - protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) { - if (com.android.mail.utils.Utils.getDisplayListRightEdgeEffect(mTabletDevice, - mListCollapsible, mAdapter.getViewMode())) { - mTeaserRightEdge.setVisibility(VISIBLE); - } else { - mTeaserRightEdge.setVisibility(GONE); - } - - if (mAnimatedHeight == -1) { - super.onMeasure(widthMeasureSpec, heightMeasureSpec); - } else { - setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), mAnimatedHeight); - } - } - private static int getLoaderId(final int folderId) { return folderId + LOADER_FOLDER_LIST; } @@ -512,6 +469,15 @@ public class NestedFolderTeaserView extends LinearLayout implements Conversation } while (data.moveToNext()); } + // Sort the folders by name + // TODO(skennedy) recents? starred? + final ImmutableSortedSet.Builder<FolderHolder> folderHoldersBuilder = + new ImmutableSortedSet.Builder<FolderHolder>(FolderHolder.NAME_COMPARATOR); + for (int i = 0; i < mFolderHolders.size(); i++) { + folderHoldersBuilder.add(mFolderHolders.valueAt(i)); + } + mSortedFolderHolders = folderHoldersBuilder.build(); + for (final int folderId : oldFolderIds) { // We have a folder that no longer exists mFolderHolders.remove(folderId); diff --git a/src/com/android/mail/utils/Utils.java b/src/com/android/mail/utils/Utils.java index 97b0c938d..662a2706c 100644 --- a/src/com/android/mail/utils/Utils.java +++ b/src/com/android/mail/utils/Utils.java @@ -265,18 +265,6 @@ public class Utils { } /** - * @return <code>true</code> if the right edge effect should be displayed on list items - */ - @Deprecated - // TODO: remove this now that visual design no longer has right-edge caret (which made it so - // the hard right edge was drawn IN list items to ensure the caret didn't get an edge) - public static boolean getDisplayListRightEdgeEffect(final boolean tabletDevice, - final boolean listCollapsible, final int viewMode) { - return tabletDevice && !listCollapsible - && (ViewMode.isConversationMode(viewMode) || ViewMode.isAdMode(viewMode)); - } - - /** * Returns a boolean indicating whether or not we should animate in the * folder list fragment. */ |