Ensure that the gesture animation video is paused properly.
Add the handling to pause the animation video when user navigates away from the gesture settings. Test: Manual - play gesture animation videos, then switch to another app in recents. Verifies from logcat that NuPlayerDriver is not active. Fix: 32064123 Change-Id: I3d0fb3946e4d0d77a686aa97cfabe667862cac17
This commit is contained in:
@@ -150,6 +150,10 @@ public final class GesturePreference extends SwitchPreference {
|
||||
playButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
if (mMediaPlayer != null && !mMediaPlayer.isPlaying() &&
|
||||
playButton.getVisibility() != View.VISIBLE) {
|
||||
playButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -175,4 +179,10 @@ public final class GesturePreference extends SwitchPreference {
|
||||
}
|
||||
}
|
||||
|
||||
void onViewInvisible() {
|
||||
if (mMediaPlayer != null && mMediaPlayer.isPlaying()) {
|
||||
mMediaPlayer.pause();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -144,6 +144,14 @@ public class GestureSettings extends SettingsPreferenceFragment implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
for (GesturePreference preference : mPreferences) {
|
||||
preference.onViewInvisible();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
boolean enabled = (boolean) newValue;
|
||||
|
Reference in New Issue
Block a user