Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error messages remain after closing app, obscuring other apps #233

Open
mikeantonacci opened this issue Nov 8, 2015 · 5 comments
Open

Comments

@mikeantonacci
Copy link
Contributor

Steps to reproduce: select several buses that will give an error, then immediately close the app or switch to another app before all messages have appeared on screen.

What happens: error messages remain on screen, obscuring other apps.

What should happen: error messages disappear immediately.

@epicstar
Copy link
Member

epicstar commented Nov 9, 2015

So... This is actually not a bug.

Apparently for toasts, they're made for system messages (phone-wide)... hence if you exit and stuff, the toast messages show up through the whole phone.

The solution? We should use a SnackBar instead of the toast! Here is the code below:

    /**
     * General way to make a snackbar
     *
     * @since 46
     * @param string - the string to add to on the
     * @param showLength - how long to show the snackbar
     */
    private void makeSnackbar(String string, int showLength) {
        if(string != null && string.length() > 0) {

            Snackbar.make(mainLayout,
                    string, showLength
            ).show();
        }

    }

So then, if you have this sort of code, why not abide by Material Design and show these errors in a Snackbar? Contrary to what the Snackbar documentation says... Snackbars are not transient at all........

There is a bug that exactly explains the issue.

http://stackoverflow.com/questions/33264764/when-is-snackbar-isqueued-used-how-to-queue-the-snackbar

In other words, the Snackbar seems to be bugged......

Solutions that I -- someone who can't deal with UI well -- can think of:

  1. Waste 5 hours of time to fix something that seems to be a Design Library Bug
  2. Move to Dialogs -> no.......
  3. Make an indefinite length Snackbar until fixed -> Possibly
  4. Increase the length of time snackbars appear but have an X button -> could have bad consequences
  5. Improve transient messages (doing) and use Toasts until fixed -> Current Solution

@VincentIII - what do you think T_T

I'll make a task for Snackbars at some point.

@epicstar
Copy link
Member

Please star... assuming this is a real issue:

https://code.google.com/p/android/issues/detail?id=193752&thanks=193752&ts=1447177236

@mikeantonacci
Copy link
Contributor Author

The core issue still exists, but as of 6.4rc all toasts are LENGTH_SHORT which should mitigate this somewhat.

@epicstar
Copy link
Member

epicstar commented Jul 1, 2016

I talked to @TheAndroidMaster about this, and we seem to have some sort of plan to go forward for this. He'll be working on changing toasts to snackbars. He told me that the snackbars should just close and then open a new one instead of stacking on each other so he'll investigate why our snackbars aren't doing that.

@fennifith
Copy link
Collaborator

This is mostly fixed with pull request #284. The issue here was that the Snackbars were being attached to a DrawerLayout instead of a CoordinatorLayout. I've added one to temporarily contain the fragment, this will probably be used for later improvements as well if we want to define the action bar in the layout file or something.

There is a small issue that snackbars made from the nav drawer aren't visible, but we were thinking of replacing it anyway so it shouldn't matter. Otherwise, we could always just replace the calls in the navigation drawer with toasts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants