Ensure that the gesture animation video is paused properly. am: 4245ad4771
am: 5e4fce04fb
Change-Id: Ic615738b57a4ca49f5c6101e86aea03dbf0f9a12
diff --git a/src/com/android/settings/gestures/GesturePreference.java b/src/com/android/settings/gestures/GesturePreference.java
index 1909dcd..5a64a5a 100644
--- a/src/com/android/settings/gestures/GesturePreference.java
+++ b/src/com/android/settings/gestures/GesturePreference.java
@@ -150,6 +150,10 @@
playButton.setVisibility(View.VISIBLE);
}
}
+ if (mMediaPlayer != null && !mMediaPlayer.isPlaying() &&
+ playButton.getVisibility() != View.VISIBLE) {
+ playButton.setVisibility(View.VISIBLE);
+ }
}
});
@@ -175,4 +179,10 @@
}
}
+ void onViewInvisible() {
+ if (mMediaPlayer != null && mMediaPlayer.isPlaying()) {
+ mMediaPlayer.pause();
+ }
+ }
+
}
diff --git a/src/com/android/settings/gestures/GestureSettings.java b/src/com/android/settings/gestures/GestureSettings.java
index 74080ce..c03c5e1 100644
--- a/src/com/android/settings/gestures/GestureSettings.java
+++ b/src/com/android/settings/gestures/GestureSettings.java
@@ -145,6 +145,14 @@
}
@Override
+ public void onStop() {
+ super.onStop();
+ for (GesturePreference preference : mPreferences) {
+ preference.onViewInvisible();
+ }
+ }
+
+ @Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
boolean enabled = (boolean) newValue;
String key = preference.getKey();