From 0ac4b884ff115b252d349a5a9dab8ff1505f010d Mon Sep 17 00:00:00 2001 From: Shreyas Date: Fri, 12 Feb 2021 18:55:53 +0530 Subject: [PATCH 01/10] Upgrade gradle plugin and version and remove bintray deps --- MaterialDialogLibrary/build.gradle | 2 -- build.gradle | 8 +------- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/MaterialDialogLibrary/build.gradle b/MaterialDialogLibrary/build.gradle index 3742b51..f55fcdf 100644 --- a/MaterialDialogLibrary/build.gradle +++ b/MaterialDialogLibrary/build.gradle @@ -1,6 +1,4 @@ apply plugin: 'com.android.library' -apply plugin: 'com.github.dcendents.android-maven' -apply plugin: "com.jfrog.bintray" version = "2.1" diff --git a/build.gradle b/build.gradle index 87c06c0..466da58 100644 --- a/build.gradle +++ b/build.gradle @@ -7,13 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.5.3' - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' - classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0' + classpath 'com.android.tools.build:gradle:4.1.2' } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2124f08..ebd91fc 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Dec 09 14:52:24 IST 2019 +#Fri Feb 12 18:52:11 IST 2021 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip From 202b071504b20b1c6574a04936aeaecfd757ff6b Mon Sep 17 00:00:00 2001 From: Shreyas Date: Fri, 12 Feb 2021 18:56:39 +0530 Subject: [PATCH 02/10] Add maven publish plugin --- build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.gradle b/build.gradle index 466da58..0fadb08 100644 --- a/build.gradle +++ b/build.gradle @@ -8,6 +8,8 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:4.1.2' + + classpath 'com.vanniktech:gradle-maven-publish-plugin:0.14.1' } } From a36594670af1f4405f4c865acfd5980c4140290a Mon Sep 17 00:00:00 2001 From: Shreyas Date: Fri, 12 Feb 2021 22:41:11 +0530 Subject: [PATCH 03/10] Remove old publishing configuration --- MaterialDialogLibrary/build.gradle | 134 ++--------------------------- app/build.gradle | 8 +- build.gradle | 4 +- 3 files changed, 15 insertions(+), 131 deletions(-) diff --git a/MaterialDialogLibrary/build.gradle b/MaterialDialogLibrary/build.gradle index f55fcdf..005ee81 100644 --- a/MaterialDialogLibrary/build.gradle +++ b/MaterialDialogLibrary/build.gradle @@ -1,14 +1,14 @@ apply plugin: 'com.android.library' -version = "2.1" +version = "2.1.0" android { - compileSdkVersion 29 + compileSdkVersion 30 defaultConfig { minSdkVersion 19 - targetSdkVersion 29 - versionCode 1 + targetSdkVersion 30 + versionCode 2 versionName version testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -26,135 +26,19 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'androidx.appcompat:appcompat:1.1.0' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.annotation:annotation:1.1.0' // Material Design Library - implementation 'com.google.android.material:material:1.0.0' + implementation 'com.google.android.material:material:1.3.0' // Lottie Animation Library - implementation 'com.airbnb.android:lottie:3.3.0' + implementation 'com.airbnb.android:lottie:3.6.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' } -ext { - bintrayRepo = 'maven' - bintrayName = 'MaterialDialog' - publishedGroupId = 'com.shreyaspatil' - libraryName = 'MaterialDialog' - artifact = 'MaterialDialog' - libraryDescription = 'Android Library to implement animated, beautiful, stylish Material Dialog in android apps easily.' - - - // Your github repo link - siteUrl = 'https://github.com/patilshreyas/MaterialDialog-Android' - gitUrl = 'https://github.com/patilshreyas/MaterialDialog-Android.git' - githubRepository= 'patilshreyas/MaterialDialog' - - libraryVersion = version - - developerId = 'patilshreyas' - developerName = 'Shreyas Patil' - developerEmail = 'shreyaspatilg@gmail.com' - - licenseName = 'The Apache Software License, Version 2.0' - licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - allLicenses = ["Apache-2.0"] -} - -group = publishedGroupId -def siteUrl = 'https://github.com/PatilShreyas/MaterialDialog-Android' // Homepage URL of the library -def gitUrl = 'https://github.com/PatilShreyas/MaterialDialog-Android.git' // Git repository URL // Maven Group ID for the artifact - -install { - repositories.mavenInstaller { - // This generates POM.xml with proper parameters - pom { - project { - packaging 'aar' - - // Add your description here - groupId 'com.shreyaspatil' - artifactId = 'MaterialDialog' - name 'MaterialDialog' - description = 'Android Library to implement animated, beautiful, stylish Material Dialog in android apps easily.' - url siteUrl - - // Set your license - licenses { - license { - name 'The Apache Software License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' - } - } - developers { - developer { - id 'PatilShreyas' // TODO - name 'Shreyas Patil' // TODO - email 'shreyaspatilg@gmail.com' // TODO - } - } - scm { - connection gitUrl - developerConnection gitUrl - url siteUrl - } - } - } - } -} - -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)) - options.addStringOption('Xdoclint:none', '-quiet') - options.addStringOption('encoding', 'UTF-8') - options.addStringOption('charSet', 'UTF-8') -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} -artifacts { - archives javadocJar - archives sourcesJar -} - -Properties properties = new Properties() -properties.load(project.rootProject.file('local.properties').newDataInputStream()) - -// https://github.com/bintray/gradle-bintray-plugin -bintray { - user = properties.getProperty("bintray.user") - key = properties.getProperty("bintray.apikey") - - configurations = ['archives'] - pkg { - repo = "maven" - // it is the name that appears in bintray when logged - name = "com.shreyaspatil:MaterialDialog" // TODO - websiteUrl = siteUrl - vcsUrl = gitUrl - licenses = ["Apache-2.0"] - publish = true - version { - 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' - } - } - } -} -apply plugin: 'com.android.library' -apply plugin: 'com.github.dcendents.android-maven' -apply plugin: 'com.jfrog.bintray' \ No newline at end of file +apply plugin: 'com.vanniktech.maven.publish' \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index d02a92c..0520280 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,11 +1,11 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 29 + compileSdkVersion 30 defaultConfig { applicationId "com.shreyaspatil.MaterialDialogExample" minSdkVersion 19 - targetSdkVersion 29 + targetSdkVersion 30 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -24,7 +24,7 @@ dependencies { implementation 'androidx.constraintlayout:constraintlayout:1.1.3' // Material Dialog Library - implementation 'com.shreyaspatil:MaterialDialog:2.1' +// implementation 'dev.shreyaspatil.MaterialDialog:MaterialDialog:2.1.0' // Material Design Library implementation 'com.google.android.material:material:1.3.0' @@ -35,5 +35,5 @@ dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' - //implementation project(path: ':MaterialDialogLibrary') + implementation project(path: ':MaterialDialogLibrary') } diff --git a/build.gradle b/build.gradle index 0fadb08..bbf3f40 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { repositories { google() jcenter() - + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:4.1.2' @@ -17,7 +17,7 @@ allprojects { repositories { google() jcenter() - + mavenCentral() } } From c77ff6a08d68ec941d0ad7a39e2e70ffc976afd3 Mon Sep 17 00:00:00 2001 From: Shreyas Date: Fri, 12 Feb 2021 22:42:13 +0530 Subject: [PATCH 04/10] Configure publishing options --- gradle.properties | 18 +++++++++++++++++- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 199d16e..e16935e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,4 +17,20 @@ org.gradle.jvmargs=-Xmx1536m android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX android.enableJetifier=true - +GROUP=dev.shreyaspatil +POM_ARTIFACT_ID=MaterialDialog +VERSION_NAME=2.1.1 +POM_NAME=MaterialDialog-Android +POM_DESCRIPTION=Android Library to implement animated, beautiful, stylish Material Dialog in android apps easily. +POM_INCEPTION_YEAR=2021 +POM_URL=https://github.com/PatilShreyas/MaterialDialog-Android +POM_SCM_URL=https://github.com/PatilShreyas/MaterialDialog-Android +POM_SCM_CONNECTION=scm:git:git://github.com/PatilShreyas/MaterialDialog-Android +POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/PatilShreyas/MaterialDialog-Android +POM_LICENCE_NAME=The Apache Software License, Version 2.0 +POM_LICENCE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt +POM_LICENCE_DIST=https://github.com/PatilShreyas/MaterialDialog-Android/blob/master/LICENSE +POM_DEVELOPER_ID=patilshreyas +POM_DEVELOPER_NAME=Shreyas Patil +POM_DEVELOPER_URL=https://github.com/patilshreyas/ +stagingRepository=21977676b1f14 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ebd91fc..2e29b41 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip \ No newline at end of file From 229d6d84c40029c3636745089bf709204152f1ff Mon Sep 17 00:00:00 2001 From: Shreyas Date: Fri, 12 Feb 2021 22:42:42 +0530 Subject: [PATCH 05/10] Move package from `com` to `dev` and fix docs --- .../ExampleInstrumentedTest.java | 2 +- .../src/main/AndroidManifest.xml | 3 +- .../MaterialDialog/AbstractDialog.java | 18 +++---- .../BottomSheetMaterialDialog.java | 13 ++--- .../MaterialDialog/MaterialDialog.java | 48 ++++++++++++------- .../interfaces/DialogInterface.java | 2 +- .../interfaces/OnCancelListener.java | 2 +- .../interfaces/OnDismissListener.java | 2 +- .../interfaces/OnShowListener.java | 2 +- .../MaterialDialog/model/DialogButton.java | 4 +- .../MaterialDialog/ExampleUnitTest.java | 4 +- .../ExampleInstrumentedTest.java | 2 +- app/src/main/AndroidManifest.xml | 4 +- .../MaterialDialogExample/MainActivity.java | 34 ++++++------- app/src/main/res/layout/activity_main.xml | 2 +- .../ExampleUnitTest.java | 4 +- 16 files changed, 81 insertions(+), 65 deletions(-) rename MaterialDialogLibrary/src/androidTest/java/{com => dev}/shreyaspatil/MaterialDialog/ExampleInstrumentedTest.java (94%) rename MaterialDialogLibrary/src/main/java/{com => dev}/shreyaspatil/MaterialDialog/AbstractDialog.java (95%) rename MaterialDialogLibrary/src/main/java/{com => dev}/shreyaspatil/MaterialDialog/BottomSheetMaterialDialog.java (96%) rename MaterialDialogLibrary/src/main/java/{com => dev}/shreyaspatil/MaterialDialog/MaterialDialog.java (80%) rename MaterialDialogLibrary/src/main/java/{com => dev}/shreyaspatil/MaterialDialog/interfaces/DialogInterface.java (59%) rename MaterialDialogLibrary/src/main/java/{com => dev}/shreyaspatil/MaterialDialog/interfaces/OnCancelListener.java (63%) rename MaterialDialogLibrary/src/main/java/{com => dev}/shreyaspatil/MaterialDialog/interfaces/OnDismissListener.java (64%) rename MaterialDialogLibrary/src/main/java/{com => dev}/shreyaspatil/MaterialDialog/interfaces/OnShowListener.java (62%) rename MaterialDialogLibrary/src/main/java/{com => dev}/shreyaspatil/MaterialDialog/model/DialogButton.java (84%) rename MaterialDialogLibrary/src/test/java/{com => dev}/shreyaspatil/MaterialDialog/ExampleUnitTest.java (78%) rename app/src/androidTest/java/{com => dev}/shreyaspatil/MaterialDialogExample/ExampleInstrumentedTest.java (93%) rename app/src/main/java/{com => dev}/shreyaspatil/MaterialDialogExample/MainActivity.java (85%) rename app/src/test/java/{com => dev}/shreyaspatil/MaterialDialogExample/ExampleUnitTest.java (77%) diff --git a/MaterialDialogLibrary/src/androidTest/java/com/shreyaspatil/MaterialDialog/ExampleInstrumentedTest.java b/MaterialDialogLibrary/src/androidTest/java/dev/shreyaspatil/MaterialDialog/ExampleInstrumentedTest.java similarity index 94% rename from MaterialDialogLibrary/src/androidTest/java/com/shreyaspatil/MaterialDialog/ExampleInstrumentedTest.java rename to MaterialDialogLibrary/src/androidTest/java/dev/shreyaspatil/MaterialDialog/ExampleInstrumentedTest.java index d43c7f5..5dd363b 100644 --- a/MaterialDialogLibrary/src/androidTest/java/com/shreyaspatil/MaterialDialog/ExampleInstrumentedTest.java +++ b/MaterialDialogLibrary/src/androidTest/java/dev/shreyaspatil/MaterialDialog/ExampleInstrumentedTest.java @@ -1,4 +1,4 @@ -package com.shreyaspatil.MaterialDialog; +package dev.shreyaspatil.MaterialDialog; import android.content.Context; diff --git a/MaterialDialogLibrary/src/main/AndroidManifest.xml b/MaterialDialogLibrary/src/main/AndroidManifest.xml index 9178660..8117570 100644 --- a/MaterialDialogLibrary/src/main/AndroidManifest.xml +++ b/MaterialDialogLibrary/src/main/AndroidManifest.xml @@ -1,2 +1 @@ - + diff --git a/MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/AbstractDialog.java b/MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/AbstractDialog.java similarity index 95% rename from MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/AbstractDialog.java rename to MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/AbstractDialog.java index 601e3ba..32c7a43 100644 --- a/MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/AbstractDialog.java +++ b/MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/AbstractDialog.java @@ -1,4 +1,4 @@ -package com.shreyaspatil.MaterialDialog; +package dev.shreyaspatil.MaterialDialog; import android.app.Activity; import android.app.Dialog; @@ -18,12 +18,14 @@ import com.airbnb.lottie.LottieAnimationView; import com.google.android.material.button.MaterialButton; -import com.shreyaspatil.MaterialDialog.interfaces.DialogInterface; -import com.shreyaspatil.MaterialDialog.interfaces.OnCancelListener; -import com.shreyaspatil.MaterialDialog.interfaces.OnDismissListener; -import com.shreyaspatil.MaterialDialog.interfaces.OnShowListener; -import com.shreyaspatil.MaterialDialog.model.DialogButton; +import dev.shreyaspatil.MaterialDialog.interfaces.DialogInterface; +import dev.shreyaspatil.MaterialDialog.interfaces.OnCancelListener; +import dev.shreyaspatil.MaterialDialog.interfaces.OnDismissListener; +import dev.shreyaspatil.MaterialDialog.interfaces.OnShowListener; +import dev.shreyaspatil.MaterialDialog.model.DialogButton; + +@SuppressWarnings("unused") public class AbstractDialog implements DialogInterface { //Constants @@ -99,7 +101,7 @@ protected View createView(@NonNull LayoutInflater inflater, @Nullable ViewGroup mPositiveButtonView.setVisibility(View.VISIBLE); mPositiveButtonView.setText(mPositiveButton.getTitle()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && mPositiveButton.getIcon() != NO_ICON) { - mPositiveButtonView.setIcon(mActivity.getDrawable(mPositiveButton.getIcon())); + mPositiveButtonView.setIcon(ContextCompat.getDrawable(mActivity, mPositiveButton.getIcon())); } mPositiveButtonView.setOnClickListener(new View.OnClickListener() { @@ -117,7 +119,7 @@ public void onClick(View view) { mNegativeButtonView.setVisibility(View.VISIBLE); mNegativeButtonView.setText(mNegativeButton.getTitle()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && mNegativeButton.getIcon() != NO_ICON) { - mNegativeButtonView.setIcon(mActivity.getDrawable(mNegativeButton.getIcon())); + mNegativeButtonView.setIcon(ContextCompat.getDrawable(mActivity, mNegativeButton.getIcon())); } mNegativeButtonView.setOnClickListener(new View.OnClickListener() { diff --git a/MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/BottomSheetMaterialDialog.java b/MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/BottomSheetMaterialDialog.java similarity index 96% rename from MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/BottomSheetMaterialDialog.java rename to MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/BottomSheetMaterialDialog.java index 0416db1..b9fb49a 100644 --- a/MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/BottomSheetMaterialDialog.java +++ b/MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/BottomSheetMaterialDialog.java @@ -1,4 +1,4 @@ -package com.shreyaspatil.MaterialDialog; +package dev.shreyaspatil.MaterialDialog; import android.app.Activity; import android.content.Context; @@ -16,13 +16,15 @@ import androidx.annotation.RawRes; import com.google.android.material.bottomsheet.BottomSheetBehavior; -import com.shreyaspatil.MaterialDialog.model.DialogButton; + +import dev.shreyaspatil.MaterialDialog.model.DialogButton; /** * Creates BottomSheet Material Dialog with 2 buttons. *

* Use {@link BottomSheetMaterialDialog.Builder} to create a new instance. */ +@SuppressWarnings("unused") public class BottomSheetMaterialDialog extends AbstractDialog { protected BottomSheetMaterialDialog(@NonNull final Activity mActivity, @@ -84,7 +86,7 @@ protected View createView(@NonNull LayoutInflater inflater, @Nullable ViewGroup * Builder for {@link BottomSheetMaterialDialog}. */ public static class Builder { - private Activity activity; + private final Activity activity; private String title; private String message; private boolean isCancelable; @@ -161,7 +163,7 @@ public Builder setPositiveButton(@NonNull String name, int icon, @NonNull OnClic * * @param name sets the name/label of button. * @param onClickListener interface for callback event on click of button. - * @see this, for chaining. + * @return this, for chaining. */ @NonNull public Builder setNegativeButton(@NonNull String name, @NonNull OnClickListener onClickListener) { @@ -215,8 +217,7 @@ public BottomSheetMaterialDialog build() { } } - class BottomSheetDialog extends com.google.android.material.bottomsheet.BottomSheetDialog { - + static class BottomSheetDialog extends com.google.android.material.bottomsheet.BottomSheetDialog { BottomSheetDialog(@NonNull Context context) { super(context, R.style.BottomSheetDialogTheme); } diff --git a/MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/MaterialDialog.java b/MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/MaterialDialog.java similarity index 80% rename from MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/MaterialDialog.java rename to MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/MaterialDialog.java index 453a872..c931728 100644 --- a/MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/MaterialDialog.java +++ b/MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/MaterialDialog.java @@ -1,4 +1,4 @@ -package com.shreyaspatil.MaterialDialog; +package dev.shreyaspatil.MaterialDialog; import android.app.Activity; import android.view.LayoutInflater; @@ -8,16 +8,16 @@ import androidx.annotation.RawRes; import androidx.appcompat.app.AlertDialog; -import com.shreyaspatil.MaterialDialog.model.DialogButton; +import dev.shreyaspatil.MaterialDialog.model.DialogButton; /** * Creates a Material Dialog with 2 buttons. *

* Use {@link Builder} to create a new instance. */ +@SuppressWarnings("unused") public class MaterialDialog extends AbstractDialog { - protected MaterialDialog(@NonNull final Activity mActivity, @NonNull String title, @NonNull String message, @@ -48,7 +48,7 @@ protected MaterialDialog(@NonNull final Activity mActivity, * Builder for {@link MaterialDialog}. */ public static class Builder { - private Activity activity; + private final Activity activity; private String title; private String message; private boolean isCancelable; @@ -94,19 +94,23 @@ public Builder setCancelable(boolean isCancelable) { return this; } - /** Sets the Positive Button to Material Dialog without icon - * @param name sets the name/label of button. + /** + * Sets the Positive Button to Material Dialog without icon + * + * @param name sets the name/label of button. * @param onClickListener interface for callback event on click of button. - * @see this, for chaining. + * @return this, for chaining. */ @NonNull public Builder setPositiveButton(@NonNull String name, @NonNull OnClickListener onClickListener) { return setPositiveButton(name, NO_ICON, onClickListener); } - /** Sets the Positive Button to Material Dialog with icon - * @param name sets the name/label of button. - * @param icon sets the resource icon for button. + /** + * Sets the Positive Button to Material Dialog with icon + * + * @param name sets the name/label of button. + * @param icon sets the resource icon for button. * @param onClickListener interface for callback event on click of button. * @return this, for chaining. */ @@ -116,19 +120,23 @@ public Builder setPositiveButton(@NonNull String name, int icon, @NonNull OnClic return this; } - /** Sets the Negative Button to Material Dialog without icon. - * @param name sets the name/label of button. + /** + * Sets the Negative Button to Material Dialog without icon. + * + * @param name sets the name/label of button. * @param onClickListener interface for callback event on click of button. - * @see this, for chaining. + * @return this, for chaining. */ @NonNull public Builder setNegativeButton(@NonNull String name, @NonNull OnClickListener onClickListener) { return setNegativeButton(name, NO_ICON, onClickListener); } - /** Sets the Negative Button to Material Dialog with icon - * @param name sets the name/label of button. - * @param icon sets the resource icon for button. + /** + * Sets the Negative Button to Material Dialog with icon + * + * @param name sets the name/label of button. + * @param icon sets the resource icon for button. * @param onClickListener interface for callback event on click of button. * @return this, for chaining. */ @@ -138,7 +146,9 @@ public Builder setNegativeButton(@NonNull String name, int icon, @NonNull OnClic return this; } - /** It sets the resource json to the {@link com.airbnb.lottie.LottieAnimationView}. + /** + * It sets the resource json to the {@link com.airbnb.lottie.LottieAnimationView}. + * * @param animationResId sets the resource to {@link com.airbnb.lottie.LottieAnimationView}. * @return this, for chaining. */ @@ -148,7 +158,9 @@ public Builder setAnimation(@RawRes int animationResId) { return this; } - /** It sets the json file to the {@link com.airbnb.lottie.LottieAnimationView} from assets. + /** + * It sets the json file to the {@link com.airbnb.lottie.LottieAnimationView} from assets. + * * @param fileName sets the file from assets to {@link com.airbnb.lottie.LottieAnimationView}. * @return this, for chaining. */ diff --git a/MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/interfaces/DialogInterface.java b/MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/interfaces/DialogInterface.java similarity index 59% rename from MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/interfaces/DialogInterface.java rename to MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/interfaces/DialogInterface.java index 7d9d20d..7042bab 100644 --- a/MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/interfaces/DialogInterface.java +++ b/MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/interfaces/DialogInterface.java @@ -1,4 +1,4 @@ -package com.shreyaspatil.MaterialDialog.interfaces; +package dev.shreyaspatil.MaterialDialog.interfaces; public interface DialogInterface { void cancel(); diff --git a/MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/interfaces/OnCancelListener.java b/MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/interfaces/OnCancelListener.java similarity index 63% rename from MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/interfaces/OnCancelListener.java rename to MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/interfaces/OnCancelListener.java index ffdc6c6..a7c3c91 100644 --- a/MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/interfaces/OnCancelListener.java +++ b/MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/interfaces/OnCancelListener.java @@ -1,4 +1,4 @@ -package com.shreyaspatil.MaterialDialog.interfaces; +package dev.shreyaspatil.MaterialDialog.interfaces; public interface OnCancelListener { void onCancel(DialogInterface dialogInterface); diff --git a/MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/interfaces/OnDismissListener.java b/MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/interfaces/OnDismissListener.java similarity index 64% rename from MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/interfaces/OnDismissListener.java rename to MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/interfaces/OnDismissListener.java index 6c71309..7908fa7 100644 --- a/MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/interfaces/OnDismissListener.java +++ b/MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/interfaces/OnDismissListener.java @@ -1,4 +1,4 @@ -package com.shreyaspatil.MaterialDialog.interfaces; +package dev.shreyaspatil.MaterialDialog.interfaces; public interface OnDismissListener { void onDismiss(DialogInterface dialogInterface); diff --git a/MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/interfaces/OnShowListener.java b/MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/interfaces/OnShowListener.java similarity index 62% rename from MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/interfaces/OnShowListener.java rename to MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/interfaces/OnShowListener.java index 6ffeba6..66881cb 100644 --- a/MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/interfaces/OnShowListener.java +++ b/MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/interfaces/OnShowListener.java @@ -1,4 +1,4 @@ -package com.shreyaspatil.MaterialDialog.interfaces; +package dev.shreyaspatil.MaterialDialog.interfaces; public interface OnShowListener { void onShow(DialogInterface dialogInterface); diff --git a/MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/model/DialogButton.java b/MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/model/DialogButton.java similarity index 84% rename from MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/model/DialogButton.java rename to MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/model/DialogButton.java index 6837deb..393a3fe 100644 --- a/MaterialDialogLibrary/src/main/java/com/shreyaspatil/MaterialDialog/model/DialogButton.java +++ b/MaterialDialogLibrary/src/main/java/dev/shreyaspatil/MaterialDialog/model/DialogButton.java @@ -1,6 +1,6 @@ -package com.shreyaspatil.MaterialDialog.model; +package dev.shreyaspatil.MaterialDialog.model; -import com.shreyaspatil.MaterialDialog.AbstractDialog; +import dev.shreyaspatil.MaterialDialog.AbstractDialog; public class DialogButton { private String title; diff --git a/MaterialDialogLibrary/src/test/java/com/shreyaspatil/MaterialDialog/ExampleUnitTest.java b/MaterialDialogLibrary/src/test/java/dev/shreyaspatil/MaterialDialog/ExampleUnitTest.java similarity index 78% rename from MaterialDialogLibrary/src/test/java/com/shreyaspatil/MaterialDialog/ExampleUnitTest.java rename to MaterialDialogLibrary/src/test/java/dev/shreyaspatil/MaterialDialog/ExampleUnitTest.java index 8054b7e..f484e09 100644 --- a/MaterialDialogLibrary/src/test/java/com/shreyaspatil/MaterialDialog/ExampleUnitTest.java +++ b/MaterialDialogLibrary/src/test/java/dev/shreyaspatil/MaterialDialog/ExampleUnitTest.java @@ -1,8 +1,8 @@ -package com.shreyaspatil.MaterialDialog; +package dev.shreyaspatil.MaterialDialog; import org.junit.Test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; /** * Example local unit test, which will execute on the development machine (host). diff --git a/app/src/androidTest/java/com/shreyaspatil/MaterialDialogExample/ExampleInstrumentedTest.java b/app/src/androidTest/java/dev/shreyaspatil/MaterialDialogExample/ExampleInstrumentedTest.java similarity index 93% rename from app/src/androidTest/java/com/shreyaspatil/MaterialDialogExample/ExampleInstrumentedTest.java rename to app/src/androidTest/java/dev/shreyaspatil/MaterialDialogExample/ExampleInstrumentedTest.java index 6a0b6c9..a82eaf5 100644 --- a/app/src/androidTest/java/com/shreyaspatil/MaterialDialogExample/ExampleInstrumentedTest.java +++ b/app/src/androidTest/java/dev/shreyaspatil/MaterialDialogExample/ExampleInstrumentedTest.java @@ -1,4 +1,4 @@ -package com.shreyaspatil.MaterialDialogExample; +package dev.shreyaspatil.MaterialDialogExample; import android.content.Context; diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index dc3130d..5258684 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,7 @@ + package="dev.shreyaspatil.MaterialDialogExample"> - + diff --git a/app/src/main/java/com/shreyaspatil/MaterialDialogExample/MainActivity.java b/app/src/main/java/dev/shreyaspatil/MaterialDialogExample/MainActivity.java similarity index 85% rename from app/src/main/java/com/shreyaspatil/MaterialDialogExample/MainActivity.java rename to app/src/main/java/dev/shreyaspatil/MaterialDialogExample/MainActivity.java index 9184b15..b02532e 100644 --- a/app/src/main/java/com/shreyaspatil/MaterialDialogExample/MainActivity.java +++ b/app/src/main/java/dev/shreyaspatil/MaterialDialogExample/MainActivity.java @@ -1,5 +1,6 @@ -package com.shreyaspatil.MaterialDialogExample; +package dev.shreyaspatil.MaterialDialogExample; +import android.annotation.SuppressLint; import android.os.Bundle; import android.view.View; import android.widget.Button; @@ -7,12 +8,12 @@ import androidx.appcompat.app.AppCompatActivity; -import com.shreyaspatil.MaterialDialog.BottomSheetMaterialDialog; -import com.shreyaspatil.MaterialDialog.MaterialDialog; -import com.shreyaspatil.MaterialDialog.interfaces.DialogInterface; -import com.shreyaspatil.MaterialDialog.interfaces.OnCancelListener; -import com.shreyaspatil.MaterialDialog.interfaces.OnDismissListener; -import com.shreyaspatil.MaterialDialog.interfaces.OnShowListener; +import dev.shreyaspatil.MaterialDialog.BottomSheetMaterialDialog; +import dev.shreyaspatil.MaterialDialog.MaterialDialog; +import dev.shreyaspatil.MaterialDialog.interfaces.DialogInterface; +import dev.shreyaspatil.MaterialDialog.interfaces.OnCancelListener; +import dev.shreyaspatil.MaterialDialog.interfaces.OnDismissListener; +import dev.shreyaspatil.MaterialDialog.interfaces.OnShowListener; public class MainActivity extends AppCompatActivity implements View.OnClickListener, OnShowListener, OnCancelListener, OnDismissListener { @@ -96,7 +97,7 @@ public void onClick(DialogInterface dialogInterface, int which) { .build(); // Animated BottomSheet Material Dialog - mAnimatedBottomSheetDialog = new BottomSheetMaterialDialog.Builder(this) + mAnimatedBottomSheetDialog = new BottomSheetMaterialDialog.Builder(this) .setTitle("Delete?") .setMessage("Are you sure want to delete this file?") .setCancelable(false) @@ -117,28 +118,29 @@ public void onClick(DialogInterface dialogInterface, int which) { .setAnimation("delete_anim.json") .build(); - mButtonSimpleDialog.setOnClickListener(this); - mButtonBottomSheetDialog.setOnClickListener(this); - mButtonAnimatedDialog.setOnClickListener(this); - mButtonAnimatedBottomSheetDialog.setOnClickListener(this); + mButtonSimpleDialog.setOnClickListener(this); + mButtonBottomSheetDialog.setOnClickListener(this); + mButtonAnimatedDialog.setOnClickListener(this); + mButtonAnimatedBottomSheetDialog.setOnClickListener(this); } + @SuppressLint("NonConstantResourceId") @Override public void onClick(View view) { switch (view.getId()) { - case R.id.button_simple_dialog : + case R.id.button_simple_dialog: mSimpleDialog.show(); break; - case R.id.button_simple_bottomsheet_dialog : + case R.id.button_simple_bottomsheet_dialog: mSimpleBottomSheetDialog.show(); break; - case R.id.button_animated_dialog : + case R.id.button_animated_dialog: mAnimatedDialog.show(); break; - case R.id.button_animated_bottomsheet_dialog : + case R.id.button_animated_bottomsheet_dialog: mAnimatedBottomSheetDialog.show(); break; } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 85528fc..46cf47e 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -3,7 +3,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".MainActivity"> + tools:context="dev.shreyaspatil.MaterialDialogExample.MainActivity"> Date: Sat, 13 Feb 2021 10:09:29 +0530 Subject: [PATCH 06/10] Add necessary comments --- gradle.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index e16935e..afd8962 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,8 @@ org.gradle.jvmargs=-Xmx1536m android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX android.enableJetifier=true -GROUP=dev.shreyaspatil +# Maven Publish Details +GROUP=dev.shreyaspatil.MaterialDialog POM_ARTIFACT_ID=MaterialDialog VERSION_NAME=2.1.1 POM_NAME=MaterialDialog-Android @@ -32,5 +33,4 @@ POM_LICENCE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt POM_LICENCE_DIST=https://github.com/PatilShreyas/MaterialDialog-Android/blob/master/LICENSE POM_DEVELOPER_ID=patilshreyas POM_DEVELOPER_NAME=Shreyas Patil -POM_DEVELOPER_URL=https://github.com/patilshreyas/ -stagingRepository=21977676b1f14 \ No newline at end of file +POM_DEVELOPER_URL=https://github.com/patilshreyas/ \ No newline at end of file From 4a3185d30b4181010d68beee22c9d83ff328b211 Mon Sep 17 00:00:00 2001 From: Shreyas Date: Sat, 13 Feb 2021 10:09:43 +0530 Subject: [PATCH 07/10] Use published library and version in app module --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 0520280..6b87dbf 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -24,7 +24,7 @@ dependencies { implementation 'androidx.constraintlayout:constraintlayout:1.1.3' // Material Dialog Library -// implementation 'dev.shreyaspatil.MaterialDialog:MaterialDialog:2.1.0' + implementation 'dev.shreyaspatil.MaterialDialog:MaterialDialog:2.1.1' // Material Design Library implementation 'com.google.android.material:material:1.3.0' @@ -35,5 +35,5 @@ dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' - implementation project(path: ':MaterialDialogLibrary') +// implementation project(path: ':MaterialDialogLibrary') } From fbdf72aca75538ed203a565a4dfb81d5343d2c6e Mon Sep 17 00:00:00 2001 From: Shreyas Date: Sat, 13 Feb 2021 10:16:35 +0530 Subject: [PATCH 08/10] Update README for implementation details --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c87b173..48aee9a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -![Bintray](https://img.shields.io/bintray/v/patilshreyas/maven/com.shreyaspatil:MaterialDialog?style=flat-square) ![API](https://img.shields.io/badge/API-19%2B-brightgreen.svg) -[![JavaDoc](https://img.shields.io/badge/JavaDoc-MaterialDialog-blue.svg)](https://patilshreyas.github.io/MaterialDialog-Android/docs/) [![Android Weekly](https://img.shields.io/badge/Android%20Weekly-%23392-2CA3E6.svg?style=flat)](http://androidweekly.net/issues/issue-392) ![Github Followers](https://img.shields.io/github/followers/PatilShreyas?label=Follow&style=social) @@ -78,11 +76,19 @@ Implementation of Material Dialog library is so easy. You can check [/app](/app) ### Prerequisite #### i. Gradle In `Build.gradle` of app module, include these dependencies. If you want to show animations, include *Lottie* animation library. + +This library is available on [MavenCentreal](https://search.maven.org/artifact/dev.shreyaspatil.MaterialDialog/MaterialDialog/) + ```groovy + +repositories { + mavenCentral() +} + dependencies { // Material Dialog Library - implementation 'com.shreyaspatil:MaterialDialog:2.1' + implementation 'dev.shreyaspatil.MaterialDialog:MaterialDialog:2.1.1' // Material Design Library implementation 'com.google.android.material:material:1.0.0' From a56ddac2a5a021dff9037fd288b4ac7077ee622b Mon Sep 17 00:00:00 2001 From: Shreyas Date: Sat, 13 Feb 2021 10:18:45 +0530 Subject: [PATCH 09/10] Add mavenCentral badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 48aee9a..c1489eb 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +![Maven Central](https://img.shields.io/maven-central/v/dev.shreyaspatil.MaterialDialog/MaterialDialog) ![API](https://img.shields.io/badge/API-19%2B-brightgreen.svg) [![Android Weekly](https://img.shields.io/badge/Android%20Weekly-%23392-2CA3E6.svg?style=flat)](http://androidweekly.net/issues/issue-392) From fe0a44f4a37217045a425542f5640a6d02e889d3 Mon Sep 17 00:00:00 2001 From: Shreyas Date: Sat, 13 Feb 2021 10:21:16 +0530 Subject: [PATCH 10/10] Use VERSION_NAME gradle property --- MaterialDialogLibrary/build.gradle | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/MaterialDialogLibrary/build.gradle b/MaterialDialogLibrary/build.gradle index 005ee81..1fd9c05 100644 --- a/MaterialDialogLibrary/build.gradle +++ b/MaterialDialogLibrary/build.gradle @@ -1,7 +1,5 @@ apply plugin: 'com.android.library' -version = "2.1.0" - android { compileSdkVersion 30 @@ -9,7 +7,7 @@ android { minSdkVersion 19 targetSdkVersion 30 versionCode 2 - versionName version + versionName VERSION_NAME testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"