From d5470217166b2816b4be19fee355624d95ebe11c Mon Sep 17 00:00:00 2001 From: Kosh Date: Sat, 21 Jan 2017 09:14:59 +0800 Subject: [PATCH] merged #3 and released v1.0.2 --- README.md | 9 ++------- app/build.gradle | 11 ++++++----- .../datetimepicker/sample/MainActivity.java | 16 ++++++++-------- .../datetimepicker/sample/SampleFragment.java | 16 ++++++++-------- .../datetimepicker/sample/SampleHelper.java | 4 ++++ build.gradle | 2 +- datetimepicker/build.gradle | 4 ++-- .../datetimepicker/DateTimeBuilder.java | 9 +++++++++ gradle.properties | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 10 files changed, 44 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index a24edba..1e85ada 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Android Library to help you with your date & time pickers while retaining the in #### Gradle ```groovy -compile 'com.github.k0shk0sh:RetainedDateTimePickers:1.0.1' +compile 'com.github.k0shk0sh:RetainedDateTimePickers:1.0.2' ``` #### Maven @@ -13,7 +13,7 @@ compile 'com.github.k0shk0sh:RetainedDateTimePickers:1.0.1' com.github.k0shk0sh RetainedDateTimePickers - 1.0.1 + 1.0.2 aar ``` @@ -80,11 +80,6 @@ Screenshots -TODO -===== - -- ~~To supports `ParentFragment` (very soon).~~ - # Why this library? * DatePickerDialog & TimePickerDialog are not retained on orientation change, you'd do a lot of work to retain them, this library simplify that. diff --git a/app/build.gradle b/app/build.gradle index 7222e3e..212d1fc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,12 +2,13 @@ apply plugin: 'com.android.application' apply plugin: 'com.neenbedankt.android-apt' android { - compileSdkVersion 24 - buildToolsVersion "24.0.2" + compileSdkVersion 25 + buildToolsVersion '25.0.2' + defaultConfig { applicationId "com.fastaccess.datetimepicker.sample" minSdkVersion 16 - targetSdkVersion 24 + targetSdkVersion 25 versionCode 1 versionName "1.0" } @@ -21,8 +22,8 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:24.2.1' - compile 'com.android.support:design:24.2.1' + compile 'com.android.support:appcompat-v7:25.1.0' + compile 'com.android.support:design:25.1.0' compile 'com.jakewharton:butterknife:8.4.0' apt 'com.jakewharton:butterknife-compiler:8.4.0' compile project(':datetimepicker') diff --git a/app/src/main/java/com/fastaccess/datetimepicker/sample/MainActivity.java b/app/src/main/java/com/fastaccess/datetimepicker/sample/MainActivity.java index 254e155..99130f3 100644 --- a/app/src/main/java/com/fastaccess/datetimepicker/sample/MainActivity.java +++ b/app/src/main/java/com/fastaccess/datetimepicker/sample/MainActivity.java @@ -44,28 +44,28 @@ void onClick(View view) { maxDate.set(2016, minDate.get(Calendar.MONTH) + 1, minDate.get(Calendar.DAY_OF_MONTH)); switch (view.getId()) { case R.id.datePickerOnly: - DatePickerFragmentDialog.newInstance().show(getSupportFragmentManager(), "DatePickerFragmentDialog"); + DatePickerFragmentDialog.newInstance().show(getSupportFragmentManager(), SampleHelper.DATE_PICKER_FRAGMENT_DIALOG); break; case R.id.datePickerMinMaxPicker: - DatePickerFragmentDialog.newInstance(DateTimeBuilder.get() + DatePickerFragmentDialog.newInstance(DateTimeBuilder.newInstance() .withMinDate(minDate.getTimeInMillis()) .withMaxDate(maxDate.getTimeInMillis())) - .show(getSupportFragmentManager(), "DatePickerFragmentDialog"); + .show(getSupportFragmentManager(), SampleHelper.DATE_PICKER_FRAGMENT_DIALOG); break; case R.id.timePickerOnly: - TimePickerFragmentDialog.newInstance().show(getSupportFragmentManager(), "TimePickerFragmentDialog"); + TimePickerFragmentDialog.newInstance().show(getSupportFragmentManager(), SampleHelper.TIME_PICKER_FRAGMENT_DIALOG); break; case R.id.timePickerOnly24Hours: - TimePickerFragmentDialog.newInstance(true).show(getSupportFragmentManager(), "TimePickerFragmentDialog"); + TimePickerFragmentDialog.newInstance(true).show(getSupportFragmentManager(), SampleHelper.TIME_PICKER_FRAGMENT_DIALOG); break; case R.id.dateAndTimePicker: - DatePickerFragmentDialog.newInstance(true).show(getSupportFragmentManager(), "DatePickerFragmentDialog"); + DatePickerFragmentDialog.newInstance(true).show(getSupportFragmentManager(), SampleHelper.DATE_PICKER_FRAGMENT_DIALOG); break; case R.id.ultimatePicker: Calendar currentDate = Calendar.getInstance(); currentDate.set(2016, currentDate.get(Calendar.MONTH) + 1, currentDate.get(Calendar.DAY_OF_MONTH)); DatePickerFragmentDialog.newInstance( - DateTimeBuilder.get() + DateTimeBuilder.newInstance() .withTime(true) .with24Hours(true) .withSelectedDate(currentDate.getTimeInMillis()) @@ -74,7 +74,7 @@ void onClick(View view) { .withCurrentHour(12) .withCurrentMinute(30) .withTheme(R.style.PickersTheme)) - .show(getSupportFragmentManager(), "DatePickerFragmentDialog"); + .show(getSupportFragmentManager(), SampleHelper.DATE_PICKER_FRAGMENT_DIALOG); break; case R.id.fromFragment: getSupportFragmentManager().beginTransaction() diff --git a/app/src/main/java/com/fastaccess/datetimepicker/sample/SampleFragment.java b/app/src/main/java/com/fastaccess/datetimepicker/sample/SampleFragment.java index 7f419ac..e7fb8c8 100644 --- a/app/src/main/java/com/fastaccess/datetimepicker/sample/SampleFragment.java +++ b/app/src/main/java/com/fastaccess/datetimepicker/sample/SampleFragment.java @@ -44,28 +44,28 @@ void onClick(View view) { maxDate.set(2016, minDate.get(Calendar.MONTH) + 1, minDate.get(Calendar.DAY_OF_MONTH)); switch (view.getId()) { case R.id.datePickerOnly: - DatePickerFragmentDialog.newInstance().show(getChildFragmentManager(), "DatePickerFragmentDialog"); + DatePickerFragmentDialog.newInstance().show(getChildFragmentManager(), SampleHelper.DATE_PICKER_FRAGMENT_DIALOG); break; case R.id.datePickerMinMaxPicker: - DatePickerFragmentDialog.newInstance(DateTimeBuilder.get() + DatePickerFragmentDialog.newInstance(DateTimeBuilder.newInstance() .withMinDate(minDate.getTimeInMillis()) .withMaxDate(maxDate.getTimeInMillis())) - .show(getChildFragmentManager(), "DatePickerFragmentDialog"); + .show(getChildFragmentManager(), SampleHelper.DATE_PICKER_FRAGMENT_DIALOG); break; case R.id.timePickerOnly: - TimePickerFragmentDialog.newInstance().show(getChildFragmentManager(), "TimePickerFragmentDialog"); + TimePickerFragmentDialog.newInstance().show(getChildFragmentManager(), SampleHelper.TIME_PICKER_FRAGMENT_DIALOG); break; case R.id.timePickerOnly24Hours: - TimePickerFragmentDialog.newInstance(true).show(getChildFragmentManager(), "TimePickerFragmentDialog"); + TimePickerFragmentDialog.newInstance(true).show(getChildFragmentManager(), SampleHelper.TIME_PICKER_FRAGMENT_DIALOG); break; case R.id.dateAndTimePicker: - DatePickerFragmentDialog.newInstance(true).show(getChildFragmentManager(), "DatePickerFragmentDialog"); + DatePickerFragmentDialog.newInstance(true).show(getChildFragmentManager(), SampleHelper.DATE_PICKER_FRAGMENT_DIALOG); break; case R.id.ultimatePicker: Calendar currentDate = Calendar.getInstance(); currentDate.set(2016, currentDate.get(Calendar.MONTH) + 1, currentDate.get(Calendar.DAY_OF_MONTH)); DatePickerFragmentDialog.newInstance( - DateTimeBuilder.get() + DateTimeBuilder.newInstance() .withTime(true) .with24Hours(true) .withSelectedDate(currentDate.getTimeInMillis()) @@ -74,7 +74,7 @@ void onClick(View view) { .withCurrentHour(12) .withCurrentMinute(30) .withTheme(R.style.PickersTheme)) - .show(getChildFragmentManager(), "DatePickerFragmentDialog"); + .show(getChildFragmentManager(), SampleHelper.DATE_PICKER_FRAGMENT_DIALOG); break; } } diff --git a/app/src/main/java/com/fastaccess/datetimepicker/sample/SampleHelper.java b/app/src/main/java/com/fastaccess/datetimepicker/sample/SampleHelper.java index 8024123..17cba7f 100644 --- a/app/src/main/java/com/fastaccess/datetimepicker/sample/SampleHelper.java +++ b/app/src/main/java/com/fastaccess/datetimepicker/sample/SampleHelper.java @@ -10,6 +10,10 @@ public class SampleHelper { + public static final String DATE_PICKER_FRAGMENT_DIALOG = "DatePickerFragmentDialog"; + public static final String TIME_PICKER_FRAGMENT_DIALOG = "TimePickerFragmentDialog"; + + public static String getDateOnly(long time) { return new SimpleDateFormat("dd MMM yyyy", Locale.getDefault()).format(time); } diff --git a/build.gradle b/build.gradle index aeba529..b88f9c3 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.2.3' + classpath 'com.android.tools.build:gradle:2.3.0-beta2' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/datetimepicker/build.gradle b/datetimepicker/build.gradle index 2d4e2e3..e7fae05 100644 --- a/datetimepicker/build.gradle +++ b/datetimepicker/build.gradle @@ -8,8 +8,8 @@ android { defaultConfig { minSdkVersion 16 targetSdkVersion 25 - versionCode 11 - versionName "1.0.1" + versionCode 102 + versionName "1.0.2" } buildTypes { release { diff --git a/datetimepicker/src/main/java/com/fastaccess/datetimepicker/DateTimeBuilder.java b/datetimepicker/src/main/java/com/fastaccess/datetimepicker/DateTimeBuilder.java index 78ef98a..5cc5455 100644 --- a/datetimepicker/src/main/java/com/fastaccess/datetimepicker/DateTimeBuilder.java +++ b/datetimepicker/src/main/java/com/fastaccess/datetimepicker/DateTimeBuilder.java @@ -18,7 +18,16 @@ public class DateTimeBuilder implements Parcelable { private int currentMinute; private int themeResId; + /** + * Use newInstance instead for naming convention + * return new Instance + */ + @Deprecated public static DateTimeBuilder get() { + return newInstance(); + } + + public static DateTimeBuilder newInstance() { return new DateTimeBuilder().withCurrentHour(-1).withCurrentMinute(-1); } diff --git a/gradle.properties b/gradle.properties index 4d06535..516d09e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ -VERSION_NAME=1.0.1 -VERSION_CODE=11 +VERSION_NAME=1.0.2 +VERSION_CODE=102 GROUP=com.github.k0shk0sh POM_DESCRIPTION=Android Library to help you with your date & time pickers while retaining the instance of the pickers on orientation change. POM_URL=https://github.com/k0shk0sh/RetainedDateTimePickers diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 04e285f..1175b8d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Dec 28 10:00:20 PST 2015 +#Sat Jan 21 08:27:16 MYT 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip