OSDN Git Service

Fix text alignment with rtl languages in entity header.
authorFan Zhang <zhfan@google.com>
Tue, 17 Apr 2018 21:30:08 +0000 (14:30 -0700)
committerFan Zhang <zhfan@google.com>
Tue, 17 Apr 2018 21:30:08 +0000 (14:30 -0700)
TextViews should align at viewStart to make numerics like version
number display in RTL format.

Also cleaned up style so we can share the same style on all entity
header textviews.

Change-Id: I25a93d33e9fb95a9eba7b368438cb33bb67a434a
Fixes: 78173905
Test: visual

res/layout-sw320dp/settings_entity_header.xml
res/layout/settings_entity_header.xml
res/values/styles.xml

index 79e12a9..9a46adf 100644 (file)
 
             <TextView
                 android:id="@+id/install_type"
+                style="@style/TextAppearance.EntityHeaderSummary"
                 android:visibility="gone"
                 android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:gravity="start"
-                android:singleLine="true"
-                android:ellipsize="marquee"
-                android:textAppearance="@android:style/TextAppearance.Material.Body1"
-                android:textColor="?android:attr/textColorSecondary" />
+                android:layout_height="wrap_content"/>
 
             <TextView
                 android:id="@+id/entity_header_summary"
+                style="@style/TextAppearance.EntityHeaderSummary"
                 android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:gravity="start"
-                android:singleLine="true"
-                android:ellipsize="marquee"
-                android:textAppearance="@android:style/TextAppearance.Material.Body1"
-                android:textColor="?android:attr/textColorSecondary" />
+                android:layout_height="wrap_content" />
 
             <TextView
                 android:id="@+id/entity_header_second_summary"
+                style="@style/TextAppearance.EntityHeaderSummary"
                 android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:gravity="start"
-                android:singleLine="true"
-                android:ellipsize="marquee"
-                android:textAlignment="viewStart"
-                android:textAppearance="@android:style/TextAppearance.Material.Body1"
-                android:textColor="?android:attr/textColorSecondary" />
+                android:layout_height="wrap_content" />
 
         </LinearLayout>
     </LinearLayout>
index b534c5e..6698f3f 100644 (file)
 
         <TextView
             android:id="@+id/install_type"
+            style="@style/TextAppearance.EntityHeaderSummary"
             android:visibility="gone"
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:gravity="start"
-            android:singleLine="true"
-            android:ellipsize="marquee"
-            android:textAppearance="@android:style/TextAppearance.Material.Body1"
-            android:textColor="?android:attr/textColorSecondary" />
+            android:layout_height="wrap_content" />
 
         <TextView
             android:id="@+id/entity_header_summary"
+            style="@style/TextAppearance.EntityHeaderSummary"
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:gravity="start"
-            android:singleLine="true"
-            android:ellipsize="marquee"
-            android:textAlignment="viewStart"
-            android:textAppearance="@android:style/TextAppearance.Material.Body1"
-            android:textColor="?android:attr/textColorSecondary" />
+            android:layout_height="wrap_content" />
 
         <TextView
             android:id="@+id/entity_header_second_summary"
+            style="@style/TextAppearance.EntityHeaderSummary"
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:gravity="start"
-            android:singleLine="true"
-            android:ellipsize="marquee"
-            android:textAlignment="viewStart"
-            android:textAppearance="@android:style/TextAppearance.Material.Body1"
-            android:textColor="?android:attr/textColorSecondary" />
+            android:layout_height="wrap_content" />
 
     </LinearLayout>
 
index 23ec207..6ca4715 100644 (file)
         <item name="android:textSize">16sp</item>
     </style>
 
+    <style name="TextAppearance.EntityHeaderSummary"
+           parent="@android:style/TextAppearance.Material.Body1">
+        <item name="android:textAlignment">viewStart</item>
+        <item name="android:textColor">?android:attr/textColorSecondary</item>
+        <item name="android:gravity">start</item>
+        <item name="android:singleLine">true</item>
+        <item name="android:ellipsize">marquee</item>
+    </style>
+
     <style name="ActionPrimaryButton" parent="android:Widget.DeviceDefault.Button.Colored"/>
 
     <style name="ActionSecondaryButton" parent="android:Widget.DeviceDefault.Button"/>