Files
app_Settings/res/layout/locale_drag_cell.xml
Zoey Chen e9f6efa2b6 [Settings] Fix the layout index
The index of language label's layout is 0 and index of num layout is 1, so the select tp speak will read the language label first.
The root cause of the incorrect index is, the language label's layout starts with the parent layout instead of the num layout in the hierarchy view. Adjust the language label's layout and add these views one by one in the parent view.

Also fix the layout's jumping when user switches the page to "Remove language"

Bug: 277173513
Test: local test
Change-Id: I0d5879a07183713fa50b38f6321a15dd32582518
2023-04-18 08:46:23 +00:00

100 lines
4.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 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.
-->
<com.android.settings.localepicker.LocaleDragCell
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_height="wrap_content"
android:minHeight="?android:listPreferredItemHeight"
android:background="?android:colorBackground"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:layoutDirection="locale"
android:textDirection="locale">
<LinearLayout
android:id="@+id/numberLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:gravity="center_vertical|center_horizontal"
android:paddingStart="?android:attr/listPreferredItemPaddingStart">
<CheckBox
android:id="@+id/checkbox"
style="@style/LanguageCheckboxAndLabel"
android:layout_marginRight="0dp"
android:minWidth="24dp"
android:paddingEnd="-8dp"/>
<TextView
android:id="@+id/miniLabel"
style="@style/LanguageCheckboxAndLabel"
android:textColor="?android:attr/colorAccent"
android:minWidth="24dp"
android:gravity="center_vertical|center_horizontal"/>
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="?android:listPreferredItemHeight"
android:layout_toStartOf="@+id/dragHandle"
android:layout_toEndOf="@+id/numberLayout"
android:paddingStart="32dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent">
<TextView
android:id="@+id/label"
style="@style/LanguageCheckboxAndLabel"/>
<TextView
android:id="@+id/l10nWarn"
style="@style/LanguageCheckboxAndLabel"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textColor="?android:textColorSecondary"
android:layout_marginTop="4dp"
android:text="@string/locale_not_translated"/>
<TextView
android:id="@+id/default_locale"
style="@style/LanguageCheckboxAndLabel"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textColor="?android:textColorSecondary"
android:layout_marginTop="4dp"
android:text="@string/desc_current_default_language"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/dragHandle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:src="@drawable/drag_handle"
android:importantForAccessibility="no"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"/>
</com.android.settings.localepicker.LocaleDragCell>