aritraroy / flashbar Goto Github PK
View Code? Open in Web Editor NEW⚡️A highly customizable, powerful and easy-to-use alerting library for Android.
License: Apache License 2.0
⚡️A highly customizable, powerful and easy-to-use alerting library for Android.
License: Apache License 2.0
Hello,
How can I get the message, for instance, from a created FlashBar?
Thanks
Hi. First of all, I love Flashbar. You did a great job there.
I would like to make one suggestion. I think Flashbar.isShowing() is a bit misleading. You use it as an opposition to Flashbar.isDismissing().
Consider using the name Flashbar.isAppearing() or Flashbar.isEmerging() instead. It represents its functionality in a better way.
Flashbar.isShowing() should substitute Flashbar.isShown() in my opinion.
Hope you take it into consideration.
Cheers.
when i try to add it to gradle
this message appear
Failed to resolve: com.andrognito.flashbar:flashbar:1.0.1
Case: If I send 2 or more message in just one seconds and time to display one individual message is 2 seconds. Than the new one will override the previous one. Any way that new message will appear after old one is gone.
Cheers! For the great library @aritraroy
It seems library still needs legacy support libraries, Do you have any plans for the androidX migration as such also seen that it is not available on maven?
Can we expect updates in future ? Or library is dead and no more updates can be expected in future.....
Looking forward to hear from you!
I'm unable to set indefinite duration for the flashbar message by using Flashbar.DURATION_INDEFINITE
.
I get the following error:
Duration cannot be negative or zero
Please make changes in the code regarding this and allow an exception for Flashbar.DURATION_INDEFINITE
Hello,
Is there a way to add a top or bottom margin to the Flashbar view? It always stick to top or bottom, I tried changing fb_bottom_compensation_margin to a negative value, it works but the content does't go up with the view.
Thanks.
can t show inside fragment
hi i use your library in different fragments and when i press the back bottom the snack bars don't dismiss
.
Consider this code:
class MainActivity : AppCompatActivity() {
var flashbar : Flashbar? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setupFlashbar()
}
override fun onStart() {
super.onStart()
flashbar?.show()
flashbar?.dismiss()
}
fun setupFlashbar() {
flashbar = Flashbar.Builder(this)
.message("Test")
.gravity(Flashbar.Gravity.BOTTOM)
.build()
}
}
If you run it, you'll see that flashbar is still shown, regardless of flashbar?.dismiss()
being called.
I'm not sure if this is a bug, since method isShowing()
is provided so case like that was considered. If so, please add something like onFlashbarShown
interface so it's possible to make sure that flashbar is dismissed.
Thanks for reading this. The library is great ♥
1.0.2
Allow the flashbar to show relative to other views such as toolbar, navigation bar or footers.
Currently the flashbar only shows either at the top or bottom of the screen without leaving space for the other views.
1.0.2
Allow flashbars to have icons as buttons.
We're able to add texts as buttons via the primaryActionText
method. It would be great to add a method to add icons as buttons as well. primaryActionIcon
perhaps.
Hello @aritraroy thanks for this awesome library, i just want to know is there any way to disable user interaction while opened Flashbar..?
does flashbar has option to generate sound when an alert message is displayed ?
When using the Gravity Top flashier on a tablet in Landscape Mode, the bar is not completely shown. It animates down, but just a few inches.
Bottom works well.
Hi, I tried to use this in my new app and it's working fine but when I used this with a no NoActionBar activity it's not showing properly on Flashbar.Gravity.TOP
This is my code which I am writing
Flashbar.Builder builder = new Flashbar.Builder(activity) .gravity(gravity) .title(title) .message(body) .enableSwipeToDismiss() .backgroundColorRes(R.color.colorPrimarylight) .enterAnimation(FlashAnim.with(activity) .animateBar() .duration(Flashbar.DURATION_SHORT) .alpha() .overshoot()); _flashBar=builder.build();
This is the preview of the problem
What should I do ?
I have a Samsung S8+ and it has an option to hide the navigation bar, giving me more screen to read things on.
When it's hidden, and the Flashbar appears, its over the space where the navigation bar would be, leaving a white gap on the bottom.
I'm using Flashbar version 1.0.2
The same issue happens on landscape
Not sure if this is by design, but using Flashbar in my non-kotlin enabled Android project resulted in an immediate crash on application run with a ClassNotFoundException. I had to add the kotlin-stdlib dependency to my app gradle in order to get it working.
Would be nice if there was a way around that.
Hi @aritraroy. I passing by to let you know that I liked the idea so much that I'm developing a Flutter version of Flashbar: Flushbar.
It is still in early stages though. I hope I can make something as good as Flashbar. If you want to check it out, Flushbar.
Cheers!
it crashes upon showing the first message
this is the code in a default method in an interface (implemented by Activities) :
default void showToast(String title, String details){
new Flashbar.Builder((Activity)this)
.enableSwipeToDismiss()
.dismissOnTapOutside()
.duration(3000)
.gravity(Flashbar.Gravity.TOP)
.title(title)
.message(details)
.build()
.show();
}
this is the stack trace :
W/StaticLayout: maxLineHeight should not be -1. maxLines:1 lineCount:1
2019-06-25 03:54:13.941 W/System.err: io.reactivex.exceptions.UndeliverableException: The exception could not be delivered to the consumer because it has already canceled/disposed the flow or the exception has nowhere to go to begin with. Further reading: https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling | java.lang.AbstractMethodError: abstract method "void com.cuboh.mobile.presentation.core.behaviors.CustomToasts.showToast(java.lang.Throwable)"
2019-06-25 03:54:13.942 W/System.err: at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:367)
2019-06-25 03:54:13.942 W/System.err: at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:126)
2019-06-25 03:54:13.942 W/System.err: at android.os.Handler.handleCallback(Handler.java:793)
2019-06-25 03:54:13.942 W/System.err: at android.os.Handler.dispatchMessage(Handler.java:98)
2019-06-25 03:54:13.942 W/System.err: at android.os.Looper.loop(Looper.java:176)
2019-06-25 03:54:13.943 W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6701)
2019-06-25 03:54:13.943 W/System.err: at java.lang.reflect.Method.invoke(Native Method)
2019-06-25 03:54:13.943 W/System.err: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:249)
2019-06-25 03:54:13.943 W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783)
2019-06-25 03:54:13.943 W/System.err: Caused by: java.lang.AbstractMethodError: abstract method "void com.cuboh.mobile.presentation.core.behaviors.CustomToasts.showToast(java.lang.Throwable)"
2019-06-25 03:54:13.943 W/System.err: at com.cuboh.mobile.presentation.features.main.-$$Lambda$NO1rDPnH-993Pc6JvEqcyiJesow.accept(Unknown Source:4)
2019-06-25 03:54:13.944 W/System.err: at io.reactivex.internal.observers.LambdaObserver.onNext(LambdaObserver.java:63)
2019-06-25 03:54:13.944 W/System.err: at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.drainNormal(ObservableObserveOn.java:201)
2019-06-25 03:54:13.944 W/System.err: at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run(ObservableObserveOn.java:255)
2019-06-25 03:54:13.944 W/System.err: at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:124)
2019-06-25 03:54:13.944 W/System.err: ... 7 more
internal fun Activity.getStatusBarHeightInPx(): Int {
val rectangle = Rect()
window.decorView.getWindowVisibleDisplayFrame(rectangle)
val statusBarHeight = rectangle.top
val contentViewTop = window.findViewById<View>(Window.ID_ANDROID_CONTENT).top
return if (contentViewTop == 0) { //Actionbar is not present
statusBarHeight
} else {
contentViewTop - statusBarHeight
}
}
hi, how are you guys, thanks for this fantastic library.
just want to know if there is a chance to add a feature so that the user will see the flashbar after some opportunities like after 3 launches of the app or 3 days, and once he clicked the positive button the FlashBar will never been shown again.
otherwise. your app is greeeeeat
It would be nice to have a list of all the various types of customisations available as a list of buttons for hiding/showing, similar to this
Bonus: publish the sample to the play store so that we don't need to clone/build the project :)
Would recommend having a way of initializing the library once by passing a config object and then the same Flashbar object be used. When you pass the config object, it creates an immutable version of a Flashbar
which gets cloned every time you try to customize it further.
This basically allows someone to initialize the Flashbar once based on their own style guide and then keep reusing that configuration.
Varun
Hi, Jfrog was announced that they want to sunset jCenter and Bintray services
https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/
Please consider publishing the artifact to jetpack or mavenCentral
Add an EditText to the Flashbar dialog for taking input from users.
Allow this EditText to be customizable to accept both plain text(one-line and multiline) and passwords.
This dialog can be used as an input dialog box.
use simple example but have this error :
E/TypefaceCompatApi21Impl: java.lang.NoSuchMethodException java.lang.NoSuchMethodException: addFontWeightStyle [class java.lang.String, int, boolean]
i think you use hide method and this not allow in android P
this is my example:
Flashbar flashbar = new Flashbar.Builder(this)
.message(R.string.str_start_sync)
.gravity(Flashbar.Gravity.BOTTOM)
.showProgress(Flashbar.ProgressPosition.LEFT)
.build();
flashbar.show();
Is there a way to make sure i only have one bar showing at any given moment ?
Hello, Great library guys thank you.
am having a problem with text position inside the Flashbar,
I've tried to set the .titleAppearance() and .messageAppearance() to center or right it did not work.
is there any solution to this?
See attached video:
when I try to add to gradle I get
Failed to resolve: com.andrognito.flashbar:flashbar:1.0.2
Using the overlay feature is cool, but the abrupt-ness of its appearance/disappearance doesn't match well with the rest of my UI. Is it possible to add fade-in/fade-out animations to the overlay's appearance/disappearance?
When I add icons as drawables to flashbar i can see only white shapes of icons.
The action button gets hidden under the navigation bar when used in tablets, making them untapable.
1.0.1
and 1.0.2
6.0.1
, 7.1.1
(Used emulator)flashbar = Flashbar.Builder(this)
.gravity(Flashbar.Gravity.BOTTOM)
.title("Title")
.message("Message")
.backgroundColorRes(R.color.colorPrimaryDark)
.positiveActionText(R.string.btn_cta_preceed)
.negativeActionText(R.string.btn_cta_okay)
.positiveActionTextColorRes(R.color.colorAccent)
.negativeActionTextColorRes(R.color.colorAccent)
.positiveActionTapListener(object : Flashbar.OnActionTapListener {
override fun onActionTapped(bar: Flashbar) {
bar.dismiss()
}
})
.negativeActionTapListener(object : Flashbar.OnActionTapListener {
override fun onActionTapped(bar: Flashbar) {
bar.dismiss()
}
})
.build()
The duration seems to get confused when dismissing the flash bar and opening one up again right afterwards.
Button on screen that fires the flash bar .show();
Showing flash bar with duration 5000 and positive button "dismiss"
Tapping on dismiss then quickly pressing the button to show another one
The flash bar closes before 5 seconds has elapsed. Presumably using the time from the first flash bar. Ideally this timer would get reset when the flash bar is dismissed.
Well written README, simple examples with demo gifs and a pretty cool set of features. Keep up the good work.
when i use flash bar in a dialogFragment the flashbar displays under the dialog fragment. i pass the dialogFragment's activity to flash bar.
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.