ToastLibrary

Additional

Language
Java
Version
N/A
Created
Nov 8, 2016
Updated
Nov 16, 2016 (Retired)
Owner
Droidbyme (droidbyme)
Contributor
Droidbyme (droidbyme)
1
Activity
Badge
Generate
Download
Source code
APK file

Promotion

ToastLib

ToastLib is Library for Customize Toast.

Methods for implement

// ToastEnum.SHORT or ToastEnum.LONG . // Toast background color . // Toast content textcolor . // Toast content textsize (in SP), default is 20 . // Typeface for applying font to text . // true or false, for style bold to content . // to apply fontAwesome icon, put fa-string in param . // to add icon (drawable) in toast . // to apply tint color on icon . // icon size in dp, default is (24, 24) . // corner radius for content, default is 4dp . // margin from bottom/top (if Gravity is top then margin count from TOP and same for Bottom), default is 36 . // padding for inner content (default is 4) . // space between icon and content, default is 8 . // toast UI stroke width and strokecolor . // Gravity for placing toast ( . // to show toast .show()

gravity(int Gravity)
NOTE: .margin apply only for TOP and BOTTOM Gravity)

stroke(int strokeWidth, int strokeColor)


spacing(int spacing)


padding(int padding)


margin(int margin)


corner(int radius)


iconSize(int w, int h)


iconColor(int iconColor)


icon(int icon)


icon(String faString)


isBold(boolean isBold)


typeface(Typeface ttf)


textSize(int size)


textColor(int textColor)


backgroundColor(int backgroundColor)


duration(ToastEnum enum)


Usage new ToastLib.Builder(this, "Login Success")    .duration(ToastEnum.SHORT)    .backgroundColor(ContextCompat.getColor(this, R.color.green))    .textColor(ContextCompat.getColor(this, R.color.black))    .textSize(18)    .typeface(Typeface.createFromAsset(getAssets(), "fonts/OpenSans-Regular.ttf"))    .isBold(true)    .icon(getString(R.string.fa_success))    .icon(R.drawable.ic_check_black_24dp)    .iconColor(ContextCompat.getColor(this, R.color.black))    .iconSize(24, 24)    .corner(8)    .margin(56)    .padding(36)    .spacing(16)    .stroke(2, ContextCompat.getColor(this, R.color.dark_green))    .gravity(Gravity.BOTTOM)    .show(); ToastLib.success(this, "Success", Typeface.createFromAsset(getAssets(), "fonts/OpenSans-Regular.ttf")); ToastLib.error(this, "Ooops! Try Again..", Typeface.createFromAsset(getAssets(), "fonts/OpenSans-Regular.ttf")); ToastLib.progress(this, "Loading..", Typeface.createFromAsset(getAssets(), "fonts/OpenSans-Regular.ttf"));


For Loading/Progress Toast



For Error Toast



For Success Toast




















For Custom Toast