Fix Widget Header w/ RTL Text
Also modified icon to take up all the header space
so that dragging on it causes the background to highlight
a 56 x 56 square space instead of looking really awkward.
Bug: 17206631
Change-Id: I68e5d746935cf411aa9f06ba99057cc21886ac04
diff --git a/res/layout/widget.xml b/res/layout/widget.xml
index cd6897d..357050e 100644
--- a/res/layout/widget.xml
+++ b/res/layout/widget.xml
@@ -26,34 +26,31 @@
android:layout_marginBottom="@dimen/widget_margin_bottom"
android:orientation="vertical">
- <RelativeLayout
+ <LinearLayout
android:id="@+id/widget_header"
android:layout_width="match_parent"
android:layout_height="48dp"
- android:paddingLeft="16dp"
- android:paddingRight="16dp"
- android:background="@color/widget_header_bg_color">
- <ImageButton
- android:id="@+id/widget_compose"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@drawable/ic_widget_compose_wht_24dp"
- android:background="?android:attr/selectableItemBackground"
- android:paddingLeft="16dp"
- android:layout_alignParentRight="true"
- android:layout_centerVertical="true"
- android:contentDescription="@string/compose" />
+ android:background="@color/widget_header_bg_color"
+ style="@style/WidgetHeaderStartMargin">
<TextView
android:id="@+id/widget_folder"
- style="@style/WidgetTitle"
- android:layout_width="wrap_content"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:layout_gravity="center_vertical"
android:freezesText="true"
- android:layout_toLeftOf="@id/widget_compose"
- android:layout_alignParentLeft="true"
- android:layout_centerVertical="true"
- android:includeFontPadding="false" />
- </RelativeLayout>
+ android:textAlignment="viewStart"
+ android:includeFontPadding="false"
+ style="@style/WidgetTitle"/>
+ <ImageButton
+ android:id="@+id/widget_compose"
+ android:layout_width="56dp"
+ android:layout_height="match_parent"
+ android:scaleType="center"
+ android:src="@drawable/ic_widget_compose_wht_24dp"
+ android:background="?android:attr/selectableItemBackground"
+ android:contentDescription="@string/compose" />
+ </LinearLayout>
<LinearLayout
android:id="@+id/widget_configuration"
diff --git a/res/values-ldrtl/styles-ldrtl.xml b/res/values-ldrtl/styles-ldrtl.xml
index 20b69bf..8ad25ce 100644
--- a/res/values-ldrtl/styles-ldrtl.xml
+++ b/res/values-ldrtl/styles-ldrtl.xml
@@ -235,6 +235,10 @@
<item name="android:paddingEnd">@dimen/widget_attachment_padding_end</item>
</style>
+ <style name="WidgetHeaderStartMargin">
+ <item name="android:paddingStart">16dp</item>
+ </style>
+
<!-- START Conversation list styles -->
<style name="ConversationListContactImageStyle">
<item name="android:layout_marginEnd">@dimen/conv_list_contact_image_padding_end</item>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 7af293b..dc4aef7 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -821,6 +821,10 @@
<item name="android:paddingRight">@dimen/widget_attachment_padding_end</item>
</style>
+ <style name="WidgetHeaderStartMargin">
+ <item name="android:paddingLeft">16dp</item>
+ </style>
+
<style name="SearchTextStyle">
<item name="android:textColor">@color/search_banner_text</item>
<item name="android:textSize">@dimen/search_banner_text_size</item>