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

Commit da7c3af6 authored by Evan Chen's avatar Evan Chen Committed by Android (Google) Code Review
Browse files

Merge "Fix UI flicker issue when selecting the device" into main

parents c68e6076 48e41ffb
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ import android.graphics.drawable.Icon;
import android.net.MacAddress;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.text.Spanned;
@@ -621,8 +622,10 @@ public class CompanionAssociationActivity extends FragmentActivity implements
            Slog.w(TAG, "Already selected.");
            return;
        }
        // Notify the adapter to highlight the selected item.
        mDeviceAdapter.setSelectedPosition(position);
        // Delay highlighting the selected item by posting to the main thread.
        // This helps avoid flicker in the user consent dialog after device selection.
        new Handler(
                Looper.getMainLooper()).post(() -> mDeviceAdapter.setSelectedPosition(position));

        mSelectedDevice = requireNonNull(selectedDevice);