Skip to content

Commit

Permalink
Fix animation video render issue when Settings->Moves is resumed from
Browse files Browse the repository at this point in the history
screen off.

Re-initialize the animation video if necessary when the preference is
visible to the user.

Fixes: 31023261

Test: manual -
1. Go to Settings -> Moves and verify that the animation video are
displayed correctly on load.
2. Press power button to turn screen off, then on again. Verify when
Moves settings resumes, the animation video is displayed correctly.
3. Repeat #2 above but let display time out instead of turning off
screen by power button.

Change-Id: I0ee21d23a4c402b3a8463dca3b36fce67d651993
  • Loading branch information
Doris Ling committed Aug 23, 2016
1 parent 0948ce0 commit 008ba4e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/com/android/settings/gestures/GesturePreference.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ void loadPreview(LoaderManager manager, int id) {
Loader<Bitmap> loader = manager.initLoader(id, Bundle.EMPTY, this);
}

void onViewVisible() {
if (mVideoReady && mMediaPlayer != null && !mMediaPlayer.isPlaying()) {
mMediaPlayer.seekTo(0);
}
}

private static final class PreviewRetriever extends AsyncLoader<Bitmap> {
private Uri mVideoPath;

Expand Down
8 changes: 8 additions & 0 deletions src/com/android/settings/gestures/GestureSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
return view;
}

@Override
public void onStart() {
super.onStart();
for (GesturePreference preference : mPreferences) {
preference.onViewVisible();
}
}

@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
boolean enabled = (boolean) newValue;
Expand Down

0 comments on commit 008ba4e

Please sign in to comment.