Giter VIP home page Giter VIP logo

mytoast's Introduction

MyToast

toast的封装,包括单例化,成功和失败的提示吐司,解决小米手机不弹出吐司的坑爹问题.

Deprecated

此库不再维护,新库地址请看: https://github.com/hss01248/ToastFinal

特点

1.可以选择使用系统toast还是自定义队列的toast.在init方法里指定就可以了.

2.兼容小米手机,处理了其toast不可见的问题: miui8以下,使用自定义队列的toast, miui8以上,使用系统吐司.

3.提供了成功和失败的两个自定义ui的吐司.这两个状态吐司会按指定时长显示.(默认short)

使用

拷贝demo中提供的包装类MyToast来使用,作为包装层,

避免直接使用库内部的类(ToastUtil和CustomToastUtil).

添加gradle依赖:

Step 1. Add the JitPack repository to your build file

gradle

Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url "https://jitpack.io" }
	}
}

Step 2. Add the dependency

dependencies {
        compile 'com.github.glassLake:MyToast:1.0.1'
}

提供有以下方法:

初始化:


Application初始化时传入相应参数:
init(@NonNull Application context, @NonNull Handler mainHandler, boolean isDebugMode,boolean isUseCustomToast)

使用时静态方法调用:

showToast(String text)

cancelToast()

showDebugToast( String text)

showLongToast( String text)

showSuccessToast(String text)

showFailToast(String text)

成功和失败状态吐司的ui:

带有阴影效果

fail

success

感谢(Thanks)

SuperToasts

ToastCompat

shape画一个阴影

mytoast's People

Contributors

hss01248 avatar

Stargazers

 avatar  avatar  avatar  avatar 周嘉 avatar  avatar  avatar Weven avatar Huang Ying avatar Joshua Hwang avatar  avatar  avatar

Watchers

 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.