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

Commit c4772636 authored by Qi Ding's avatar Qi Ding Committed by Yoshinori Hirano
Browse files

Fix searched item isn't highlighted

The searched item isn't highlighted.
To fix this issue, the highlight process should be posted
as Runnable object.

Bug: 31983855
Test: manual - search a item in Settings app

Change-Id: I0dcc5bb52b2faa0a23991459885d8dfcaed0f226
parent 00a2619a
Loading
Loading
Loading
Loading
+10 −8
Original line number Original line Diff line number Diff line
@@ -757,6 +757,7 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
            super.onBindViewHolder(holder, position);
            super.onBindViewHolder(holder, position);
            if (position == mHighlightPosition) {
            if (position == mHighlightPosition) {
                View v = holder.itemView;
                View v = holder.itemView;
                v.post(() -> {
                    if (v.getBackground() != null) {
                    if (v.getBackground() != null) {
                        final int centerX = v.getWidth() / 2;
                        final int centerX = v.getWidth() / 2;
                        final int centerY = v.getHeight() / 2;
                        final int centerY = v.getHeight() / 2;
@@ -765,6 +766,7 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
                    v.setPressed(true);
                    v.setPressed(true);
                    v.setPressed(false);
                    v.setPressed(false);
                    mHighlightPosition = -1;
                    mHighlightPosition = -1;
                });
            }
            }
        }
        }
    }
    }