From 771a0c047305a3850bd19ebe0572ff73ad3ce135 Mon Sep 17 00:00:00 2001 From: Jason Chiu Date: Mon, 14 Nov 2022 14:12:40 +0800 Subject: [PATCH] Eliminate the injection flicker while navigating back For the title/summary uri, do not set the placeholder when it already has content. This can avoid clearing the text before re-rendering. Test: robotest, visual Fix: 256657256 Change-Id: I0518f5247fd2acf6a5eaa63f0f363275103a79af --- .../settings/dashboard/DashboardFeatureProviderImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java index f6dd0b7a329..4dc8f1af207 100644 --- a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java +++ b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java @@ -260,7 +260,9 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider { META_DATA_PREFERENCE_TITLE_URI)) { // Set a placeholder title before starting to fetch real title, this is necessary // to avoid preference height change. - preference.setTitle(R.string.summary_placeholder); + if (preference.getTitle() == null) { + preference.setTitle(R.string.summary_placeholder); + } final Uri uri = TileUtils.getCompleteUri(tile, META_DATA_PREFERENCE_TITLE_URI, METHOD_GET_DYNAMIC_TITLE); @@ -288,7 +290,9 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider { && tile.getMetaData().containsKey(META_DATA_PREFERENCE_SUMMARY_URI)) { // Set a placeholder summary before starting to fetch real summary, this is necessary // to avoid preference height change. - preference.setSummary(R.string.summary_placeholder); + if (preference.getSummary() == null) { + preference.setSummary(R.string.summary_placeholder); + } final Uri uri = TileUtils.getCompleteUri(tile, META_DATA_PREFERENCE_SUMMARY_URI, METHOD_GET_DYNAMIC_SUMMARY);