GithubHelp home page GithubHelp logo

baofei / loadtoast Goto Github PK

View Code? Open in Web Editor NEW

This project forked from code-mc/loadtoast

0.0 2.0 0.0 1.5 MB

Pretty material design toasts with feedback animations

License: Apache License 2.0

Java 100.00%

loadtoast's Introduction

Load Toast Library

The default toasts are ugly and don't really provide much more than a short message. This small library provides a better toast which will give the user feedback by morphing into a checkmark or cross (success and fail). The lifetime of the toast is completely controlled by you.

Demo

Usage

Step 1

Gradle

dependencies {
    compile 'net.steamcrafted:load-toast:1.0.6'
}

Step 2

The API is very simple, create a new toast by providing a context:

LoadToast lt = new LoadToast(context);

Change the displayed text:

lt.setText("Sending Reply...");

Then proceed to show the toast:

lt.show();

When your background thingy is done provide feedback to the user and hide the toast:

// Call this if it was successful
lt.success();

// Or this method if it failed
lt.error();

If you are using translucent actionbar in a full screen activity it will appear over the actionbar, fortunately there is a method to change the y translation:

lt.setTranslationY(100); // y offset in pixels

You can also change the colors of the different toast elements:

lt.setTextColor(Color.RED).setBackgroundColor(Color.GREEN).setProgressColor(Color.BLUE);

These can be chained as you can see.

#License

Released under the Apache 2.0 License

loadtoast's People

Contributors

code-mc avatar

Watchers

James Cloos avatar 鲍飞 avatar

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.