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"> -