diff --git a/README.md b/README.md
index ec9963b..b46bc05 100644
--- a/README.md
+++ b/README.md
@@ -9,9 +9,9 @@
![](https://img.shields.io/badge/Platform-Android-brightgreen.svg)
![](https://img.shields.io/badge/Android-CustomView-blue.svg)
![](https://img.shields.io/crates/l/rustc-serialize.svg)
-![](https://img.shields.io/badge/version-2.1.0-blue.svg)
+![](https://img.shields.io/badge/version-3.0.0-blue.svg)
-This library offers a hijri (Islamic Calendar) Date Picker designed on [Google's Material Design Principals For Pickers](http://www.google.com/design/spec/components/pickers.html) for Android 4.1 (API 16) +.
+This library offers a hijri (Islamic Calendar) Date Picker designed on [Google's Material Design Principals For Pickers](http://www.google.com/design/spec/components/pickers.html) for Android 5.0 (API 21) +.
Demo | Hijri
---- | ----
@@ -21,14 +21,14 @@ Time | Gregorian
You can report any issue on issues page. **Note: If you speak Arabic, you can submit issues with Arabic language and I will check them. :)**
-##Installation
+## Installation
**Maven**
```xml
net.alhazmy13.hijridatepicker
library
-2.0.2
+3.0.0
```
**Gradle**
@@ -36,7 +36,7 @@ You can report any issue on issues page. **Note: If you speak Arabic, you can su
```gradle
dependencies {
- compile 'net.alhazmy13.hijridatepicker:library:2.1.0'
+ compile 'net.alhazmy13.hijridatepicker:library:3.0.0'
}
```
diff --git a/build.gradle b/build.gradle
index 8b9b1cb..68f81ff 100644
--- a/build.gradle
+++ b/build.gradle
@@ -6,8 +6,8 @@ buildscript {
google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.1.4'
- classpath 'com.novoda:bintray-release:0.8.0'
+ classpath 'com.android.tools.build:gradle:3.6.3'
+ classpath 'com.novoda:bintray-release:0.9.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
diff --git a/gradle.properties b/gradle.properties
index 89e0d99..915f0e6 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -16,3 +16,5 @@
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
+android.enableJetifier=true
+android.useAndroidX=true
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index e27b027..c908dbe 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Aug 29 12:28:21 EET 2018
+#Fri May 01 08:02:21 AST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
diff --git a/library/build.gradle b/library/build.gradle
index c598110..696b3ae 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -8,7 +8,7 @@ publish {
groupId = 'net.alhazmy13.hijridatepicker'
artifactId = 'library'
uploadName = 'HijriDatePicker-v2'
- publishVersion = '2.1.0'
+ publishVersion = '3.0.0'
desc = 'Hijri Date Picker'
dryRun = false
website = 'https://github.com/alhzmy13/HijriDatePicker'
@@ -16,12 +16,12 @@ publish {
android {
- compileSdkVersion 27
- buildToolsVersion "27.0.3"
+ compileSdkVersion 29
+ buildToolsVersion "29.0.3"
defaultConfig {
- minSdkVersion 19
- targetSdkVersion 27
+ minSdkVersion 21
+ targetSdkVersion 29
versionCode 1
versionName "1.0.2"
}
@@ -40,9 +40,11 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation 'com.android.support:support-v4:27.1.0'
- implementation 'com.android.support:support-v13:27.1.0'
- implementation 'com.android.support:design:27.1.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+ implementation 'com.google.android.material:material:1.2.0-alpha06'
+ implementation "androidx.appcompat:appcompat:1.2.0-beta01"
+ implementation "androidx.constraintlayout:constraintlayout:2.0.0-beta4"
+
implementation group: 'com.github.msarhan', name: 'ummalqura-calendar', version:'1.1.9'
}
diff --git a/library/library.iml b/library/library.iml
index 88191ea..71a45a7 100644
--- a/library/library.iml
+++ b/library/library.iml
@@ -4,6 +4,8 @@
+
+
@@ -18,31 +20,28 @@
+
-
-
+
+
-
-
-
+
+
-
-
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
@@ -50,13 +49,6 @@
-
-
-
-
-
-
-
@@ -64,6 +56,13 @@
+
+
+
+
+
+
+
@@ -71,13 +70,6 @@
-
-
-
-
-
-
-
@@ -85,41 +77,60 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/library/src/main/java/net/alhazmy13/hijridatepicker/AccessibleLinearLayout.java b/library/src/main/java/net/alhazmy13/hijridatepicker/AccessibleLinearLayout.java
index 9f08ca2..5daff65 100644
--- a/library/src/main/java/net/alhazmy13/hijridatepicker/AccessibleLinearLayout.java
+++ b/library/src/main/java/net/alhazmy13/hijridatepicker/AccessibleLinearLayout.java
@@ -20,9 +20,10 @@
import android.util.AttributeSet;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
-import android.widget.Button;
import android.widget.LinearLayout;
+import com.google.android.material.button.MaterialButton;
+
/**
* Fake Button class, used so TextViews can announce themselves as Buttons, for accessibility.
*/
@@ -35,12 +36,12 @@ public AccessibleLinearLayout(Context context, AttributeSet attrs) {
@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);
- event.setClassName(Button.class.getName());
+ event.setClassName(MaterialButton.class.getName());
}
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
- info.setClassName(Button.class.getName());
+ info.setClassName(MaterialButton.class.getName());
}
}
diff --git a/library/src/main/java/net/alhazmy13/hijridatepicker/AccessibleTextView.java b/library/src/main/java/net/alhazmy13/hijridatepicker/AccessibleTextView.java
index 35ae052..347aa1e 100644
--- a/library/src/main/java/net/alhazmy13/hijridatepicker/AccessibleTextView.java
+++ b/library/src/main/java/net/alhazmy13/hijridatepicker/AccessibleTextView.java
@@ -20,13 +20,13 @@
import android.util.AttributeSet;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
-import android.widget.Button;
-import android.widget.TextView;
+
+import com.google.android.material.button.MaterialButton;
/**
* Fake Button class, used so TextViews can announce themselves as Buttons, for accessibility.
*/
-public class AccessibleTextView extends TextView {
+public class AccessibleTextView extends androidx.appcompat.widget.AppCompatTextView {
public AccessibleTextView(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -35,12 +35,12 @@ public AccessibleTextView(Context context, AttributeSet attrs) {
@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);
- event.setClassName(Button.class.getName());
+ event.setClassName(MaterialButton.class.getName());
}
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
- info.setClassName(Button.class.getName());
+ info.setClassName(MaterialButton.class.getName());
}
}
diff --git a/library/src/main/java/net/alhazmy13/hijridatepicker/TypefaceHelper.java b/library/src/main/java/net/alhazmy13/hijridatepicker/TypefaceHelper.java
index 05918c7..9892f7f 100644
--- a/library/src/main/java/net/alhazmy13/hijridatepicker/TypefaceHelper.java
+++ b/library/src/main/java/net/alhazmy13/hijridatepicker/TypefaceHelper.java
@@ -3,7 +3,8 @@
import android.content.Context;
import android.graphics.Typeface;
-import android.support.v4.util.SimpleArrayMap;
+
+import androidx.collection.SimpleArrayMap;
/*
Each call to Typeface.createFromAsset will load a new instance of the typeface into memory,
diff --git a/library/src/main/java/net/alhazmy13/hijridatepicker/Utils.java b/library/src/main/java/net/alhazmy13/hijridatepicker/Utils.java
index b845dd6..e5eb7ee 100644
--- a/library/src/main/java/net/alhazmy13/hijridatepicker/Utils.java
+++ b/library/src/main/java/net/alhazmy13/hijridatepicker/Utils.java
@@ -25,11 +25,12 @@
import android.content.res.TypedArray;
import android.graphics.Color;
import android.os.Build;
-import android.support.annotation.AttrRes;
-import android.support.v4.content.ContextCompat;
import android.util.TypedValue;
import android.view.View;
+import androidx.annotation.AttrRes;
+import androidx.core.content.ContextCompat;
+
/**
* Utility helper functions for time and date pickers.
*/
diff --git a/library/src/main/java/net/alhazmy13/hijridatepicker/date/gregorian/DayPickerView.java b/library/src/main/java/net/alhazmy13/hijridatepicker/date/gregorian/DayPickerView.java
index 8072359..b2ffa70 100644
--- a/library/src/main/java/net/alhazmy13/hijridatepicker/date/gregorian/DayPickerView.java
+++ b/library/src/main/java/net/alhazmy13/hijridatepicker/date/gregorian/DayPickerView.java
@@ -21,7 +21,6 @@
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
-import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
@@ -32,6 +31,8 @@
import android.widget.AbsListView.OnScrollListener;
import android.widget.ListView;
+import androidx.annotation.NonNull;
+
import net.alhazmy13.hijridatepicker.Utils;
import net.alhazmy13.hijridatepicker.date.gregorian.GregorianDatePickerDialog.OnDateChangedListener;
diff --git a/library/src/main/java/net/alhazmy13/hijridatepicker/date/gregorian/GregorianDatePickerDialog.java b/library/src/main/java/net/alhazmy13/hijridatepicker/date/gregorian/GregorianDatePickerDialog.java
index b55fcdd..a5b0ba8 100644
--- a/library/src/main/java/net/alhazmy13/hijridatepicker/date/gregorian/GregorianDatePickerDialog.java
+++ b/library/src/main/java/net/alhazmy13/hijridatepicker/date/gregorian/GregorianDatePickerDialog.java
@@ -19,17 +19,12 @@
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.app.Dialog;
-import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
-import android.support.annotation.ColorInt;
-import android.support.annotation.NonNull;
-import android.support.annotation.StringRes;
-import android.support.v4.content.ContextCompat;
import android.text.format.DateFormat;
import android.text.format.DateUtils;
import android.view.LayoutInflater;
@@ -40,10 +35,18 @@
import android.view.WindowManager;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
-import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
+import androidx.annotation.ColorInt;
+import androidx.annotation.NonNull;
+import androidx.annotation.StringRes;
+import androidx.core.content.ContextCompat;
+import androidx.core.view.ViewCompat;
+import androidx.fragment.app.DialogFragment;
+
+import com.google.android.material.button.MaterialButton;
+
import net.alhazmy13.hijridatepicker.HapticFeedbackController;
import net.alhazmy13.hijridatepicker.R;
import net.alhazmy13.hijridatepicker.TypefaceHelper;
@@ -362,7 +365,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
animation2.setDuration(ANIMATION_DURATION);
mAnimator.setOutAnimation(animation2);
- Button okButton = (Button) view.findViewById(R.id.mdtp_ok);
+ MaterialButton okButton = view.findViewById(R.id.mdtp_ok);
okButton.setOnClickListener(new OnClickListener() {
@Override
@@ -376,7 +379,7 @@ public void onClick(View v) {
if (mOkString != null) okButton.setText(mOkString);
else okButton.setText(mOkResid);
- Button cancelButton = (Button) view.findViewById(R.id.mdtp_cancel);
+ MaterialButton cancelButton = view.findViewById(R.id.mdtp_cancel);
cancelButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@@ -417,7 +420,10 @@ public void onClick(View v) {
mYearPickerView.postSetSelectionFromTop(listPosition, listPositionOffset);
}
}
-
+ if (mThemeDark) {
+ ViewCompat.setBackgroundTintList(okButton, ContextCompat.getColorStateList(getActivity(), R.color.mdtp_light_gray));
+ ViewCompat.setBackgroundTintList(cancelButton, ContextCompat.getColorStateList(getActivity(), R.color.mdtp_light_gray));
+ }
mHapticFeedbackController = new HapticFeedbackController(activity);
return view;
}
diff --git a/library/src/main/java/net/alhazmy13/hijridatepicker/date/gregorian/MonthView.java b/library/src/main/java/net/alhazmy13/hijridatepicker/date/gregorian/MonthView.java
index 030db78..700f9f1 100644
--- a/library/src/main/java/net/alhazmy13/hijridatepicker/date/gregorian/MonthView.java
+++ b/library/src/main/java/net/alhazmy13/hijridatepicker/date/gregorian/MonthView.java
@@ -26,11 +26,12 @@
import android.graphics.Typeface;
import android.os.Build;
import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.v4.content.ContextCompat;
-import android.support.v4.view.ViewCompat;
-import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
-import android.support.v4.widget.ExploreByTouchHelper;
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.core.view.ViewCompat;
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
+import androidx.customview.widget.ExploreByTouchHelper;
+
import android.text.format.DateFormat;
import android.util.AttributeSet;
import android.view.MotionEvent;
diff --git a/library/src/main/java/net/alhazmy13/hijridatepicker/date/gregorian/TextViewWithCircularIndicator.java b/library/src/main/java/net/alhazmy13/hijridatepicker/date/gregorian/TextViewWithCircularIndicator.java
index 5cbc9b0..411bc48 100644
--- a/library/src/main/java/net/alhazmy13/hijridatepicker/date/gregorian/TextViewWithCircularIndicator.java
+++ b/library/src/main/java/net/alhazmy13/hijridatepicker/date/gregorian/TextViewWithCircularIndicator.java
@@ -16,6 +16,7 @@
package net.alhazmy13.hijridatepicker.date.gregorian;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Canvas;
@@ -23,17 +24,19 @@
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.Paint.Style;
-import android.support.annotation.NonNull;
-import android.support.v4.content.ContextCompat;
+
import android.util.AttributeSet;
-import android.widget.TextView;
+import androidx.appcompat.widget.AppCompatTextView;
+
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
import net.alhazmy13.hijridatepicker.R;
/**
* A text view which, when pressed or activated, displays a colored circle around the text.
*/
-public class TextViewWithCircularIndicator extends TextView {
+public class TextViewWithCircularIndicator extends AppCompatTextView {
private static final int SELECTED_CIRCLE_ALPHA = 255;
@@ -103,6 +106,7 @@ public void onDraw(@NonNull Canvas canvas) {
super.onDraw(canvas);
}
+ @SuppressLint("GetContentDescriptionOverride")
@Override
public CharSequence getContentDescription() {
CharSequence itemText = getText();
diff --git a/library/src/main/java/net/alhazmy13/hijridatepicker/date/hijri/DayPickerView.java b/library/src/main/java/net/alhazmy13/hijridatepicker/date/hijri/DayPickerView.java
index 6d1c062..44ffd76 100644
--- a/library/src/main/java/net/alhazmy13/hijridatepicker/date/hijri/DayPickerView.java
+++ b/library/src/main/java/net/alhazmy13/hijridatepicker/date/hijri/DayPickerView.java
@@ -21,7 +21,6 @@
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
-import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
@@ -32,6 +31,8 @@
import android.widget.AbsListView.OnScrollListener;
import android.widget.ListView;
+import androidx.annotation.NonNull;
+
import com.github.msarhan.ummalqura.calendar.UmmalquraCalendar;
import net.alhazmy13.hijridatepicker.Utils;
diff --git a/library/src/main/java/net/alhazmy13/hijridatepicker/date/hijri/HijriDatePickerDialog.java b/library/src/main/java/net/alhazmy13/hijridatepicker/date/hijri/HijriDatePickerDialog.java
index 84c633a..a8bc3d5 100644
--- a/library/src/main/java/net/alhazmy13/hijridatepicker/date/hijri/HijriDatePickerDialog.java
+++ b/library/src/main/java/net/alhazmy13/hijridatepicker/date/hijri/HijriDatePickerDialog.java
@@ -19,17 +19,13 @@
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.app.Dialog;
-import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
-import android.support.annotation.ColorInt;
-import android.support.annotation.NonNull;
-import android.support.annotation.StringRes;
-import android.support.v4.content.ContextCompat;
+
import android.text.format.DateFormat;
import android.text.format.DateUtils;
import android.view.LayoutInflater;
@@ -40,11 +36,18 @@
import android.view.WindowManager;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
-import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
+import androidx.annotation.ColorInt;
+import androidx.annotation.NonNull;
+import androidx.annotation.StringRes;
+import androidx.core.content.ContextCompat;
+import androidx.core.view.ViewCompat;
+import androidx.fragment.app.DialogFragment;
+
import com.github.msarhan.ummalqura.calendar.UmmalquraCalendar;
+import com.google.android.material.button.MaterialButton;
import net.alhazmy13.hijridatepicker.HapticFeedbackController;
import net.alhazmy13.hijridatepicker.R;
@@ -364,7 +367,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
animation2.setDuration(ANIMATION_DURATION);
mAnimator.setOutAnimation(animation2);
- Button okButton = (Button) view.findViewById(R.id.mdtp_ok);
+ MaterialButton okButton = view.findViewById(R.id.mdtp_ok);
okButton.setOnClickListener(new OnClickListener() {
@Override
@@ -378,7 +381,7 @@ public void onClick(View v) {
if (mOkString != null) okButton.setText(mOkString);
else okButton.setText(mOkResid);
- Button cancelButton = (Button) view.findViewById(R.id.mdtp_cancel);
+ MaterialButton cancelButton = view.findViewById(R.id.mdtp_cancel);
cancelButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@@ -419,7 +422,10 @@ public void onClick(View v) {
mYearPickerView.postSetSelectionFromTop(listPosition, listPositionOffset);
}
}
-
+ if (mThemeDark) {
+ ViewCompat.setBackgroundTintList(okButton, ContextCompat.getColorStateList(getActivity(), R.color.mdtp_light_gray));
+ ViewCompat.setBackgroundTintList(cancelButton, ContextCompat.getColorStateList(getActivity(), R.color.mdtp_light_gray));
+ }
mHapticFeedbackController = new HapticFeedbackController(activity);
return view;
}
diff --git a/library/src/main/java/net/alhazmy13/hijridatepicker/date/hijri/MonthView.java b/library/src/main/java/net/alhazmy13/hijridatepicker/date/hijri/MonthView.java
index 8a58735..2bb2174 100644
--- a/library/src/main/java/net/alhazmy13/hijridatepicker/date/hijri/MonthView.java
+++ b/library/src/main/java/net/alhazmy13/hijridatepicker/date/hijri/MonthView.java
@@ -26,11 +26,6 @@
import android.graphics.Typeface;
import android.os.Build;
import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.v4.content.ContextCompat;
-import android.support.v4.view.ViewCompat;
-import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
-import android.support.v4.widget.ExploreByTouchHelper;
import android.text.format.DateFormat;
import android.util.AttributeSet;
import android.view.MotionEvent;
@@ -38,6 +33,12 @@
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.core.view.ViewCompat;
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
+import androidx.customview.widget.ExploreByTouchHelper;
+
import com.github.msarhan.ummalqura.calendar.UmmalquraCalendar;
import net.alhazmy13.hijridatepicker.R;
diff --git a/library/src/main/java/net/alhazmy13/hijridatepicker/date/hijri/TextViewWithCircularIndicator.java b/library/src/main/java/net/alhazmy13/hijridatepicker/date/hijri/TextViewWithCircularIndicator.java
index 50ea3c6..472ea3f 100644
--- a/library/src/main/java/net/alhazmy13/hijridatepicker/date/hijri/TextViewWithCircularIndicator.java
+++ b/library/src/main/java/net/alhazmy13/hijridatepicker/date/hijri/TextViewWithCircularIndicator.java
@@ -16,6 +16,7 @@
package net.alhazmy13.hijridatepicker.date.hijri;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Canvas;
@@ -23,17 +24,18 @@
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.Paint.Style;
-import android.support.annotation.NonNull;
-import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
-import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.widget.AppCompatTextView;
+import androidx.core.content.ContextCompat;
import net.alhazmy13.hijridatepicker.R;
/**
* A text view which, when pressed or activated, displays a colored circle around the text.
*/
-public class TextViewWithCircularIndicator extends TextView {
+public class TextViewWithCircularIndicator extends AppCompatTextView {
private static final int SELECTED_CIRCLE_ALPHA = 255;
@@ -103,6 +105,7 @@ public void onDraw(@NonNull Canvas canvas) {
super.onDraw(canvas);
}
+ @SuppressLint("GetContentDescriptionOverride")
@Override
public CharSequence getContentDescription() {
CharSequence itemText = getText();
diff --git a/library/src/main/java/net/alhazmy13/hijridatepicker/time/AmPmCirclesView.java b/library/src/main/java/net/alhazmy13/hijridatepicker/time/AmPmCirclesView.java
index 7049be6..0b70197 100644
--- a/library/src/main/java/net/alhazmy13/hijridatepicker/time/AmPmCirclesView.java
+++ b/library/src/main/java/net/alhazmy13/hijridatepicker/time/AmPmCirclesView.java
@@ -22,10 +22,11 @@
import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.Paint.Align;
-import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.view.View;
+import androidx.core.content.ContextCompat;
+
import net.alhazmy13.hijridatepicker.R;
import net.alhazmy13.hijridatepicker.Utils;
diff --git a/library/src/main/java/net/alhazmy13/hijridatepicker/time/CircleView.java b/library/src/main/java/net/alhazmy13/hijridatepicker/time/CircleView.java
index 14c6ea4..8f13f86 100644
--- a/library/src/main/java/net/alhazmy13/hijridatepicker/time/CircleView.java
+++ b/library/src/main/java/net/alhazmy13/hijridatepicker/time/CircleView.java
@@ -20,10 +20,11 @@
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
-import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.view.View;
+import androidx.core.content.ContextCompat;
+
import net.alhazmy13.hijridatepicker.R;
/**
diff --git a/library/src/main/java/net/alhazmy13/hijridatepicker/time/RadialPickerLayout.java b/library/src/main/java/net/alhazmy13/hijridatepicker/time/RadialPickerLayout.java
index 9970ef5..bf7fd70 100644
--- a/library/src/main/java/net/alhazmy13/hijridatepicker/time/RadialPickerLayout.java
+++ b/library/src/main/java/net/alhazmy13/hijridatepicker/time/RadialPickerLayout.java
@@ -22,9 +22,6 @@
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
-import android.support.annotation.NonNull;
-import android.support.v4.content.ContextCompat;
-import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
import android.text.format.DateUtils;
import android.util.AttributeSet;
import android.util.Log;
@@ -38,6 +35,10 @@
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.FrameLayout;
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
+
import net.alhazmy13.hijridatepicker.R;
import java.util.Calendar;
diff --git a/library/src/main/java/net/alhazmy13/hijridatepicker/time/RadialTextsView.java b/library/src/main/java/net/alhazmy13/hijridatepicker/time/RadialTextsView.java
index d441ab3..5cf5fa9 100644
--- a/library/src/main/java/net/alhazmy13/hijridatepicker/time/RadialTextsView.java
+++ b/library/src/main/java/net/alhazmy13/hijridatepicker/time/RadialTextsView.java
@@ -27,10 +27,11 @@
import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.Paint.Align;
-import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.view.View;
+import androidx.core.content.ContextCompat;
+
import net.alhazmy13.hijridatepicker.R;
/**
diff --git a/library/src/main/java/net/alhazmy13/hijridatepicker/time/TimePickerDialog.java b/library/src/main/java/net/alhazmy13/hijridatepicker/time/TimePickerDialog.java
index e87419c..f6a4179 100644
--- a/library/src/main/java/net/alhazmy13/hijridatepicker/time/TimePickerDialog.java
+++ b/library/src/main/java/net/alhazmy13/hijridatepicker/time/TimePickerDialog.java
@@ -19,20 +19,15 @@
import android.animation.ObjectAnimator;
import android.app.ActionBar.LayoutParams;
import android.app.Dialog;
-import android.app.DialogFragment;
import android.content.Context;
import android.content.DialogInterface;
+import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
-import android.support.annotation.ColorInt;
-import android.support.annotation.IntRange;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.annotation.StringRes;
-import android.support.v4.content.ContextCompat;
+
import android.util.Log;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
@@ -42,10 +37,20 @@
import android.view.View.OnKeyListener;
import android.view.ViewGroup;
import android.view.Window;
-import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;
+import androidx.annotation.ColorInt;
+import androidx.annotation.IntRange;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.annotation.StringRes;
+import androidx.core.content.ContextCompat;
+import androidx.core.view.ViewCompat;
+import androidx.fragment.app.DialogFragment;
+
+import com.google.android.material.button.MaterialButton;
+
import net.alhazmy13.hijridatepicker.HapticFeedbackController;
import net.alhazmy13.hijridatepicker.R;
import net.alhazmy13.hijridatepicker.TypefaceHelper;
@@ -110,8 +115,8 @@ public enum Version {
private HapticFeedbackController mHapticFeedbackController;
- private Button mCancelButton;
- private Button mOkButton;
+ private MaterialButton mCancelButton;
+ private MaterialButton mOkButton;
private TextView mHourView;
private TextView mHourSpaceView;
private TextView mMinuteView;
@@ -644,7 +649,7 @@ public void onClick(View view) {
}
});
- mOkButton = (Button) view.findViewById(R.id.mdtp_ok);
+ mOkButton = view.findViewById(R.id.mdtp_ok);
mOkButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@@ -662,7 +667,7 @@ public void onClick(View v) {
if (mOkString != null) mOkButton.setText(mOkString);
else mOkButton.setText(mOkResid);
- mCancelButton = (Button) view.findViewById(R.id.mdtp_cancel);
+ mCancelButton = view.findViewById(R.id.mdtp_cancel);
mCancelButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@@ -906,6 +911,10 @@ public void onClick(View v) {
int lightGray = ContextCompat.getColor(context, R.color.mdtp_light_gray);
mTimePicker.setBackgroundColor(mThemeDark ? lightGray : circleBackground);
+ if (mThemeDark) {
+ ViewCompat.setBackgroundTintList(mOkButton, ContextCompat.getColorStateList(getActivity(), R.color.mdtp_light_gray));
+ ViewCompat.setBackgroundTintList(mCancelButton, ContextCompat.getColorStateList(getActivity(), R.color.mdtp_light_gray));
+ }
view.findViewById(R.id.mdtp_time_picker_dialog).setBackgroundColor(mThemeDark ? darkBackgroundColor : backgroundColor);
return view;
}
diff --git a/library/src/main/java/net/alhazmy13/hijridatepicker/time/Timepoint.java b/library/src/main/java/net/alhazmy13/hijridatepicker/time/Timepoint.java
index 9411733..372a7ff 100644
--- a/library/src/main/java/net/alhazmy13/hijridatepicker/time/Timepoint.java
+++ b/library/src/main/java/net/alhazmy13/hijridatepicker/time/Timepoint.java
@@ -2,9 +2,11 @@
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.annotation.IntRange;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
+
+import androidx.annotation.IntRange;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
/**
* Simple utility class that represents a time in the day up to second precision
diff --git a/library/src/main/res/layout/hdp_mdtp_date_time_picker_dialog.xml b/library/src/main/res/layout/hdp_mdtp_date_time_picker_dialog.xml
index a995dac..47fcca7 100644
--- a/library/src/main/res/layout/hdp_mdtp_date_time_picker_dialog.xml
+++ b/library/src/main/res/layout/hdp_mdtp_date_time_picker_dialog.xml
@@ -7,13 +7,13 @@
android:background="@color/mdtp_date_picker_view_animator"
android:gravity="center">
-
-
-
-
+ android:layout_height="wrap_content">
-
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:layout_marginEnd="4dp"
+ android:layout_marginBottom="8dp"
+ android:backgroundTint="@color/mdtp_background_color"
+ android:text="@string/mdtp_cancel"
+ android:textColor="@color/mdtp_button_color"
+ app:borderWidth="0dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/mdtp_ok"
+ app:layout_constraintTop_toTopOf="parent"
+ app:rippleColor="@color/mdtp_neutral_pressed" />
-
-
+ android:layout_marginTop="8dp"
+ android:layout_marginEnd="4dp"
+ android:layout_marginBottom="8dp"
+ android:backgroundTint="@color/mdtp_background_color"
+ android:text="@string/mdtp_ok"
+ android:textColor="@color/mdtp_button_color"
+ app:borderWidth="0dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:rippleColor="@color/mdtp_neutral_pressed" />
+
+
diff --git a/library/src/main/res/values/styles.xml b/library/src/main/res/values/styles.xml
index 356d7cd..8f4366a 100644
--- a/library/src/main/res/values/styles.xml
+++ b/library/src/main/res/values/styles.xml
@@ -36,24 +36,5 @@
-
-
diff --git a/sample/build.gradle b/sample/build.gradle
index 2cb1cdb..33e8e4b 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 27
- buildToolsVersion "27.0.3"
+ compileSdkVersion 29
+ buildToolsVersion "29.0.3"
defaultConfig {
- minSdkVersion 19
- targetSdkVersion 27
+ minSdkVersion 21
+ targetSdkVersion 29
versionCode 1
versionName "1.0.2"
}
@@ -26,8 +26,8 @@ android {
dependencies {
implementation project(':library')
implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation 'com.android.support:appcompat-v7:27.1.0'
- implementation 'com.android.support:design:27.1.0'
- implementation 'com.android.support:support-v13:27.1.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+ implementation 'com.google.android.material:material:1.2.0-alpha06'
+ implementation "androidx.appcompat:appcompat:1.2.0-beta01"
implementation group: 'com.github.msarhan', name: 'ummalqura-calendar', version:'1.1.9'
}
diff --git a/sample/sample.iml b/sample/sample.iml
index 211e7df..74878b7 100644
--- a/sample/sample.iml
+++ b/sample/sample.iml
@@ -4,6 +4,8 @@
+
+
@@ -18,30 +20,27 @@
+
-
-
+
+
-
-
-
+
+
-
-
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
@@ -70,13 +69,6 @@
-
-
-
-
-
-
-
@@ -84,41 +76,59 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sample/src/main/java/net/alhazmy13/hijridatepickerexample/GregorianDatePickerFragment.java b/sample/src/main/java/net/alhazmy13/hijridatepickerexample/GregorianDatePickerFragment.java
index b0816fd..1be13a4 100644
--- a/sample/src/main/java/net/alhazmy13/hijridatepickerexample/GregorianDatePickerFragment.java
+++ b/sample/src/main/java/net/alhazmy13/hijridatepickerexample/GregorianDatePickerFragment.java
@@ -1,16 +1,17 @@
package net.alhazmy13.hijridatepickerexample;
-import android.app.Fragment;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;
+import androidx.fragment.app.Fragment;
+
+import com.google.android.material.button.MaterialButton;
import net.alhazmy13.hijridatepicker.date.gregorian.GregorianDatePickerDialog;
@@ -44,17 +45,17 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
View view = inflater.inflate(R.layout.datepicker_layout, container, false);
// Find our View instances
- dateTextView = (TextView) view.findViewById(R.id.date_textview);
- Button dateButton = (Button) view.findViewById(R.id.date_button);
- modeDarkDate = (CheckBox) view.findViewById(R.id.mode_dark_date);
- modeCustomAccentDate = (CheckBox) view.findViewById(R.id.mode_custom_accent_date);
- vibrateDate = (CheckBox) view.findViewById(R.id.vibrate_date);
- dismissDate = (CheckBox) view.findViewById(R.id.dismiss_date);
- titleDate = (CheckBox) view.findViewById(R.id.title_date);
- showYearFirst = (CheckBox) view.findViewById(R.id.show_year_first);
- showVersion2 = (CheckBox) view.findViewById(R.id.show_version_2);
- limitSelectableDays = (CheckBox) view.findViewById(R.id.limit_dates);
- highlightDays = (CheckBox) view.findViewById(R.id.highlight_dates);
+ dateTextView = view.findViewById(R.id.date_textview);
+ MaterialButton dateButton = view.findViewById(R.id.date_button);
+ modeDarkDate = view.findViewById(R.id.mode_dark_date);
+ modeCustomAccentDate = view.findViewById(R.id.mode_custom_accent_date);
+ vibrateDate = view.findViewById(R.id.vibrate_date);
+ dismissDate = view.findViewById(R.id.dismiss_date);
+ titleDate = view.findViewById(R.id.title_date);
+ showYearFirst = view.findViewById(R.id.show_year_first);
+ showVersion2 = view.findViewById(R.id.show_version_2);
+ limitSelectableDays = view.findViewById(R.id.limit_dates);
+ highlightDays = view.findViewById(R.id.highlight_dates);
// Show a datepicker when the dateButton is clicked
dateButton.setOnClickListener(new View.OnClickListener() {
@@ -98,6 +99,7 @@ public void onClick(View v) {
}
//Change the language to any of supported language
dpd.setLocale(new Locale("ar"));
+ assert getFragmentManager() != null;
dpd.show(getFragmentManager(), "Datepickerdialog");
}
});
@@ -108,15 +110,15 @@ public void onClick(View v) {
@Override
public void onResume() {
super.onResume();
+ assert getFragmentManager() != null;
GregorianDatePickerDialog dpd = (GregorianDatePickerDialog) getFragmentManager().findFragmentByTag("Datepickerdialog");
- if(dpd != null) dpd.setOnDateSetListener(this);
+ if (dpd != null) dpd.setOnDateSetListener(this);
}
-
@Override
public void onDateSet(GregorianDatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
- String date = "You picked the following date: "+dayOfMonth+"/"+(++monthOfYear)+"/"+year;
+ String date = "You picked the following date: " + dayOfMonth + "/" + (++monthOfYear) + "/" + year;
dateTextView.setText(date);
}
}
diff --git a/sample/src/main/java/net/alhazmy13/hijridatepickerexample/HijriDatePickerFragment.java b/sample/src/main/java/net/alhazmy13/hijridatepickerexample/HijriDatePickerFragment.java
index 01ae84e..cb2084a 100644
--- a/sample/src/main/java/net/alhazmy13/hijridatepickerexample/HijriDatePickerFragment.java
+++ b/sample/src/main/java/net/alhazmy13/hijridatepickerexample/HijriDatePickerFragment.java
@@ -1,16 +1,17 @@
package net.alhazmy13.hijridatepickerexample;
-import android.app.Fragment;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;
+import androidx.fragment.app.Fragment;
+
import com.github.msarhan.ummalqura.calendar.UmmalquraCalendar;
+import com.google.android.material.button.MaterialButton;
import net.alhazmy13.hijridatepicker.date.hijri.HijriDatePickerDialog;
@@ -44,17 +45,17 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
View view = inflater.inflate(R.layout.datepicker_layout, container, false);
// Find our View instances
- dateTextView = (TextView) view.findViewById(R.id.date_textview);
- Button dateButton = (Button) view.findViewById(R.id.date_button);
- modeDarkDate = (CheckBox) view.findViewById(R.id.mode_dark_date);
- modeCustomAccentDate = (CheckBox) view.findViewById(R.id.mode_custom_accent_date);
- vibrateDate = (CheckBox) view.findViewById(R.id.vibrate_date);
- dismissDate = (CheckBox) view.findViewById(R.id.dismiss_date);
- titleDate = (CheckBox) view.findViewById(R.id.title_date);
- showYearFirst = (CheckBox) view.findViewById(R.id.show_year_first);
- showVersion2 = (CheckBox) view.findViewById(R.id.show_version_2);
- limitSelectableDays = (CheckBox) view.findViewById(R.id.limit_dates);
- highlightDays = (CheckBox) view.findViewById(R.id.highlight_dates);
+ dateTextView = view.findViewById(R.id.date_textview);
+ MaterialButton dateButton = view.findViewById(R.id.date_button);
+ modeDarkDate = view.findViewById(R.id.mode_dark_date);
+ modeCustomAccentDate = view.findViewById(R.id.mode_custom_accent_date);
+ vibrateDate = view.findViewById(R.id.vibrate_date);
+ dismissDate = view.findViewById(R.id.dismiss_date);
+ titleDate = view.findViewById(R.id.title_date);
+ showYearFirst = view.findViewById(R.id.show_year_first);
+ showVersion2 = view.findViewById(R.id.show_version_2);
+ limitSelectableDays = view.findViewById(R.id.limit_dates);
+ highlightDays = view.findViewById(R.id.highlight_dates);
// Show a datepicker when the dateButton is clicked
dateButton.setOnClickListener(new View.OnClickListener() {
@@ -98,6 +99,7 @@ public void onClick(View v) {
}
//Change the language to any of supported language
dpd.setLocale(new Locale("ar"));
+ assert getFragmentManager() != null;
dpd.show(getFragmentManager(), "Datepickerdialog");
}
});
@@ -108,6 +110,7 @@ public void onClick(View v) {
@Override
public void onResume() {
super.onResume();
+ assert getFragmentManager() != null;
HijriDatePickerDialog dpd = (HijriDatePickerDialog) getFragmentManager().findFragmentByTag("Datepickerdialog");
if (dpd != null) dpd.setOnDateSetListener(this);
}
diff --git a/sample/src/main/java/net/alhazmy13/hijridatepickerexample/MainActivity.java b/sample/src/main/java/net/alhazmy13/hijridatepickerexample/MainActivity.java
index 0bfcf77..e697fc5 100644
--- a/sample/src/main/java/net/alhazmy13/hijridatepickerexample/MainActivity.java
+++ b/sample/src/main/java/net/alhazmy13/hijridatepickerexample/MainActivity.java
@@ -1,16 +1,17 @@
package net.alhazmy13.hijridatepickerexample;
import android.os.Bundle;
-import android.support.design.widget.TabLayout;
-import android.app.Fragment;
-import android.app.FragmentManager;
-import android.support.v4.view.ViewPager;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.Toolbar;
-import android.support.v13.app.FragmentPagerAdapter;
-public class MainActivity extends AppCompatActivity
-{
+import com.google.android.material.tabs.TabLayout;
+
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentPagerAdapter;
+import androidx.viewpager.widget.ViewPager;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+
+public class MainActivity extends AppCompatActivity {
ViewPager viewPager;
PickerAdapter adapter;
@@ -18,18 +19,18 @@ public class MainActivity extends AppCompatActivity
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
-
- adapter = new PickerAdapter(getFragmentManager());
+ adapter = new PickerAdapter(getSupportFragmentManager());
viewPager = (ViewPager) findViewById(R.id.pager);
viewPager.setAdapter(adapter);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
- for(int i=0;i
-
-
-
-
+
-
-
+
diff --git a/sample/src/main/res/layout/datepicker_layout.xml b/sample/src/main/res/layout/datepicker_layout.xml
index fb6eeb0..9eeef22 100644
--- a/sample/src/main/res/layout/datepicker_layout.xml
+++ b/sample/src/main/res/layout/datepicker_layout.xml
@@ -1,5 +1,5 @@
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/sample/src/main/res/layout/timepicker_layout.xml b/sample/src/main/res/layout/timepicker_layout.xml
index 4644390..cb67617 100644
--- a/sample/src/main/res/layout/timepicker_layout.xml
+++ b/sample/src/main/res/layout/timepicker_layout.xml
@@ -1,5 +1,5 @@
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/sample/src/main/res/values/styles.xml b/sample/src/main/res/values/styles.xml
index 3090e03..b465e80 100644
--- a/sample/src/main/res/values/styles.xml
+++ b/sample/src/main/res/values/styles.xml
@@ -1,7 +1,7 @@
-