Karamunting.Android.Pradyuman7.ChocoBar

The usual Snackbar with more =??and colours =??


Keywords
android, android-library, android-snackbar, snackbar, toast, material, material-design, droid, mono, mono.droid, xamarin, xamarin-android, xamarin.android, android-development, android-ui, hacktoberfest, hacktoberfest-accepted, hacktoberfest2022, java, library, ui-design
License
MIT
Install
Install-Package Karamunting.Android.Pradyuman7.ChocoBar -Version 1.0.0

Documentation

ChocoBar

Download API Android Arsenal

The usual Snackbar with more 🍫 and colours 🎉. Inspired by Light.

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

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()
		  .show();
  • To display a red ChocoBar:
ChocoBar.builder().setView(v).setText("RED")
			     .setDuration(ChocoBar.LENGTH_INDEFINITE)
			     .setActionText(android.R.string.ok)
			     .red()
			     .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 an MIT license. See the LICENSE file for more info.