Skip to content

Commit

Permalink
Merge branch 'androidx'
Browse files Browse the repository at this point in the history
  • Loading branch information
gregkorossy committed Sep 25, 2018
2 parents 02c6e70 + fc43339 commit 63f5dae
Show file tree
Hide file tree
Showing 31 changed files with 196 additions and 100 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Material DatePicker and TimePicker dialogs from the Android framework package
# Material DatePicker and TimePicker dialogs from the Android framework package with AndroidX

This project is ported from the [Android framework](https://android.googlesource.com/platform/frameworks/base/). In order to make the pickers material themed on older devices (pre-Lollipop), the appcompat library is used for base theming and vector drawable handling. The widgets _always_ use the custom layouts, this is a complete replacement for the framework pickers. This also means that they have the same look-and-feel on all API levels.

[ ![Download](https://api.bintray.com/packages/gericop/maven/com.takisoft.fix%3Adatetimepicker/images/download.svg) ](https://bintray.com/gericop/maven/com.takisoft.fix%3Adatetimepicker/_latestVersion)
[ ![Download](https://api.bintray.com/packages/takisoft/android/com.takisoft.datetimepicker%3Adatetimepicker/images/download.svg) ](https://bintray.com/takisoft/android/com.takisoft.datetimepicker%3Adatetimepicker/_latestVersion)

### Donation

Expand All @@ -15,7 +15,7 @@ If you would like to support me, you may donate some small amount via PayPal.
## Setup
**Add** this single line to your gradle file:
```gradle
compile 'com.takisoft.fix:datetimepicker:1.0.7'
implementation 'com.takisoft.datetimepicker:datetimepicker:1.0.0'
```
And **use** one of the `Theme.AppCompat` themes (_or a custom one based on that_) as your `Activity`'s theme.

Expand All @@ -26,6 +26,8 @@ Now you can use the following material themed picker dialogs:

Additionally you could _technically_ use `DatePicker` and `TimePicker` from the `com.takisoft.datetimepicker.widget` package inside a layout as an inline view, however, they do not support scrolling containers, so it's recommended to stick with the dialogs instead.

> This lib now uses AndroidX. If you don't want / can't migrate to AndroidX yet, check out the `old-support` branch.
---

## Customization
Expand Down
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:appcompat-v7:${rootProject.supportLibraryVersion}"
implementation "com.android.support:design:${rootProject.supportLibraryVersion}"
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'

implementation project(':datetimepicker')
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.takisoft.datetimepicker.sample;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatActivity;
import android.text.format.DateFormat;
import android.widget.Toast;

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
Expand Down Expand Up @@ -30,4 +30,4 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnDateFragment" />

</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
53 changes: 53 additions & 0 deletions bintrayv.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
apply plugin: 'com.jfrog.bintray'

version = libraryVersion

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives javadocJar
archives sourcesJar
}

// Bintray
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")

configurations = ['archives']
pkg {
repo = bintrayRepo
name = bintrayName
userOrg = bintrayUserOrg
desc = libraryDescription
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = allLicenses
publish = true
publicDownloadNumbers = true
version {
desc = libraryDescription
gpg {
sign = true //Determines whether to GPG sign the files. The default is false
passphrase = properties.getProperty("bintray.gpg.password")
//Optional. The passphrase for GPG signing'
}
}
}
}
9 changes: 3 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
project.ext.buildToolsVersion = '28.0.2'
project.ext.buildToolsVersion = '28.0.3'
project.ext.minSdkVersion = 14
project.ext.sdkVersion = 28
project.ext.supportLibraryVersion = '28.0.0'
project.ext.supportLibraryVersionPrefix = '28.0.0'
project.ext.supportLibraryVersionSuffix = ''

project.ext.libVersion = "1.0.7$rootProject.supportLibraryVersionSuffix"
project.ext.libVersion = "1.0.0"

buildscript {

Expand All @@ -15,7 +12,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-rc03'
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'

Expand Down
27 changes: 15 additions & 12 deletions datetimepicker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android {
versionCode 1
versionName rootProject.libVersion

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
Expand All @@ -26,11 +26,12 @@ android {
}

ext {
bintrayRepo = 'maven'
bintrayName = 'com.takisoft.fix:datetimepicker'
bintrayUserOrg = 'takisoft'
bintrayRepo = 'android'
bintrayName = 'com.takisoft.datetimepicker:datetimepicker'

publishedGroupId = 'com.takisoft.fix'
libraryName = 'Material DateTimePickers'
publishedGroupId = 'com.takisoft.datetimepicker'
libraryName = 'Material DateTimePickers with AndroidX'
artifact = 'datetimepicker'

libraryDescription = 'The framework version of the material date / time pickers of Android ported back to API 14. This library uses the AppCompat library to provide the necessary functions for new features, such as vector drawables and material design.'
Expand All @@ -46,19 +47,21 @@ ext {

licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0", "Unlicense"]
allLicenses = ["Apache-2.0"]
}

dependencies {
api "com.android.support:appcompat-v7:${rootProject.supportLibraryVersion}"
implementation "com.android.support:support-dynamic-animation:${rootProject.supportLibraryVersion}"
api 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.dynamicanimation:dynamicanimation:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
}

apply from: 'https://raw.githubusercontent.com/numetriclabz/jcenter/master/installv.gradle'
apply from: 'https://raw.githubusercontent.com/numetriclabz/jcenter/master/bintrayv.gradle'
//apply from: 'https://raw.githubusercontent.com/numetriclabz/jcenter/master/installv.gradle'
//apply from: 'https://raw.githubusercontent.com/numetriclabz/jcenter/master/bintrayv.gradle'
apply from: '../installv.gradle'
apply from: '../bintrayv.gradle'

javadoc.doFirst {
failOnError false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.takisoft.datetimepicker;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import android.text.TextUtils;
import android.text.format.DateFormat;
import android.util.Log;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StyleRes;
import android.support.v7.app.AlertDialog;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StyleRes;
import androidx.appcompat.app.AlertDialog;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import androidx.appcompat.app.AlertDialog;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import android.content.Context;
import android.os.Build;
import android.support.annotation.VisibleForTesting;
import androidx.annotation.VisibleForTesting;
import android.text.format.DateFormat;

import com.takisoft.datetimepicker.R;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Parcel;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v7.content.res.AppCompatResources;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.appcompat.content.res.AppCompatResources;

import com.takisoft.datetimepicker.R;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
import android.graphics.drawable.Drawable;
import android.icu.util.TimeZone;
import android.os.Build;
import android.support.annotation.AttrRes;
import android.support.annotation.ColorInt;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StyleRes;
import androidx.annotation.AttrRes;
import androidx.annotation.ColorInt;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StyleRes;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.FrameLayout;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import android.content.Context;
import android.os.Build;
import android.support.annotation.StyleRes;
import androidx.annotation.StyleRes;
import android.util.AttributeSet;

import com.takisoft.datetimepicker.widget.DayPickerView.OnDaySelectedListener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.IntDef;
import android.support.annotation.Nullable;
import androidx.annotation.IntDef;
import androidx.annotation.Nullable;
import android.util.AttributeSet;
import android.util.SparseArray;
import android.view.View;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import android.icu.text.SimpleDateFormat;
import android.os.Build;
import android.os.Parcelable;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import android.text.format.DateUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import android.content.res.TypedArray;
import android.os.Build;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import android.text.InputType;
import android.text.TextUtils;
import android.text.format.DateUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.os.Build;
import android.support.annotation.IdRes;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.view.PagerAdapter;
import androidx.annotation.IdRes;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.viewpager.widget.PagerAdapter;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.takisoft.datetimepicker.R;
import com.takisoft.datetimepicker.util.Utils;
import com.takisoft.datetimepicker.widget.SimpleMonthView.OnDayClickListener;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.os.Build;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPager;
import android.support.v7.content.res.AppCompatResources;
import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat;
import androidx.viewpager.widget.ViewPager;
import androidx.appcompat.content.res.AppCompatResources;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.v4.view.ViewPager;
import androidx.viewpager.widget.ViewPager;
import android.util.AttributeSet;
import android.view.View;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.CallSuper;
import android.support.annotation.IntDef;
import android.support.annotation.Keep;
import android.support.annotation.Nullable;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.accessibility.AccessibilityEventCompat;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
import android.support.v4.view.accessibility.AccessibilityRecordCompat;
import androidx.annotation.CallSuper;
import androidx.annotation.IntDef;
import androidx.annotation.Keep;
import androidx.annotation.Nullable;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.view.ViewCompat;
import androidx.core.view.accessibility.AccessibilityEventCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import androidx.core.view.accessibility.AccessibilityRecordCompat;
import android.text.InputFilter;
import android.text.InputType;
import android.text.Spanned;
Expand Down Expand Up @@ -2409,7 +2409,7 @@ public void run() {
}

@Keep
public static class CustomEditText extends android.support.v7.widget.AppCompatEditText {
public static class CustomEditText extends androidx.appcompat.widget.AppCompatEditText {

public CustomEditText(Context context, AttributeSet attrs) {
super(context, attrs);
Expand Down
Loading

0 comments on commit 63f5dae

Please sign in to comment.