diff --git a/README.md b/README.md index 991e85b..cef465f 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Stylish Alert Dialogs for Android. https://jitpack.io - + com.github.MarsadMaqsood StylishDialogs @@ -64,7 +64,7 @@ pDialog.setTitleText("Loading") .setCancellable(false) //.setCancelledOnTouchOutside(false) .show(); - + ``` --- **Kotlin** @@ -75,7 +75,7 @@ pDialog.setTitleText("Loading") .setCancellable(false) //.setCancelledOnTouchOutside(false) .show() - + ``` @@ -107,7 +107,7 @@ getButton(/*StylishAlertDialog.Button)Type*/) getButton(/*StylishAlertDialog.Button)Type*/).setBackgroundTintList() setCancellable(boolean cancellable) setCancelledOnTouchOutside(boolean cancelledOnTouchOutside) - +setCustomView(View view, boolean withContent) ``` thanks to the project [materialish-progress](https://github.com/pnikosis/materialish-progress) @@ -120,7 +120,7 @@ Simple basic message: new StylishAlertDialog(this) .setTitleText("Here's a message!") .show(); -``` +``` ___ **Kotlin** ```kotlin @@ -136,7 +136,7 @@ Title with a text under: .setTitleText("Here's a message!") .setContentText("It's pretty, isn't it?") .show(); -``` +``` ___ **Kotlin** ```kotlin @@ -161,7 +161,7 @@ Error message: .setTitleText("Oops...") .setContentText("Something went wrong!") .show() -``` +``` Warning message: @@ -208,7 +208,7 @@ Message with a custom icon: .setContentText("Here's a custom image.") .setCustomImage(R.drawable.custom_img) .show(); -``` +``` --- **Kotlin** ```kotlin @@ -292,7 +292,7 @@ Disable button .changeAlertType(StylishAlertDialog.SUCCESS); } }).show(); - + ``` --- **Kotlin** @@ -347,7 +347,7 @@ Disable button .changeAlertType(StylishAlertDialog.SUCCESS) } .show() -``` +``` **Proguard-Rules** ```pro @@ -360,7 +360,7 @@ Disable button ## License The MIT License (MIT) - + Copyright (c) 2021 Marsad Maqsood Permission is hereby granted, free of charge, to any person obtaining a copy @@ -369,10 +369,10 @@ Disable button to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/app/build.gradle b/app/build.gradle index 5b47736..3f59c6a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,7 +4,7 @@ plugins { android { compileSdkVersion 31 - buildToolsVersion "30.0.3" + buildToolsVersion "32.0.0" defaultConfig { applicationId "com.marsad.stylishdialogs" @@ -31,11 +31,10 @@ android { dependencies { - implementation 'androidx.appcompat:appcompat:1.3.1' - implementation 'com.google.android.material:material:1.4.0' + implementation 'androidx.appcompat:appcompat:1.4.1' + implementation 'com.google.android.material:material:1.5.0' implementation project(path: ':stylishdialogs') implementation "androidx.multidex:multidex:2.0.1" - implementation 'androidx.constraintlayout:constraintlayout:2.1.0' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' diff --git a/app/src/main/java/com/marsad/stylishdialogs/MainActivity.java b/app/src/main/java/com/marsad/stylishdialogs/MainActivity.java index 454e144..a0e0f0f 100644 --- a/app/src/main/java/com/marsad/stylishdialogs/MainActivity.java +++ b/app/src/main/java/com/marsad/stylishdialogs/MainActivity.java @@ -30,7 +30,6 @@ protected void onCreate(Bundle savedInstanceState) { .setConfirmButton("Dismiss", StylishAlertDialog::dismissWithAnimation) .show() - ); findViewById(R.id.successMsgDialog) diff --git a/stylishdialogs/build.gradle b/stylishdialogs/build.gradle index 51894cf..809478c 100644 --- a/stylishdialogs/build.gradle +++ b/stylishdialogs/build.gradle @@ -20,5 +20,5 @@ android { dependencies { implementation 'com.pnikosis:materialish-progress:1.7' - implementation 'androidx.appcompat:appcompat:1.3.1' + implementation 'androidx.appcompat:appcompat:1.4.1' } \ No newline at end of file diff --git a/stylishdialogs/src/main/java/com/marsad/stylishdialogs/StylishAlertDialog.java b/stylishdialogs/src/main/java/com/marsad/stylishdialogs/StylishAlertDialog.java index 253e9fe..304d67a 100644 --- a/stylishdialogs/src/main/java/com/marsad/stylishdialogs/StylishAlertDialog.java +++ b/stylishdialogs/src/main/java/com/marsad/stylishdialogs/StylishAlertDialog.java @@ -94,6 +94,7 @@ public class StylishAlertDialog extends Dialog implements View.OnClickListener { private boolean mHideKeyBoardOnDismiss = true; private int contentTextSize = 0; private float strokeWidth = 0; + private boolean isWithContent; public StylishAlertDialog(Context context) { this(context, NORMAL); @@ -208,7 +209,7 @@ protected void onCreate(Bundle savedInstanceState) { setTitleText(mTitleText); setContentText(mContentText); - setCustomView(mCustomView); + setCustomView(mCustomView, isWithContent); setCancelText(mCancelText); setConfirmText(mConfirmText); setNeutralText(mNeutralText); @@ -680,12 +681,13 @@ protected void onStart() { * * @param view */ - public StylishAlertDialog setCustomView(View view) { + public StylishAlertDialog setCustomView(View view, boolean withContent) { + isWithContent = withContent; mCustomView = view; if (mCustomView != null && mCustomViewContainer != null) { mCustomViewContainer.addView(view); mCustomViewContainer.setVisibility(View.VISIBLE); - mContentTextView.setVisibility(View.GONE); + mContentTextView.setVisibility(withContent ? View.VISIBLE : View.GONE); } return this; } diff --git a/stylishdialogs/src/main/java/com/marsad/stylishdialogs/SuccessView.java b/stylishdialogs/src/main/java/com/marsad/stylishdialogs/SuccessView.java index fbc3f03..1b887f5 100644 --- a/stylishdialogs/src/main/java/com/marsad/stylishdialogs/SuccessView.java +++ b/stylishdialogs/src/main/java/com/marsad/stylishdialogs/SuccessView.java @@ -44,7 +44,7 @@ private void init() { @Override public void draw(Canvas canvas) { super.draw(canvas); -// todo: changed int to float + // todo: changed int to float float totalW = getWidth(); float totalH = getHeight(); // rotate canvas first