Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature - RTL Support (#844)
Browse files Browse the repository at this point in the history
quentin41500 authored Aug 11, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent ec536df commit 2555987
Showing 4 changed files with 26 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -55,10 +55,6 @@ public CalendarPagerView(
setClipChildren(false);
setClipToPadding(false);

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

if (showWeekDays) {
buildWeekDays(resetAndGetWorkingCalendar());
}
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 2555987

Please sign in to comment.