Giter VIP home page Giter VIP logo

snackbar's People

Contributors

ashughes avatar bkfrcm avatar danpe avatar davidjrichardson avatar devgary avatar egor-n avatar fahimk avatar h6ah4i avatar hatemsh avatar i906 avatar jrgonzalezg avatar lewisjdeane avatar mdxdave avatar nitinmishra27 avatar pawelantczak avatar pmcteixeira avatar sbaar avatar seanfredericksen avatar seeday avatar sferadev avatar shekibobo avatar theknut avatar valodim avatar wmora avatar zacsweers 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

snackbar's Issues

Do not dismiss when in swipe.

Would it be possible to pause the countdown while the snackbar is being swiped? Because you may go to swipe it and while doing so the timer may run out and thus dismiss it which doesn't look right, timer should resume when the swipe is cancelled, just an idea.

Can't position the snackbar horizontally on tablets

Hi,

First of all, great library! I have a request: currently the snackbar is always positioned to the left of the screen on tablets. As a default, this works well, but if you're using the master/detail design pattern, more fine-grained control of the snackbar's location is needed to ensure that the snackbar doesn't cover critical information or straddle the master & detail views. Can you add a method to position the snackbar? Thanks!

Set Right to left direction

it's great to use SnackBar in non Lollipop android version, and have lot of option for developer,
i want to use snakeBar with RightToLeft Direction like this :

righttolefrsnakes

try this code to set RTL direction, but it's not work !?

Snackbar snackbar=Snackbar.with(getApplicationContext())
      .duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE)
      .text("متاسفانه خطایی در ثبت مکان رخ داده است. ")
      .actionLabel("بستن");
snackbar.setLayoutDirection(SnackbarLayout.LAYOUT_DIRECTION_RTL);
snackbar.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_START);
SnackbarManager.show(snackbar,GetActivity());

is there any solution to set Direction Like this ?

Tablet support ?

Hi,

Thanks for this lib.

Do you have plans to support the tablet snackbar style as per the guidelines ?

Reusing same snackbar instance

When reusing the same Snackbar instance, the text and call to action move in the view.
After a third time there's no text left, only the call to action is visible and has moved all the way to the left.

bug

Add a callback for when the dismiss animation starts

In order to properly animate, for example, a FAB, it would be useful to know when the dismiss animation starts, so we can animate them together.

I took a look at the code and this seems pretty easy to do. We just need to:

  • define a new callback on EventListener
  • call it on the onAnimationStart callback of the slideOut Animation.

Allow n listeners

A Snackbar should hold a list of ActionClickListener and EventListener

Problem in SnackbarType.MULTI_LINE

First of all thanks for your work, i tried and came to know SnackbarType.MULTI_LINE isn't making any effect on device with physical screen size greater than 6.0". I'm using Sony's T2 Ultra and the SnackbarType.MULTI_LINE turn into an ellipsized text, and in smaller screen devices, it's working good.

Help is needed and appreciated
Thanks

Dismiss animation

Should slide to bottom instead of fade out. That's how Inbox does it

how to use snackbar in nested preferences

I use preferencefragment with nested preferencescreens. When I'm in a child preferencescreen and a snackbar is shown then it's not visible. If I press back to go back to the parent preferencescreen then I can see the snackbar that was shown in the child preference screen.
Is there a way to show snackbars in child preferencescreens?

2.5.3 problem

2.5.3 fix causes problems on phone devices :)

Snackbar is now wrongly positioned way above bottom bar

Incorrect background color

According to Material Design docs, snackbar background color should be #323232 (100%). I think it's #ff323232 right now.

Dismiss listener

Would it be possible to implement a dismiss listener so that you are notified when the snackbar is dismissed? I can create one for you this week if needsbe.

EventListener parameters should be in pixels, not dp

The parameters for onShow() and onDismiss() should be in pixels, not dp. The height parameter should represent the actual height of the Snackbar, not the maximum height. Also, it might be good to include the width as well for tablet layouts so we can determine if a view (e.g. FAB) needs to move out of the way only if the Snackbar is overlapping it.

