GithubHelp home page GithubHelp logo

leejihyeong / chocobar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pradyuman7/chocobar

0.0 0.0 0.0 200 KB

The usual Snackbar with more ๐Ÿซ and colours :tada:

License: MIT License

Java 100.00%

chocobar's Introduction

ChocoBar

ChocoBar Download API AwesomeAndroid Android Arsenal

The usual Snackbar with more ๐Ÿซ and colours ๐ŸŽ‰. Inspired by Light.

GIF

AndroidPub Post

You can read the AndroidPub post about this library, the reason of it's existence, the perks it provides and other details, here.

Versions

Version 1.0

First release of ChocoBar

Version 1.1

Minor bug fixes and performance improvement

Version 1.2

New good gray and bad gray ChocoBar additions and rtl languages support

Screenshots

Preview of Different kinds of ChocoBars you can use

screenshot 2018-12-31 at 4 26 25 am screenshot 2018-12-31 at 4 24 32 am screenshot 2018-12-31 at 4 25 38 am screenshot 2018-12-31 at 4 25 09 am screenshot 2018-12-31 at 4 26 00 am screenshot 2018-12-31 at 4 26 00 am screenshot 2018-12-31 at 4 26 00 am

Prerequisites

Add this in your root build.gradle file (not your module build.gradle file):

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

Dependency

Add this to your module's build.gradle file (make sure the version matches the JitPack badge above):

dependencies {
	        implementation 'com.github.Pradyuman7:ChocoBar:V1.0'
}

Usage

Each method always returns a Snackbar object, so you can customize the Snackbar and much more. Check out the following examples:

  • To display a green ChocoBar:
ChocoBar.builder().setActivity(MainActivity.this)
		  .setText("GREEN")
		  .setDuration(ChocoBar.LENGTH_SHORT)
		  .green()  // in built green ChocoBar
		  .show();
  • To display a red ChocoBar:
ChocoBar.builder().setView(v)
		  .setText("RED")
	 	  .setDuration(ChocoBar.LENGTH_INDEFINITE)
		  .setActionText(android.R.string.ok)
		  .red()   // in built red ChocoBar
		  .show();
  • To display a gray ChocoBar:
ChocoBar.builder().setView(v)
                  .setText("GRAY_GOOD")
		  .centerText()
		  .setDuration(ChocoBar.LENGTH_LONG)
		  .good()
		  .show();
		  
ChocoBar.builder().setView(v)
	          .setText("GRAY_BAD")
		  .centerText()
		  .setDuration(ChocoBar.LENGTH_LONG)
		  .bad()
		  .show();
  • To display a simple ChocoBar with a button and some action on clicking the button.
ChocoBar.builder().setActivity(MainActivity.this).setActionText("ACTION")
		.setActionClickListener(new View.OnClickListener() {
                	@Override
                	public void onClick(View v) {
                     		Toast.makeText(MainActivity.this,"You clicked",Toast.LENGTH_LONG).show();
                	}
                	})
		.setText("This is a normal ChocoBar")
		.setDuration(ChocoBar.LENGTH_INDEFINITE)
		.build()
		.show();
  • You can also create custom ChocoBars with tons of customizations like this:
ChocoBar.builder().setBackgroundColor(Color.parseColor("#00bfff"))
		  .setTextSize(18)
		  .setTextColor(Color.parseColor("#FFFFFF"))
		  .setTextTypefaceStyle(Typeface.ITALIC)
	          .setText("This is a custom Chocobar")
		  .setMaxLines(4)
		  .centerText()
		  .setActionText("ChocoBar")
		  .setActionTextColor(Color.parseColor("#66FFFFFF"))
	  	  .setActionTextSize(20)
		  .setActionTextTypefaceStyle(Typeface.BOLD)
		  .setIcon(R.mipmap.ic_launcher)
		  .setActivity(MainActivity.this)
		  .setDuration(ChocoBar.LENGTH_INDEFINITE)
		  .build()
	  	  .show();
            

Pull Request

Have some new ideas or found a bug? Do not hesitate to open an issue and make a pull request.

License

ChocoBar is under License: MIT. See the LICENSE file for more info.

chocobar's People

Contributors

behzadbx avatar leejihyeong avatar mtjin avatar pradyuman7 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.