Disable RecyclerView animation to fix the broken UI

RecyclerView has item animation by default. In this bug, RV animation
seems to be interrupted by the page transitions(Shared Axis), and so
items could not finish sliding to its position.

Hence, disable RV animation to fix it.

Fixes: 189720797
Test: Navigate to Mobile & Wifi usage page and see the normal UI.
Change-Id: I52920715ae4b63ef78a73fcb9c76c6d20f80e012
This commit is contained in:
Yi-Ling Chuang
2021-06-03 18:04:36 +08:00
parent 09666f9ef4
commit 5b219a34ab
2 changed files with 19 additions and 0 deletions

View File

@@ -39,8 +39,10 @@ import androidx.loader.content.Loader;
import androidx.preference.Preference; import androidx.preference.Preference;
import androidx.preference.Preference.OnPreferenceChangeListener; import androidx.preference.Preference.OnPreferenceChangeListener;
import androidx.preference.PreferenceCategory; import androidx.preference.PreferenceCategory;
import androidx.recyclerview.widget.RecyclerView;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.applications.AppInfoBase; import com.android.settings.applications.AppInfoBase;
import com.android.settings.widget.EntityHeaderController; import com.android.settings.widget.EntityHeaderController;
import com.android.settingslib.AppItem; import com.android.settingslib.AppItem;
@@ -221,6 +223,14 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
} }
LoaderManager.getInstance(this).restartLoader(LOADER_APP_USAGE_DATA, null /* args */, LoaderManager.getInstance(this).restartLoader(LOADER_APP_USAGE_DATA, null /* args */,
mUidDataCallbacks); mUidDataCallbacks);
if (Utils.isPageTransitionEnabled(mContext)) {
final RecyclerView recyclerView = getListView();
if (recyclerView != null) {
recyclerView.setItemAnimator(null);
}
}
updatePrefs(); updatePrefs();
} }

View File

@@ -25,9 +25,11 @@ import android.util.Log;
import androidx.preference.Preference; import androidx.preference.Preference;
import androidx.preference.PreferenceGroup; import androidx.preference.PreferenceGroup;
import androidx.preference.PreferenceScreen; import androidx.preference.PreferenceScreen;
import androidx.recyclerview.widget.RecyclerView;
import com.android.internal.widget.LockPatternUtils; import com.android.internal.widget.LockPatternUtils;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settingslib.core.AbstractPreferenceController; import com.android.settingslib.core.AbstractPreferenceController;
import java.util.ArrayList; import java.util.ArrayList;
@@ -78,6 +80,13 @@ public class AppNotificationSettings extends NotificationSettings {
return; return;
} }
if (Utils.isPageTransitionEnabled(mContext)) {
final RecyclerView recyclerView = getListView();
if (recyclerView != null) {
recyclerView.setItemAnimator(null);
}
}
for (NotificationPreferenceController controller : mControllers) { for (NotificationPreferenceController controller : mControllers) {
controller.onResume(mAppRow, mChannel, mChannelGroup, null, null, mSuspendedAppsAdmin, controller.onResume(mAppRow, mChannel, mChannelGroup, null, null, mSuspendedAppsAdmin,
null); null);