Home page f0ris.github.io
f0ris / sweet-alert-dialog Goto Github PK
View Code? Open in Web Editor NEWThis project forked from pedant/sweet-alert-dialog
SweetAlert for Android, a beautiful and clever alert dialog
Home Page: http://www.pedant.cn
This project forked from pedant/sweet-alert-dialog
SweetAlert for Android, a beautiful and clever alert dialog
Home Page: http://www.pedant.cn
Home page f0ris.github.io
java.lang.ClassCastException: com.google.android.material.button.MaterialButtonBackgroundDrawable cannot be cast to android.graphics.drawable.StateListDrawable
at cn.pedant.SweetAlert.ViewUtils.getDrawable(ViewUtils.java:11)
at cn.pedant.SweetAlert.SweetAlertDialog.setButtonBackgroundColor(SweetAlertDialog.java:482)
at cn.pedant.SweetAlert.SweetAlertDialog.setCancelButtonBackgroundColor(SweetAlertDialog.java:472)
at cn.pedant.SweetAlert.SweetAlertDialog.onCreate(SweetAlertDialog.java:224)
Please, can you publish this fork in the maven central repo to be able to compile it in my project build.gradle
Hi,
Is there a way to set the font family for all text in the dialog?
Thanks
Hi,
I've used this library in my project in particular I create the loader with:
loadingDialog = new SweetAlertDialog(this, PROGRESS_TYPE); loadingDialog.getProgressHelper().setBarColor(Color.parseColor("#A5DC86")); loadingDialog.setTitleText("Loading");
and in the onCreateLoader:
loadingDialog.show();
and finally when the loading task is completed ( onLoadFinish) I use:
loadingDialog.dismissWithAnimation();
What happens here is that when the activity is created everything is fine and the dialog is shows and dissapears as expect. The real issue happens when i restart the loader and then the activity becomes unclicable.
Do you have any idea on what could be causing this issue?
Hi, in some case I noticed the last line in dialog is cutted, whether you use setContentText() or use setCustomView(textView). It isn't cutted at fixed number of lines it's vary from the lenght of the last line.
It is not cut to a fixed number of lines, but changes according to the length of the last line, I think.
One example is:
final SweetAlertDialog koDialog = new SweetAlertDialog(MainActivity.this, SweetAlertDialog.ERROR_TYPE)
.setTitleText(getResources().getString(R.string.ko_error))
.setContentText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam
interdum commodo felis, et lobortis quam interdum at. ")
.setConfirmText(getResources().getString(android.R.string.ok));
koDialog.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@OverRide
public void onClick(SweetAlertDialog sDialog) {
sDialog.dismissWithAnimation();
}
});
koDialog.setCancelable(false);
koDialog.show();
Try with different text and check if the last word is visible. I've also tried by adding concat("\n") but sometimes also this method dosen't work.
There is another problem if I set ratingbar inside a customview sometimes the last star is cutted.
Thanks
I have noticed that button text is not centered vertically, either when I do not use setConfirmButton (then button says Ok) and when I use setConfirmButton (to make button text uppercase):
String html = "Powiadomienia zostaną wyłączone do czasu ponownego uruchomienia aplikacji.";
new SweetAlertDialog(this, SweetAlertDialog.NORMAL_TYPE)
.setTitleText("Uśpij aplikację")
.setContentText(html)
.setConfirmButton("OK", sweetAlertDialog -> {
// TODO disable notifications
finish();
})
.show();
It would be great if you can give me some advice if it is possible to center it vertically - thank you :)
When I create a dialog instance and call .dismissWithAnimation() the dialog goes useless. If I call .show() again on it does not appear, just got black overlay on the screen. I think this is product of the out animation, in the dismissWithAnimation impl the alpha animation is set on the child view and that alpha never goes back to 1.0f.
hoping dev will add .setCancelable, Thanks dev :D
In RTL language when the content is multi line, only the first line is shown.
new SweetAlertDialog(UserComplaintRegistration.this, SweetAlertDialog.NORMAL_TYPE)
.setTitleText("a"))
.setContentText("b")
.setConfirmText("c")
.setCancelable(false)
.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@OverRide
public void onClick(SweetAlertDialog sDialog) {
sDialog.dismiss();
}
})
.show();
.setCancelable(false) not working. Please add it
Hello
There is space below Loading text. So what can i do to remove it?
`Here is my code
SweetAlertDialog pDialog = new SweetAlertDialog(Pilot.this, SweetAlertDialog.PROGRESS_TYPE);
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog.getProgressHelper().setBarColor(Color.parseColor("#A5DC86"));
pDialog.setTitle("Loading");
pDialog.setCancelable(false);
pDialog.show();
}`
I am disabling navbar with below:
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
Once I run a SweetAlertDialog, the navbar is enabled again.
If I leave the activity and return it is correctly disabled once more, but then comes back on again with another SweetAlertDialog.
Got this error :
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute application@icon value=(@mipmap/ic_launcher) from AndroidManifest.xml:12:9-43
is also present at [com.pnikosis:materialish-progress:1.0] AndroidManifest.xml:13:9-45 value=(@drawable/ic_launcher).
Suggestion: add 'tools:replace="android:icon"' to element at AndroidManifest.xml:10:5-61:19 to override.
Maybe need to update materialish-progress
Touch screen or press return key dialog does not disappear.
Sometimes need
Im not sure if its because of the framelayout, instead of linear layout, but overall, it should work the way it is implemented, but for some reason, if you add a text view at setCustomView(textView) with more than 5 lines of text, it only shows the first 4 lines and omit the rest.
Any fix ? Thanks
I got error on Android 8 on firebase
Fatal Exception: android.view.WindowManager$BadTokenException Unable to add window -- token android.os.BinderProxy@17f2660 is not valid; is your activity running? project.helper.CheckUpdateHelper.showDialogForUpdate
This crash is usually caused by your app trying to display a dialog using a previously-finished Activity as a context. For example, this can happen if an Activity triggers an AsyncTask that tries to display a dialog when it is finished, but the user navigates back from the Activity before the task is completed.
External resources
Android – Displaying Dialogs From Background Threads
Error : BinderProxy@45d459c0 is not valid; is your activity running?
长文字怎么显示?我看超过两行就后面的不显示。
How do you display long text? I see more than two lines on the back does not show.
I want to hide the soft keyboard when the alert is dismissed, and it could by very nice to add an option to automatically hide it, like à .automaticallyHideKeyboard(true)
in the builder.
"\n" Line break is invalid,how to deal with it?
There isn't any possibility to set manually the width of the box right?
<attr name="sa_pivotX" format="fraction"/>
<attr name="sa_pivotY" format="fraction" />
Please rename to avoid conflicts with constraint layout having the latest version in androidx
How to custom layout with scrollview inside with this library?
Hello Sir
Can I use the dialog to show list of items in Spinner
Getting this error after enabling obfuscation, here is a full stack trace
2021-09-11 23:36:45.152 10096-10096/<packagename> E/AndroidRuntime: FATAL EXCEPTION: main
Process: <packagename>, PID: 10096
java.lang.RuntimeException: Unknown animation name: cn.pedant.SweetAlert.Rotate3dAnimation error:cn.pedant.SweetAlert.Rotate3dAnimation
at a2.b.b(:83)
at a2.b.b(:65)
at a2.b.a(:41)
at a2.b.c(:22)
at a2.k.<init>(:125)
at androidx.fragment.app.Fragment.n1(:2987)
at androidx.fragment.app.t.f(:546)
at androidx.fragment.app.t.m(:282)
at androidx.fragment.app.m.d0(:2189)
at androidx.fragment.app.m.a1(:2106)
at androidx.fragment.app.m.a0(:2002)
at androidx.fragment.app.m$g.run(:524)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:251)
at android.app.ActivityThread.main(ActivityThread.java:7465)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980)
Tried adding the following rules to my proguard-rules.pro
file but the error still persists
keep class cn.pedant.** { *; }
-keep class cn.pedant.SweetAlert.Rotate3dAnimation {
public <init>(...);
}
-keep class cn.pedant.SweetAlert.Rotate3dAnimation
Fatal Exception: java.lang.RuntimeException
Unknown animation name: cn.pedant.SweetAlert.Rotate3dAnimation error:cn.pedant.SweetAlert.Rotate3dAnimation
cn.pedant.SweetAlert.OptAnimationLoader.createAnimationFromXml
keyboard_arrow_down
E/UncaughtException: java.lang.RuntimeException: Unknown animation name: cn.pedant.SweetAlert.Rotate3dAnimation error:cn.pedant.SweetAlert.Rotate3dAnimation
Good to see the project went on, have you implemented a method to set custom text/font yet?
Hi,
thank you very much for your work! Still, I have one question: How can I change the button color back to blue? Your version has green buttons, but they don't really work out with my design.
Thank you, keep up the good work!
I am using material DayNight theme:
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
This theme is set as used always in my custom App class (this clas is set properly in manifest):
public class MyApplication extends Application {
public void onCreate() {
super.onCreate();
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
}
}
The problem is that my app uses dark theme, but this beautiful dialogs has white theme. How to fix that?
I can't compile . I changed name of icon but it's still not working
I tried adding '\n' in my message while passing it to setContentText(). But it did not work.
Hi,
The latest version fails to build due to conflict of duplicated attributes
pivotX and pivotY were introduced in the latest versions of constraint layout.
values.xml:6875: error: duplicate value for resource 'attr/pivotX' with config ''.
values.xml:6875: error: duplicate value for resource 'attr/pivotY' with config ''.
not support com.pnikosis:materialish-progress:1.7
progressIndeterminate
to
matProg_progressIndeterminate
When I released my apk in android studio it makes my app to crash but in debug mode it does not.
I am using Kotlin.
The crash caused by this.
java.lang.RuntimeException: Unknown animation name: pedant.SweetAlert.Rotate3dAnimation
Hey , I'm using kotlin for this library. When I want to click onConfirm clickListener , nothing happens.
val pDialog = SweetAlertDialog(activity, SweetAlertDialog.WARNING_TYPE)
pDialog.getProgressHelper().setBarColor(Color.parseColor("#A5DC86"))
pDialog.setTitleText("Warning!")
pDialog.setConfirmText("OK")
pDialog.setContentText("For Recieving Menu of Restaurant Please Turn Your Bluetooth On")
pDialog.setConfirmClickListener {
object:SweetAlertDialog.OnSweetClickListener{
override fun onClick(sweetAlertDialog: SweetAlertDialog?) {
Log.d("TAGG","enter click")
sweetAlertDialog!!.dismissWithAnimation()
val enableIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE)
startActivityForResult(enableIntent, 0)
}
}
}
pDialog.show()
Dialog is appeared but My OK click not work. I write a code for turning on Bluetooth , it does not work either. what am i wrong about?
There is large padding bottom when the dialog type is SweetAlertDialog.PROGRESS_TYPE. Is it possible to change this size manually ? And if not, can you fix this problem ? Thanks a lot.
both the app and the emulator are all crashed when i set spinner as a custom view!
When I use this while development, all was fine.
For upload, when I make apk on release mode, I get below error.
java.lang.RuntimeException: Unknown animation name: cn.pedant.SweetAlert.Rotate3dAnimation error:cn.pedant.SweetAlert.Rotate3dAnimation
Any idea why this error is coming? Am I missing anything?
Is possible to change the color of the button and the animation?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.