Skip to content

Commit

Permalink
Feature - RTL Support (#844)
Browse files Browse the repository at this point in the history
  • Loading branch information
quentin41500 committed Sep 7, 2018
1 parent 7562372 commit 8e439b7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ public CalendarPagerView(
setClipChildren(false);
setClipToPadding(false);

if (LocalUtils.isRTL()) {
this.setRotationY(180);
}

if (showWeekDays) {
buildWeekDays(resetAndGetWorkingCalendar());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
package com.prolificinteractive.materialcalendarview;

import android.support.v4.text.TextUtilsCompat;
import android.support.v4.view.ViewCompat;
import java.util.Locale;

class LocalUtils {

private LocalUtils() { }

static boolean isRTL() {
return isRTL(Locale.getDefault());
}

private static boolean isRTL(Locale locale) {
final int directionality = Character.getDirectionality(locale.getDisplayName().charAt(0));
return directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT ||
directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC;
return TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault())
== ViewCompat.LAYOUT_DIRECTION_RTL;
}
}
11 changes: 11 additions & 0 deletions library/src/main/res/drawable-ldrtl/mcv_action_next.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0"
android:width="24dp"
>
<path
android:fillColor="#000000"
android:pathData="M15.41,7.41L14,6l-6,6 6,6 1.41,-1.41L10.83,12z"
/>
</vector>
11 changes: 11 additions & 0 deletions library/src/main/res/drawable-ldrtl/mcv_action_previous.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0"
android:width="24dp"
>
<path
android:fillColor="#000000"
android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z"
/>
</vector>

0 comments on commit 8e439b7

Please sign in to comment.