I can submit a pull request for these things, but it depends on another one of my pull requests being merged in (#33).

Memory leak

I use a snackbar with the custom duration 10 sec. If a user presses Back when a snackbar is showing, then the activity is finished but it cannot be garbage collected because there is a strong reference to it from the handler queue (due to postDelayed() method call):

Handler -> mDismissRunnable -> Snackbar (outer class) -> Activity

I think it is needed to call removeCallbacks(mDismissRunnable); from onDetachedFromWindow(), for example.

Resources?

Could you also add resource Ids for strings and colors?

SnackBar is shown above opened navigation drawer

I have Fragment which contains ListView placed as DrawerLayout content view. I create a Snackbar instance inside Fragment and attach it to my ListView. Then I open the drawer and Snackbar is displayed above it. In GMail app Snackbar is displayed below the opened drawer. Can I achieve similar behavior somehow?

Сustom height of Snackbar

Hi,
thank you for your hard work and awesome library!

Is there any way to set custom height to Snackbar? Something like:

SnackbarManager.show(
                Snackbar.with(context)
                        .text("Hello, world!")
                        .height(200) // height in dp
                        .duration(Snackbar.SnackbarDuration.LENGTH_LONG));

Thank you in advance!

FC

Snackbar crashes, because textview in snackbar.xml and color in colors.xml had named by the same id snackbar_text.
It throw java.lang.NoSuchFieldError: No static field snackbar_text of type I in class Lcom/nispok/snackbar/R$id; or its superclasses (declaration of 'com.nispok.snackbar.R$id' at com.nispok.snackbar.Snackbar.init(Snackbar.java:226)

Can't use snackbar in Runnable Method?

If i change this Toast to snackbar. It prompts a Error.

public void showToast(final String message)
    {
        this.handler.post(new Runnable()
        {
            public void run()
            {
                  Toast.makeText(RemoteIt.this, message, Toast.LENGTH_SHORT).show();
            }
        });
    }

Tag (or somethin)?

Hey!
First of all - thanks for a superb library.
Secondly - maybe it would be nice to have a String tag (or something) to identify a Snackbar and update already showing, or simply remove the previous Snack?

Activity-independent Snackbar

Feature request: snackbars are seemingly intended as replacements for toasts in Android. However, toasts are not dependent on Activities, they only need a Context, meaning that they can be used from services as well, for instance. Any thoughts about reworking Snackbars to match that behavior?

Action button text should be Roboto Medium

According to the Material Design spec, the action button text should be Roboto Medium, while the message text should be Roboto Regular. I was looking into how to do this, but there doesn't seem to be an easy solution.

One option would be to bundle the Roboto Medium (and Roboto Regular?) fonts with the library and set the TextViews accordingly.

Another option is to add a dependency for a library like
https://github.com/johnkil/Android-RobotoTextView
or
https://github.com/chrisjenx/Calligraphy

I also just came across https://bitbucket.org/josephearl/foundry, which might be helpful.

Any other ideas/thoughts?

Configure Animation

How about choosing the animation? Like bouncing, fading, coming from left to right or the other way around?

Snackbar showing at incorrect vertical offset

I was testing my app on an 4.0.3 emulated device and realized that the snackbar was not actually showing at the bottom of the screen but at an higher offset.

The emulated device I was using does not have navigation button but it does the same for devices with navigation buttons on 4.0.3. To help pin point the problem, this activity is using the new appcompat v7 Toolbar where the activity is set with no action bar and the new toolbar is somewhat part of the content for pre-android 5 devices.

Here's a screenshot of the problem:
device-2014-12-24-231733

Adjust For Navigation Bar.

Great lib!

Is there a way to adjust the snackbar position according to the navbars visibility?

Thanks,
Jon.

Allow indefinite duration for showing errors

The Material Design Spec Sections "App Errors" and "Incompatible state errors" show snackbars being used to communicate different error states:
http://www.google.com/design/spec/patterns/errors.html#errors-app-errors

"Consider displaying an unintrusive but persistent indicator when users are in these states."

However the current implementation requires a definite duration to show. I propose adding a constant SnackbarDuration.INDEFINITE which would keep it on screen, needing to be dismissed by swipe or action.

Crash from some users

Hi,

I've received a null pointer crash on the com.nispok.snackbar.listeners.SwipeDismissTouchListener.onTouch method.

Here is a full report of the crash that might bring you some extra information http://crashes.to/s/5a796486a4a

Thanks in advanced

Snackbar appears behind dialogs

If I show a snackbar in response to a button clicked in a dialog, it shows behind the dialog's dim layer. It should appear on top of everything when summoned IMO

Ability to disable swipe gesture.

I believe it is not defined in the Material Design Guideline. And the new inbox application does not do it. You cannot swipe there. I think it shouldn't be enabled by default.

Added fragment sometimes overlays the snackbar

I see following problem:

When I first add a fragment and this fragment shows a snackbar, everything works. If I remove the fragment and readd a new one, the snackbar shown from the fragment is behind this new fragment... I see it, because when I press back and remove the new fragment and reattach the previous one again, I see the snackbar over the previous fragment...

What works for me, as a work around, is following:

mCurrentSnackbar.show(parent);
mCurrentSnackbar.postDelayed(new Runnable()
{
    @Override
    public void run()
    {
        mCurrentSnackbar.bringToFront();
    }
}, 500);

Snackbar doesn't survive a configuration change

After rotating the device the Snackbar is gone. I'm using SnackbarDuration.LENGTH_INDEFINITE so it should stay.

I guess this is the intended behavior, because it's just a view. Does someone have a best practice for this problem?

show() as a child view

Would it be possible to allow "showing" to place the snackbar as a child of a parent view? This would fix the problem with having to adjust views to show outside of it (FloatingActionButton's, etc).

Make a SnackbarType.INFINITY_LINE

I really need to show more than 2 lines. I fixed it but the fix is ugly. Please support more than 2 lines against the material design rules.

     final Snackbar snackbar = Snackbar.with(this)
                .text(error)
                .actionLabel(R.string.close)
                .duration(Snackbar.SnackbarDuration.LENGTH_LONG)
                .dismissOnActionClicked(true)
                .type(SnackbarType.MULTI_LINE);
        snackbar.show(this);

        // fix: Snackbar doesn't support more than 2 lines.
        TextView snackbarText = (TextView) snackbar.findViewById(R.id.sb__text);
        snackbarText.setMaxLines(25);
        snackbar.setMaxHeight(ViewHelper.dpToPx(context, 400));
        snackbar.requestLayout();

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.