Imporve UI of system langauge list

Bug: b/274721595
Test: Manual test
Change-Id: I951de80de4ac40df48829d3f23c0f1c8d98e0137
This commit is contained in:
tom hsu
2023-03-23 00:23:10 +08:00
parent fced4027ab
commit 99037a8bf8
3 changed files with 46 additions and 43 deletions

View File

@@ -16,12 +16,13 @@
<com.android.settings.localepicker.LocaleDragCell <com.android.settings.localepicker.LocaleDragCell
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="?android:listPreferredItemHeight" android:minHeight="?android:listPreferredItemHeight"
android:background="?android:colorBackground" android:background="?android:colorBackground"
android:layout_marginTop="4dp" android:layout_marginTop="12dp"
android:layout_marginBottom="4dp" android:layout_marginBottom="12dp"
android:layoutDirection="locale" android:layoutDirection="locale"
android:textDirection="locale"> android:textDirection="locale">
@@ -29,7 +30,9 @@
android:id="@+id/checkbox" android:id="@+id/checkbox"
style="@style/LanguageCheckboxAndLabel" style="@style/LanguageCheckboxAndLabel"
android:paddingStart="24dp" android:paddingStart="24dp"
android:layout_toStartOf="@+id/dragHandle"/> android:layout_toStartOf="@+id/dragHandle"
android:layout_alignTop="@+id/miniLabel"
android:layout_alignBottom="@+id/miniLabel" />
<TextView <TextView
android:id="@+id/miniLabel" android:id="@+id/miniLabel"
@@ -38,16 +41,22 @@
android:textColor="?android:attr/colorAccent" android:textColor="?android:attr/colorAccent"
android:minWidth="24sp" android:minWidth="24sp"
android:gravity="center_vertical|center_horizontal" android:gravity="center_vertical|center_horizontal"
android:layout_alignTop="@id/checkbox" android:layout_centerVertical="true"/>
android:layout_alignBottom="@id/checkbox"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:listPreferredItemHeight"
android:paddingStart="56dp"
android:layout_toStartOf="@+id/dragHandle">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:minHeight="?android:listPreferredItemHeight" app:layout_constraintStart_toStartOf="parent"
android:paddingStart="56dp" app:layout_constraintTop_toTopOf="parent"
android:layout_toStartOf="@+id/dragHandle"> app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent">
<TextView <TextView
android:id="@+id/label" android:id="@+id/label"
style="@style/LanguageCheckboxAndLabel" /> style="@style/LanguageCheckboxAndLabel" />
@@ -57,7 +66,7 @@
style="@style/LanguageCheckboxAndLabel" style="@style/LanguageCheckboxAndLabel"
android:textAppearance="?android:attr/textAppearanceListItemSecondary" android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textColor="?android:textColorSecondary" android:textColor="?android:textColorSecondary"
android:layout_marginBottom="4dp" android:layout_marginTop="4dp"
android:text="@string/locale_not_translated"/> android:text="@string/locale_not_translated"/>
<TextView <TextView
@@ -65,10 +74,11 @@
style="@style/LanguageCheckboxAndLabel" style="@style/LanguageCheckboxAndLabel"
android:textAppearance="?android:attr/textAppearanceListItemSecondary" android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textColor="?android:textColorSecondary" android:textColor="?android:textColorSecondary"
android:layout_marginBottom="4dp" android:layout_marginTop="4dp"
android:text="@string/desc_current_default_language"/> android:text="@string/desc_current_default_language"/>
</LinearLayout> </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView <ImageView
android:id="@+id/dragHandle" android:id="@+id/dragHandle"
@@ -80,13 +90,6 @@
android:src="@drawable/drag_handle" android:src="@drawable/drag_handle"
android:importantForAccessibility="no" android:importantForAccessibility="no"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignTop="@id/checkbox" android:layout_centerVertical="true"/>
android:layout_alignBottom="@id/checkbox"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"
android:layout_alignParentBottom="true"/>
</com.android.settings.localepicker.LocaleDragCell> </com.android.settings.localepicker.LocaleDragCell>

View File

@@ -368,7 +368,7 @@
<string name="desc_notice_of_language_picker">To select a language for each app, go to app language settings.</string> <string name="desc_notice_of_language_picker">To select a language for each app, go to app language settings.</string>
<!-- Title for locale helper page [CHAR LIMIT=NONE] --> <!-- Title for locale helper page [CHAR LIMIT=NONE] -->
<string name="desc_locale_helper_footer_general">Learn more about languages</string> <string name="desc_locale_helper_footer_general">Learn more about app languages</string>
<!-- Link for Locale helper page. [CHAR LIMIT=NONE]--> <!-- Link for Locale helper page. [CHAR LIMIT=NONE]-->
<string name="link_locale_picker_footer_learn_more" translatable="false">https://support.google.com/android?p=per_language_app_settings</string> <string name="link_locale_picker_footer_learn_more" translatable="false">https://support.google.com/android?p=per_language_app_settings</string>

View File

@@ -165,7 +165,7 @@ class LocaleDragAndDropAdapter
dragCell.setLabelAndDescription(label, description); dragCell.setLabelAndDescription(label, description);
dragCell.setLocalized(feedItem.isTranslated()); dragCell.setLocalized(feedItem.isTranslated());
dragCell.setCurrentDefault(feedItem.getLocale().equals(Locale.getDefault())); dragCell.setCurrentDefault(feedItem.getLocale().equals(LocalePicker.getLocales().get(0)));
dragCell.setMiniLabel(mNumberFormatter.format(i + 1)); dragCell.setMiniLabel(mNumberFormatter.format(i + 1));
dragCell.setShowCheckbox(mRemoveMode); dragCell.setShowCheckbox(mRemoveMode);
dragCell.setShowMiniLabel(!mRemoveMode); dragCell.setShowMiniLabel(!mRemoveMode);