From f2ded80627516201310262407ee1685eb02e1a0e Mon Sep 17 00:00:00 2001 From: debbebichouaieb Date: Tue, 6 Jul 2021 14:33:07 +0100 Subject: [PATCH] custom arabic locale --- .../singledateandtimepicker/widget/WheelPicker.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/singledateandtimepicker/src/main/java/com/github/florent37/singledateandtimepicker/widget/WheelPicker.java b/singledateandtimepicker/src/main/java/com/github/florent37/singledateandtimepicker/widget/WheelPicker.java index 10f96f96..7847ffbc 100644 --- a/singledateandtimepicker/src/main/java/com/github/florent37/singledateandtimepicker/widget/WheelPicker.java +++ b/singledateandtimepicker/src/main/java/com/github/florent37/singledateandtimepicker/widget/WheelPicker.java @@ -1032,13 +1032,20 @@ public Locale getCurrentLocale() { return customLocale; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - return getResources().getConfiguration().getLocales().get(0); + return getArabicLocale(getResources().getConfiguration().getLocales().get(0)); } else { //noinspection deprecation - return getResources().getConfiguration().locale; + return getArabicLocale(getResources().getConfiguration().locale); } } + private Locale getArabicLocale(Locale locale) { + Locale value = new Locale("ar","LY") ; + if (locale.getLanguage().equals(value.getLanguage())) { + return value ; + }else return locale ; + } + public void setDateHelper(DateHelper dateHelper) { this.dateHelper = dateHelper; }