From 2b78aa098893d74cd3c86ea96fa28d90c43acb29 Mon Sep 17 00:00:00 2001 From: Tsung-Mao Fang Date: Fri, 23 Apr 2021 22:26:19 +0800 Subject: [PATCH] Fix unable to change language In some cases, recycler view receives the cancel touch event, it causes recycler view doesn't update the new locale list. Currently, we also treat cancel event as a signal to update the locale. According to the document, we can treat cancel event as a up event, but not perform any action that you normally would. It's ok in our case since we check if updated list is same as last one in adapater. Test: Drag and drop locale item, and make sure the language system is updated. Fix: 184051013 Fix: 184903189 Fix: 185000363 Change-Id: I06610080f34c5ed3562c74e1cdd955571cae55c0 --- src/com/android/settings/localepicker/LocaleRecyclerView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/settings/localepicker/LocaleRecyclerView.java b/src/com/android/settings/localepicker/LocaleRecyclerView.java index e82874dab70..d32a735d48c 100644 --- a/src/com/android/settings/localepicker/LocaleRecyclerView.java +++ b/src/com/android/settings/localepicker/LocaleRecyclerView.java @@ -37,7 +37,7 @@ class LocaleRecyclerView extends RecyclerView { @Override public boolean onTouchEvent(MotionEvent e) { - if (e.getAction() == MotionEvent.ACTION_UP) { + if (e.getAction() == MotionEvent.ACTION_UP || e.getAction() == MotionEvent.ACTION_CANCEL) { LocaleDragAndDropAdapter adapter = (LocaleDragAndDropAdapter) this.getAdapter(); if (adapter != null) { adapter.doTheUpdate();