MySnack

Additional

Language
Java
Version
2.3 (Apr 2, 2019)
Created
Nov 16, 2017
Updated
Apr 2, 2019 (Retired)
Owner
Ankit Dubey (ankitdubey021)
Contributor
Ankit Dubey (ankitdubey021)
1
Activity
Badge
Generate
Download
Source code

Advertisement

MySnack 🔴

Very user friendly library for Snackbar. you can easily customize this according to you. MySnack provides adding textcolor, background color,fontsize,time duration, listener and many more thing by just adding a single line.

Use this library:

Step1) Add library to your app level build file

implementation 'com.github.ankitdubey021:MySnack:2.3'

Step 2) In project level build file, add the jitpack repository

  allprojects {
  repositories {
   ...
   maven { url 'https://jitpack.io' }
   maven { url"http://maven.google.com" }
  }
  }

Now sync the project.

Finally in your activity file use the library as follows:

 new MySnack.SnackBuilder(this)
                .setText("Are you sure?")  
                .setTextColor("#ffffff")   //optional
                .setTextSize(20)           //optional
                .setBgColor("#2196F3")      //optional
  .setDurationInSeconds(10)  //will display for 10 seconds
                .setActionBtnColor("#f44336") //optional
  
  .setIcon(Icon.WARNING)
                //or  .setIcon(R.drawable.ic_info_black_24dp)
  
                .setActionListener("Ok", new View.OnClickListener() {  //optional
                    @Override
                    public void onClick(View view) {
                        Toast.makeText(getApplicationContext(),"done",Toast.LENGTH_LONG).show();
                    }
                })
                .build();
- every setter method is optional, but build() must be called at last.
 
 this library provides 3 predefined icons like Icon.SUCCESS, Icon.WARNING and Icon.ERROR
  if you want any other icon, you can set as follows
+  .setIcon(R.drawable.ic_info_black_24dp)

MIT License

Copyright (c) 2017 Ankit Dubey

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.