[Android] [PATCH v2] Fix touch events in RTL mode

Habib Kazemi kazemihabib1996 at gmail.com
Tue Jun 6 10:34:36 CEST 2017


we don't need    final boolean rtl = AndroidUtil.isJellyBeanMR1OrLater &&
TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) ==
View.LAYOUT_DIRECTION_RTL;

in onTouchEvent  anymore because of `mIsRtl`

On Tue, Jun 6, 2017 at 12:49 PM, Geoffrey Métais <geoffrey at videolan.org>
wrote:

> Merged
>
> Le ven. 2 juin 2017 à 20:56, habib kazemi <kazemihabib1996 at gmail.com> a
> écrit :
>
>> Reverse seek touch direction and
>> reverse the location BrightnessTouch and VolumeTouch
>> ---
>>  .../vlc/gui/video/VideoPlayerActivity.java         | 23
>> ++++++++++++++--------
>>  1 file changed, 15 insertions(+), 8 deletions(-)
>>
>> diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
>> b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
>> index 305deb04c..fc56ed7d8 100644
>> --- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
>> +++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
>> @@ -2081,6 +2081,7 @@ public class VideoPlayerActivity extends
>> AppCompatActivity implements IVLCVout.C
>>
>>      @Override
>>      public boolean onTouchEvent(MotionEvent event) {
>> +        final boolean rtl = AndroidUtil.isJellyBeanMR1OrLater &&
>> TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) ==
>> View.LAYOUT_DIRECTION_RTL;
>>          if (mService == null)
>>              return false;
>>          if (mDetector == null) {
>> @@ -2156,19 +2157,25 @@ public class VideoPlayerActivity extends
>> AppCompatActivity implements IVLCVout.C
>>                              return false;
>>                          mTouchY = event.getRawY();
>>                          mTouchX = event.getRawX();
>> -                        // Volume (Up or Down - Right side)
>> -                        if ((mTouchControls & TOUCH_FLAG_AUDIO_VOLUME)
>> != 0 && (int)mTouchX > (4 * mScreen.widthPixels / 7f)){
>> -                            doVolumeTouch(y_changed);
>> +                        // (Up or Down - Right side) LTR: Volume RTL:
>> Brightness
>> +                        if ((mTouchControls & (!rtl ?
>> TOUCH_FLAG_AUDIO_VOLUME : TOUCH_FLAG_BRIGHTNESS)) != 0 && (int)mTouchX > (4
>> * mScreen.widthPixels / 7f)){
>> +                            if (!rtl)
>> +                                doVolumeTouch(y_changed);
>> +                            else
>> +                                doBrightnessTouch(y_changed);
>>                              hideOverlay(true);
>>                          }
>> -                        // Brightness (Up or Down - Left side)
>> -                        if ((mTouchControls & TOUCH_FLAG_BRIGHTNESS) !=
>> 0 && (int)mTouchX < (3 * mScreen.widthPixels / 7f)){
>> -                            doBrightnessTouch(y_changed);
>> +                        // (Up or Down - Left side) LTR: Brightness RTL:
>> Volume
>> +                        if ((mTouchControls & (!rtl ?
>> TOUCH_FLAG_BRIGHTNESS : TOUCH_FLAG_AUDIO_VOLUME)) != 0 && (int)mTouchX < (3
>> * mScreen.widthPixels / 7f)){
>> +                            if(!rtl)
>> +                                doBrightnessTouch(y_changed);
>> +                            else
>> +                                doVolumeTouch(y_changed);
>>                              hideOverlay(true);
>>                          }
>>                      } else {
>>                          // Seek (Right or Left move)
>> -                        doSeekTouch(Math.round(delta_y), xgesturesize,
>> false);
>> +                        doSeekTouch(Math.round(delta_y), rtl ?
>> -xgesturesize : xgesturesize , false);
>>                      }
>>                  } else {
>>                      mTouchY = event.getRawY();
>> @@ -2185,7 +2192,7 @@ public class VideoPlayerActivity extends
>> AppCompatActivity implements IVLCVout.C
>>                  sendMouseEvent(MotionEvent.ACTION_UP, 0, xTouch,
>> yTouch);
>>                  // Seek
>>                  if (mTouchAction == TOUCH_SEEK)
>> -                    doSeekTouch(Math.round(delta_y), xgesturesize,
>> true);
>> +                    doSeekTouch(Math.round(delta_y), rtl ?
>> -xgesturesize : xgesturesize , true);
>>                  mTouchX = -1f;
>>                  mTouchY = -1f;
>>                  break;
>> --
>> 2.12.2
>>
>> _______________________________________________
>> Android mailing list
>> Android at videolan.org
>> https://mailman.videolan.org/listinfo/android
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/android/attachments/20170606/a34a782b/attachment.html>


More information about the Android mailing list