Coder Social home page Coder Social logo

loadtoast's People

Contributors

bryant1410 avatar code-mc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

loadtoast's Issues

White rectangle blinks on error on Android 4.4.4

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.

Make text size adjustable

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.

Error

 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:

Add support for getting toast animation status/callback

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?

[Bug] Problem in RTL mode

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

Simple hide

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.

IllegalStateException when used in AppCompatActivity

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 doesnt work properly as expected.

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.

LoadToast leaking activities?

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

Class Name | Ref. Objects | Shallow Heap | Ref. Shallow Heap | Retained Heap

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

| '- this$0 net.steamcrafted.loadtoast.LoadToastView @ 0x132e8400| 1 | 576 | 368 | 1,160

Let me know if you need any more info.

Gravity

Is there any way, I can display this toast on the centre of the screen? not by giving hardcoded value like
setTranslationY(100);

Show from the bottom

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

Handle elevation?

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!

Toast goes to 0X and 0Y

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

help

is there any way to dim behind of the loadtoast like alertDialog??

change right to left marquee

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?

Does not disappear in some cases

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).

RTL layout

thank you for good job , please support right to left layout (text on the right and loading in the left side)

Un-Escaped apostrophe in resources.

I am receiving an error on the latest Android (3.2) that is registering an unescaped apostrophe in the following string.

screen shot 2018-10-03 at 9 14 20 am

screen shot 2018-10-03 at 9 14 48 am

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.

align loadtoast

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?

Show error message

Would it be possible to show error message with this library when loading fails?
Or you consider this a bad UX?

Adjust width according to text length

  • If the text is too long for the fixed width, the text gets cut. The toast should either
    • marquee the text (scroll it from right to left)
    • adjust the width of the toast (up to screen width minus some margin)
    • split text on multiple lines

loadToast not visible on devices with a top notch

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

add strokes

adding strokes to background makes it more beautiful

Espresso is failing

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?

Ability to specify which viewgroup to use.

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.

Handle cases without text

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.

run time error

maybe i have done something wrong please help meπŸ™πŸ™πŸ™
Screenshot_20210713-162202

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.