[Language] Should show confirm dialog when deleting the system language

and making the second language automatically become the system language

Bug: 286508825
Test: make RunSettingsRoboTests -j128 ROBOTEST_FILTER=LocaleListEditorTest
Change-Id: I556eecc9eec1ddcdb8947d5ba69d0db2c016e33c
This commit is contained in:
Zoey Chen
2023-07-14 07:47:02 +00:00
parent b1aaa313ef
commit 4900bcfa5c
3 changed files with 68 additions and 16 deletions

View File

@@ -395,10 +395,13 @@ class LocaleDragAndDropAdapter
// drag locale's original position to the top.
mDragLocale = (LocaleStore.LocaleInfo) savedInstanceState.getSerializable(
CFGKEY_DRAG_LOCALE);
mFeedItemList.removeIf(
localeInfo -> TextUtils.equals(localeInfo.getId(), mDragLocale.getId()));
mFeedItemList.add(0, mDragLocale);
notifyItemRangeChanged(0, mFeedItemList.size());
if (mDragLocale != null) {
mFeedItemList.removeIf(
localeInfo -> TextUtils.equals(localeInfo.getId(),
mDragLocale.getId()));
mFeedItemList.add(0, mDragLocale);
notifyItemRangeChanged(0, mFeedItemList.size());
}
}
}
}