Loading core/java/com/android/internal/app/SuggestedLocaleAdapter.java +47 −22 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.widget.BaseAdapter; import android.widget.Filter; import android.widget.Filterable; import android.widget.LinearLayout; import android.widget.RadioButton; import android.widget.TextView; import com.android.internal.R; Loading Loading @@ -242,11 +243,7 @@ public class SuggestedLocaleAdapter extends BaseAdapter implements Filterable { break; case TYPE_SYSTEM_LANGUAGE_FOR_APP_LANGUAGE_PICKER: TextView title; LocaleStore.LocaleInfo info = (LocaleStore.LocaleInfo) getItem(position); if (info == null) { throw new NullPointerException("Non header locale cannot be null."); } if (info.isAppCurrentLocale()) { if (mHasSpecificAppPackageName) { title = itemView.findViewById(R.id.language_picker_item); } else { title = itemView.findViewById(R.id.locale); Loading @@ -254,11 +251,22 @@ public class SuggestedLocaleAdapter extends BaseAdapter implements Filterable { title.setText(R.string.system_locale_title); break; case TYPE_CURRENT_LOCALE: updateTextView(itemView, itemView.findViewById(R.id.language_picker_item), position); updateTextView( itemView, itemView.findViewById(R.id.language_picker_item), position); break; default: LocaleStore.LocaleInfo localeInfo = (LocaleStore.LocaleInfo) getItem(position); if (localeInfo == null) { throw new NullPointerException("Non header locale cannot be null."); } if (mHasSpecificAppPackageName && localeInfo.isSuggested() && !mCountryMode) { updateTextView( itemView, itemView.findViewById(R.id.language_picker_item), position); } else { updateTextView(itemView, itemView.findViewById(R.id.locale), position); } break; } return itemView; Loading @@ -280,20 +288,21 @@ public class SuggestedLocaleAdapter extends BaseAdapter implements Filterable { } break; case TYPE_SYSTEM_LANGUAGE_FOR_APP_LANGUAGE_PICKER: if (((LocaleStore.LocaleInfo) getItem(position)).isAppCurrentLocale()) { shouldReuseView = convertView instanceof LinearLayout && convertView.findViewById(R.id.language_picker_item) != null; if (!shouldReuseView) { if (mHasSpecificAppPackageName) { updatedView = mInflater.inflate( R.layout.app_language_picker_current_locale_item, parent, false); R.layout.app_language_picker_locale_item, parent, false); RadioButton option = updatedView.findViewById(R.id.checkbox); if (((LocaleStore.LocaleInfo) getItem(position)).isAppCurrentLocale()) { option.setChecked(true); } else { option.setChecked(false); } } else { shouldReuseView = convertView instanceof TextView && convertView.findViewById(R.id.locale) != null; if (!shouldReuseView) { updatedView = mInflater.inflate( R.layout.language_picker_item, parent, false); updatedView = mInflater.inflate(R.layout.language_picker_item, parent, false); } } break; Loading @@ -302,14 +311,30 @@ public class SuggestedLocaleAdapter extends BaseAdapter implements Filterable { && convertView.findViewById(R.id.language_picker_item) != null; if (!shouldReuseView) { updatedView = mInflater.inflate( R.layout.app_language_picker_current_locale_item, parent, false); R.layout.app_language_picker_locale_item, parent, false); RadioButton option = updatedView.findViewById(R.id.checkbox); option.setChecked(true); } break; default: LocaleStore.LocaleInfo localeInfo = (LocaleStore.LocaleInfo) getItem(position); if (mHasSpecificAppPackageName && localeInfo.isSuggested() && !mCountryMode) { shouldReuseView = convertView instanceof LinearLayout && convertView.findViewById(R.id.language_picker_item) != null; if ((!shouldReuseView)) { updatedView = mInflater.inflate( R.layout.app_language_picker_locale_item, parent, false); RadioButton option = updatedView.findViewById(R.id.checkbox); option.setChecked(false); } } else { shouldReuseView = convertView instanceof TextView && convertView.findViewById(R.id.locale) != null; if (!shouldReuseView) { updatedView = mInflater.inflate(R.layout.language_picker_item, parent, false); if ((!shouldReuseView)) { updatedView = mInflater.inflate( R.layout.language_picker_item, parent, false); } } break; } Loading core/res/res/layout/app_language_picker_current_locale_item.xml→core/res/res/layout/app_language_picker_locale_item.xml +19 −18 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2022 The Android Open Source Project ~ Copyright (C) 2024 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. Loading @@ -20,10 +20,27 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical"> <LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:gravity="center" android:minHeight="?android:attr/listPreferredItemHeight" android:layout_marginStart="20dip"> <RadioButton android:id="@+id/checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:background="@null" android:focusable="false" android:clickable="false" /> </LinearLayout> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="6dip" android:layout_marginTop="6dip" android:layout_marginBottom="6dip" android:layout_weight="1"> Loading @@ -31,20 +48,4 @@ android:id="@+id/language_picker_item" layout="@layout/language_picker_item" /> </RelativeLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:gravity="center" android:minHeight="?android:attr/listPreferredItemHeight"> <ImageView android:id="@+id/imageView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginHorizontal="16dp" android:src="@drawable/ic_check_24dp" app:tint="?attr/colorAccentPrimaryVariant" android:contentDescription="@*android:string/checked"/> </LinearLayout> </LinearLayout> core/res/res/values/symbols.xml +1 −1 Original line number Diff line number Diff line Loading @@ -5264,7 +5264,7 @@ <java-symbol type="string" name="system_locale_title" /> <java-symbol type="layout" name="app_language_picker_system_default" /> <java-symbol type="layout" name="app_language_picker_system_current" /> <java-symbol type="layout" name="app_language_picker_current_locale_item" /> <java-symbol type="layout" name="app_language_picker_locale_item" /> <java-symbol type="id" name="system_locale_subtitle" /> <java-symbol type="id" name="language_picker_item" /> <java-symbol type="id" name="language_picker_header" /> Loading Loading
core/java/com/android/internal/app/SuggestedLocaleAdapter.java +47 −22 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.widget.BaseAdapter; import android.widget.Filter; import android.widget.Filterable; import android.widget.LinearLayout; import android.widget.RadioButton; import android.widget.TextView; import com.android.internal.R; Loading Loading @@ -242,11 +243,7 @@ public class SuggestedLocaleAdapter extends BaseAdapter implements Filterable { break; case TYPE_SYSTEM_LANGUAGE_FOR_APP_LANGUAGE_PICKER: TextView title; LocaleStore.LocaleInfo info = (LocaleStore.LocaleInfo) getItem(position); if (info == null) { throw new NullPointerException("Non header locale cannot be null."); } if (info.isAppCurrentLocale()) { if (mHasSpecificAppPackageName) { title = itemView.findViewById(R.id.language_picker_item); } else { title = itemView.findViewById(R.id.locale); Loading @@ -254,11 +251,22 @@ public class SuggestedLocaleAdapter extends BaseAdapter implements Filterable { title.setText(R.string.system_locale_title); break; case TYPE_CURRENT_LOCALE: updateTextView(itemView, itemView.findViewById(R.id.language_picker_item), position); updateTextView( itemView, itemView.findViewById(R.id.language_picker_item), position); break; default: LocaleStore.LocaleInfo localeInfo = (LocaleStore.LocaleInfo) getItem(position); if (localeInfo == null) { throw new NullPointerException("Non header locale cannot be null."); } if (mHasSpecificAppPackageName && localeInfo.isSuggested() && !mCountryMode) { updateTextView( itemView, itemView.findViewById(R.id.language_picker_item), position); } else { updateTextView(itemView, itemView.findViewById(R.id.locale), position); } break; } return itemView; Loading @@ -280,20 +288,21 @@ public class SuggestedLocaleAdapter extends BaseAdapter implements Filterable { } break; case TYPE_SYSTEM_LANGUAGE_FOR_APP_LANGUAGE_PICKER: if (((LocaleStore.LocaleInfo) getItem(position)).isAppCurrentLocale()) { shouldReuseView = convertView instanceof LinearLayout && convertView.findViewById(R.id.language_picker_item) != null; if (!shouldReuseView) { if (mHasSpecificAppPackageName) { updatedView = mInflater.inflate( R.layout.app_language_picker_current_locale_item, parent, false); R.layout.app_language_picker_locale_item, parent, false); RadioButton option = updatedView.findViewById(R.id.checkbox); if (((LocaleStore.LocaleInfo) getItem(position)).isAppCurrentLocale()) { option.setChecked(true); } else { option.setChecked(false); } } else { shouldReuseView = convertView instanceof TextView && convertView.findViewById(R.id.locale) != null; if (!shouldReuseView) { updatedView = mInflater.inflate( R.layout.language_picker_item, parent, false); updatedView = mInflater.inflate(R.layout.language_picker_item, parent, false); } } break; Loading @@ -302,14 +311,30 @@ public class SuggestedLocaleAdapter extends BaseAdapter implements Filterable { && convertView.findViewById(R.id.language_picker_item) != null; if (!shouldReuseView) { updatedView = mInflater.inflate( R.layout.app_language_picker_current_locale_item, parent, false); R.layout.app_language_picker_locale_item, parent, false); RadioButton option = updatedView.findViewById(R.id.checkbox); option.setChecked(true); } break; default: LocaleStore.LocaleInfo localeInfo = (LocaleStore.LocaleInfo) getItem(position); if (mHasSpecificAppPackageName && localeInfo.isSuggested() && !mCountryMode) { shouldReuseView = convertView instanceof LinearLayout && convertView.findViewById(R.id.language_picker_item) != null; if ((!shouldReuseView)) { updatedView = mInflater.inflate( R.layout.app_language_picker_locale_item, parent, false); RadioButton option = updatedView.findViewById(R.id.checkbox); option.setChecked(false); } } else { shouldReuseView = convertView instanceof TextView && convertView.findViewById(R.id.locale) != null; if (!shouldReuseView) { updatedView = mInflater.inflate(R.layout.language_picker_item, parent, false); if ((!shouldReuseView)) { updatedView = mInflater.inflate( R.layout.language_picker_item, parent, false); } } break; } Loading
core/res/res/layout/app_language_picker_current_locale_item.xml→core/res/res/layout/app_language_picker_locale_item.xml +19 −18 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2022 The Android Open Source Project ~ Copyright (C) 2024 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. Loading @@ -20,10 +20,27 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical"> <LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:gravity="center" android:minHeight="?android:attr/listPreferredItemHeight" android:layout_marginStart="20dip"> <RadioButton android:id="@+id/checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:background="@null" android:focusable="false" android:clickable="false" /> </LinearLayout> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="6dip" android:layout_marginTop="6dip" android:layout_marginBottom="6dip" android:layout_weight="1"> Loading @@ -31,20 +48,4 @@ android:id="@+id/language_picker_item" layout="@layout/language_picker_item" /> </RelativeLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:gravity="center" android:minHeight="?android:attr/listPreferredItemHeight"> <ImageView android:id="@+id/imageView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginHorizontal="16dp" android:src="@drawable/ic_check_24dp" app:tint="?attr/colorAccentPrimaryVariant" android:contentDescription="@*android:string/checked"/> </LinearLayout> </LinearLayout>
core/res/res/values/symbols.xml +1 −1 Original line number Diff line number Diff line Loading @@ -5264,7 +5264,7 @@ <java-symbol type="string" name="system_locale_title" /> <java-symbol type="layout" name="app_language_picker_system_default" /> <java-symbol type="layout" name="app_language_picker_system_current" /> <java-symbol type="layout" name="app_language_picker_current_locale_item" /> <java-symbol type="layout" name="app_language_picker_locale_item" /> <java-symbol type="id" name="system_locale_subtitle" /> <java-symbol type="id" name="language_picker_item" /> <java-symbol type="id" name="language_picker_header" /> Loading