Skip to content

Commit

Permalink
Merge pull request #40 from PatilShreyas/migrate/maven-central
Browse files Browse the repository at this point in the history
Migrate from JCenter to MavenCentral
  • Loading branch information
PatilShreyas committed Feb 13, 2021
2 parents f18c946 + fe0a44f commit 005fe20
Show file tree
Hide file tree
Showing 22 changed files with 127 additions and 212 deletions.
138 changes: 9 additions & 129 deletions MaterialDialogLibrary/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: "com.jfrog.bintray"

version = "2.1"

android {
compileSdkVersion 29
compileSdkVersion 30

defaultConfig {
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName version
targetSdkVersion 30
versionCode 2
versionName VERSION_NAME

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Expand All @@ -28,135 +24,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'
apply plugin: 'com.vanniktech.maven.publish'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shreyaspatil.MaterialDialog;
package dev.shreyaspatil.MaterialDialog;

import android.content.Context;

Expand Down
3 changes: 1 addition & 2 deletions MaterialDialogLibrary/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.shreyaspatil.MaterialDialog" />
<manifest package="dev.shreyaspatil.MaterialDialog" />
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shreyaspatil.MaterialDialog;
package dev.shreyaspatil.MaterialDialog;

import android.app.Activity;
import android.app.Dialog;
Expand All @@ -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
Expand Down Expand Up @@ -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() {
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shreyaspatil.MaterialDialog;
package dev.shreyaspatil.MaterialDialog;

import android.app.Activity;
import android.content.Context;
Expand All @@ -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.
* <p>
* Use {@link BottomSheetMaterialDialog.Builder} to create a new instance.
*/
@SuppressWarnings("unused")
public class BottomSheetMaterialDialog extends AbstractDialog {

protected BottomSheetMaterialDialog(@NonNull final Activity mActivity,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shreyaspatil.MaterialDialog;
package dev.shreyaspatil.MaterialDialog;

import android.app.Activity;
import android.view.LayoutInflater;
Expand All @@ -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.
* <p>
* 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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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.
*/
Expand All @@ -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.
*/
Expand All @@ -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.
*/
Expand All @@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shreyaspatil.MaterialDialog.interfaces;
package dev.shreyaspatil.MaterialDialog.interfaces;

public interface DialogInterface {
void cancel();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shreyaspatil.MaterialDialog.interfaces;
package dev.shreyaspatil.MaterialDialog.interfaces;

public interface OnCancelListener {
void onCancel(DialogInterface dialogInterface);
Expand Down

0 comments on commit 005fe20

Please sign in to comment.