From 6793597161676e452c2a09dc59a5aae816cddfde Mon Sep 17 00:00:00 2001 From: kaiyiz Date: Mon, 2 Mar 2015 15:54:50 +0800 Subject: Gallery2: Modify the action of rewind and forward button When change to arabic language, the rewind and forward button should exchange their behavior due to the direction of progress bar is changed. Change default behavior of the media button for RTL. Change-Id: I5254fbf8329d74344e7c2f159c55473169c5c2ae --- .../android/gallery3d/app/MovieControllerOverlay.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/com/android/gallery3d/app/MovieControllerOverlay.java b/src/com/android/gallery3d/app/MovieControllerOverlay.java index bb25882c8..168cbe102 100644 --- a/src/com/android/gallery3d/app/MovieControllerOverlay.java +++ b/src/com/android/gallery3d/app/MovieControllerOverlay.java @@ -22,6 +22,7 @@ import android.graphics.BitmapFactory; import android.graphics.Color; import android.graphics.Rect; import android.os.Handler; +import android.text.TextUtils; import android.util.DisplayMetrics; import android.view.Gravity; import android.view.KeyEvent; @@ -50,6 +51,7 @@ import org.codeaurora.gallery3d.video.ExtensionHelper; import org.codeaurora.gallery3d.video.ScreenModeManager; import org.codeaurora.gallery3d.video.ScreenModeManager.ScreenModeListener; +import java.util.Locale; /** * The playback controller for the Movie Player. @@ -840,10 +842,20 @@ public class MovieControllerOverlay extends CommonControllerOverlay implements mListenerForRewind.onStopVideo(); } else if (v == mRewind) { Log.v(TAG, "ControllerRewindAndForwardExt onClick mRewind"); - mListenerForRewind.onRewind(); + if (TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) + == View.LAYOUT_DIRECTION_RTL) { + mListenerForRewind.onForward(); + } else { + mListenerForRewind.onRewind(); + } } else if (v == mForward) { Log.v(TAG, "ControllerRewindAndForwardExt onClick mForward"); - mListenerForRewind.onForward(); + if (TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) + == View.LAYOUT_DIRECTION_RTL) { + mListenerForRewind.onRewind(); + } else { + mListenerForRewind.onForward(); + } } } -- cgit v1.2.3