Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a99f7c3 authored by Chaohui Wang's avatar Chaohui Wang
Browse files

Fix flicker for AppDataUsagePreference

AppDataUsagePreference's title is sometime async loading, which cause
preference height change, which lead to page flicker.

Set a title placeholder before async loading to reduce flicker.

Fix: 187019210
Test: manual visual test
Change-Id: I26df832ab03a04641fd3d6eb678903ff3fe8820a
parent b91e43c5
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.widget.ProgressBar;

import androidx.preference.PreferenceViewHolder;

import com.android.settings.R;
import com.android.settingslib.AppItem;
import com.android.settingslib.net.UidDetail;
import com.android.settingslib.net.UidDetailProvider;
@@ -49,6 +50,9 @@ public class AppDataUsagePreference extends AppPreference {
        if (mDetail != null) {
            setAppInfo();
        } else {
            // Set a placeholder title before starting to fetch real title, this is necessary
            // to avoid preference height change.
            setTitle(R.string.summary_placeholder);
            ThreadUtils.postOnBackgroundThread(() -> {
                mDetail = provider.getUidDetail(mItem.key, true /* blocking */);
                ThreadUtils.postOnMainThread(() -> setAppInfo());