Skip to content

Commit

Permalink
Upgrade min-sdk version to 21, migrate to androidx
Browse files Browse the repository at this point in the history
  • Loading branch information
alhazmy13 committed May 1, 2020
1 parent 767f734 commit 64c4f62
Show file tree
Hide file tree
Showing 37 changed files with 392 additions and 323 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
---- | ----
Expand All @@ -21,22 +21,22 @@ 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
<dependency>
<groupId>net.alhazmy13.hijridatepicker</groupId>
<artifactId>library</artifactId>
<version>2.0.2</version>
<version>3.0.0</version>
</dependency>
```
**Gradle**

```gradle
dependencies {
compile 'net.alhazmy13.hijridatepicker:library:2.1.0'
compile 'net.alhazmy13.hijridatepicker:library:3.0.0'
}
```

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
18 changes: 10 additions & 8 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ 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'
}


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"
}
Expand All @@ -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'

}
Expand Down
135 changes: 73 additions & 62 deletions library/library.iml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,27 @@

package net.alhazmy13.hijridatepicker.date.gregorian;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Canvas;
import android.graphics.Color;
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;

Expand Down Expand Up @@ -103,6 +106,7 @@ public void onDraw(@NonNull Canvas canvas) {
super.onDraw(canvas);
}

@SuppressLint("GetContentDescriptionOverride")
@Override
public CharSequence getContentDescription() {
CharSequence itemText = getText();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Loading

0 comments on commit 64c4f62

Please sign in to comment.