code-mc / loadtoast Goto Github PK
View Code? Open in Web Editor NEWPretty material design toasts with feedback animations
License: Apache License 2.0
Pretty material design toasts with feedback animations
License: Apache License 2.0
Everytime loadtoast dismisses with "Error" there is a white rectangle that blinks for a moment. It doesn't occur when toast is dismissed with success.
I can replicate it on a Sony Xperia Z with 4.4.4 Android.
Because can update changes in gradle cache.
The current version scales the text relative to the available space inside the toast. It would be nice to be able to set a chosen value instead.
I guess this feature is somewhat coupled to issue #8.
Can you add a numbered progress bar ?
LoadToast lt = new LoadToast(this);
lt.setTextColor(Color.RED).setBackgroundColor(Color.GREEN).setProgressColor(Color.BLUE);
lt.setText("Hallo");
lt.show();
FATAL EXCEPTION: main
Process: com.oli.fitnessapp, PID: 27811
java.lang.NoClassDefFoundError: Failed resolution of: Lnet/steamcrafted/loadtoast/R$color;
at net.steamcrafted.loadtoast.LoadToastView.<init>(LoadToastView.java:83)
at net.steamcrafted.loadtoast.LoadToast.<init>(LoadToast.java:32)
at com.oli.myfitnessapp.activities.LiveSelectActivity.onCreate(LiveSelectActivity.java:114)
at android.app.Activity.performCreate(Activity.java:6052)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2332)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2441)
at android.app.ActivityThread.access$800(ActivityThread.java:162)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5431)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:914)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:707)
Caused by: java.lang.ClassNotFoundException: Didn't find class "net.steamcrafted.loadtoast.R$color" on path:
Currently it's a bit ugly to for example show loadtoast, and on success finish activity - toast's animation plays together with activity's. It would be nice to have LoadToast#isShowing()
method, as well as LoadToast#setOnAnimationCompleteListener
, to be able to wait until animation finishes to do stuff.
I'm willing to issue a pull request with this change - only please let me know if you're willing to merge it later, and if there's preferred place to put animation listeners (LoadToast
class or LoadToastView
), and if there's anything special I should consider?
Hi,
Thank you for this fancy toast library. However there is a problem in rendering in RTL devices. The load toast is shown in right side of the screen instead of center
Wow
When just loading data, sometimes we would like to just hide the toast, simply because the user did not really do anything which implies showing success or error.
Would be nice to have a hide
method which simply requests the toast to hide while in loading state.
In my usage, I just create one LoadToast instance at activity's onCreate method, and reuse it in every show and stop.
The problem is that when I change my activity to extends AppCompatActivity, the program throw IllegalStateException, stack trace is:
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at android.view.ViewGroup.addViewInner(ViewGroup.java:3562)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at android.view.ViewGroup.addView(ViewGroup.java:3415)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at android.view.ViewGroup.addView(ViewGroup.java:3391)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at net.steamcrafted.loadtoast.LoadToast.checkZPosition(LoadToast.java:117)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at net.steamcrafted.loadtoast.LoadToast.access$600(LoadToast.java:18)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at net.steamcrafted.loadtoast.LoadToast$2.onGlobalLayout(LoadToast.java:46)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:815)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1821)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1039)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5648)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at android.view.Choreographer.doCallbacks(Choreographer.java:574)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at android.view.Choreographer.doFrame(Choreographer.java:544)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:733)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at android.os.Looper.loop(Looper.java:136)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5113)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:515)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
09-27 19:21:15.282 25403-25403/? E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
And I just step into the single line, and found that mView.getParent().getParent().getParent() == mParentView
was true
. More detailed info is:
mView
: net.steamcrafted.loadtoast.LoadToastView{4243e6a8 V.ED.... ......ID 0,0-376,96}
mView.getParent()
: android.support.v7.internal.widget.ContentFrameLayout{424a0278 V.ED.... ......ID 0,0-720,1230 #1020002 android:id/content}
mView.getParent().getParent()
: android.support.v7.internal.widget.FitWindowsLinearLayout{4249f3f8 V.E..... ......ID 0,0-720,1230 #7f0c0062 app:id/action_bar_root}
mView.getParent().getParent().getParent()
: android.widget.FrameLayout{42454c48 V.E..... ......ID 0,50-720,1280}
mParentView
: android.widget.FrameLayout{42454c48 V.E..... ......ID 0,50-720,1280}
When my activity extends FragmentActivity, this problem never happened.
setbackground(your_color) method isn't functioning properly unlike the other two like for example when I set the color to android.R.color.black the background becomes transparent, this has been tested in Lollipop 5.1.1, any other color seems to make it dark translucent black.
Hi,
I did some benchmarking and it seems, that somewhere inside the NineOldAndroid's the listeners are not released properly, causing whole activities leaking.
Here is the sample path to GC root
java.lang.Thread @ 0x89418f80 main Thread | 9 | 88 | 3,312 | 3,400
'- localValues java.lang.ThreadLocal$Values @ 0x8b1fa718 | 9 | 32 | 3,312 | 2,024
'- table java.lang.Object[64] @ 0x12c50d40 | 9 | 272 | 3,312 | 1,992
'- [59] java.util.ArrayList @ 0x12e3e720 | 9 | 24 | 3,312 | 112
'- array java.lang.Object[18] @ 0x12dc1a60 | 9 | 88 | 3,312 | 88
|- [3] com.nineoldandroids.animation.ValueAnimator @ 0x12d3cc10 | 1 | 96 | 368 | 752
| '- mUpdateListeners java.util.ArrayList @ 0x12c99400 | 1 | 24 | 368 | 104
| '- array java.lang.Object[12] @ 0x12c9b7c0 | 1 | 64 | 368 | 80
| '- [0] net.steamcrafted.loadtoast.LoadToastView$1 @ 0x12c03fc0 | 1 | 16 | 368 | 16
Let me know if you need any more info.
Is there any way, I can display this toast on the centre of the screen? not by giving hardcoded value like
setTranslationY(100);
Would be nice to be able to tell the toast to show from the bottom instead of from the top.
My UI has some important elements on top and it would be better to have the toast slide in from the bottom of the screen
I am using loadtoast in viewpager and when displaying loadtoast, its aligned to top right instead of middle top.
How can i make it to display normally in middle?
It would be easier for people to try this Lib
Hi
Thanks for you library. Sweat and simple!
I was wondering if you think it would be a good idea to handle the elevation for the toast view? I have a case were it's partly hidden by some other views and would like to make it appears on top...
What do you think? (If you agree I can do the pull request myself...)
Cheers!
compile 'net.steamcrafted:load-toast:1.0.6'
not find on mavenCentral
I have imported the library, it works nicely but goes to 0x and 0y
and i couldn't change its position by setting translationX or translationY or setX or sety
tested on android 8, layout direction was rtl
is there any way to dim behind of the loadtoast like alertDialog??
when i have a long text on toast, that cause of make marquee from that which direction and animation is left to right. how can i change that to right to left?
When show()
and success()
are called within a very short time frame, it looks like the toast is not dismissed.
This happens for instance in my loader when data is cached (calling show when starting the loader but that one gets completed within 10ms and thus I call success() really quick).
Hello, JCenter is deprecated. I was wondering if there was a plan to publish the library on some other repositroy like Maven Central.
thank you for good job , please support right to left layout (text on the right and loading in the left side)
I am receiving an error on the latest Android (3.2) that is registering an unescaped apostrophe in the following string.
The word don't is enescaped and throwing this issue. Never had it prior to the update although I can't find a workaround at the moment.
If you could please fix this minor issue I would greatly appreciate it.
Hi,
thank you for this library. this is very good
I have a problem. when I am testing loadtoast on android 4.4
it is showing in center&top
of screen but on android 4.0
, its align is right&top
of screen. I want loadtoast be center&top
always. also some time in android 4.4
showing in right&top
how can i fix this problem?
Would it be possible to show error message with this library when loading fails?
Or you consider this a bad UX?
On devices having a physical top notch , the loadtoast hides behind the notch and is not visible to the user .
The only workaround is to set loadToast.setTranslationY()
. But different devices have different not size , so it is not a solution.
Please fix this issue to show the loadtoast below status bar so that it is visible on all devices.
See the issue in the video link below
link
adding strokes to background makes it more beautiful
When I instantiate an object of the LoadToast class in my fragment my espresso test is going to fail.
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mLt = new LoadToast(getContext());
mLt.setText(getString(R.string.connect_to));
}
Does anyone have an idea how to solve this issue?
The inability to specify which viewgroup to use is making this appear behind fragments (I think), and when using a custom toolbar, in an activity it appears "on top" rather than sliding underneath.
If there is no text, the LoadToast should just show the progress loader without any empty space on the left.
Sometimes we don't want to write anything, just show that something is getting done in the background.
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.