Fix the display/Font preview window appears blank while transitioning between sizes.
Action: Using post messages to update the UI to avoid the timing issue. Bug: 223665259 Test: make RunSettingsRoboTests ROBOTEST_FILTER=PreviewSizeSeekBarControllerTest Change-Id: I31ef0d50a417fb76d14c1caf21926f1618ac3c4f
This commit is contained in:
@@ -48,7 +48,9 @@ class PreviewSizeSeekBarController extends BasePreferenceController implements
|
||||
|
||||
final ProgressInteractionListener interactionListener =
|
||||
mInteractionListener.get();
|
||||
interactionListener.notifyPreferenceChanged();
|
||||
// Avoid timing issues to update the corresponding preview fail when clicking
|
||||
// the increase/decrease button.
|
||||
seekBar.post(interactionListener::notifyPreferenceChanged);
|
||||
|
||||
if (!mSeekByTouch) {
|
||||
interactionListener.onProgressChanged();
|
||||
|
@@ -24,6 +24,7 @@ import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.SeekBar;
|
||||
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
@@ -111,4 +112,15 @@ public class PreviewSizeSeekBarControllerTest {
|
||||
|
||||
verify(mInteractionListener).onProgressChanged();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onProgressChanged_verifyNotifyPreferenceChanged() {
|
||||
mSeekBarController.displayPreference(mPreferenceScreen);
|
||||
|
||||
mSeekBarPreference.setProgress(mSeekBarPreference.getMax());
|
||||
mSeekBarPreference.onProgressChanged(new SeekBar(mContext), /* progress= */
|
||||
0, /* fromUser= */ false);
|
||||
|
||||
verify(mInteractionListener).notifyPreferenceChanged();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user