Git Product home page Git Product logo

ksnack's Introduction

KSnack

API Android Arsenal Downloads Twitter Follow

You can create customized Snackbar with KSnack. KSnack has 2 view type; KSnack and Minimal KSnack.

Minimal KSnack

  1. Initialize Minimal KSnack.
MinimalKSnack minimalKSnack = new MinimalKSnack(MainActivity.this);
  1. Set Features. Styles; STYLE_DEFAULT, STYLE_INFO, STYLE_SUCCESS, STYLE_ERROR, STYLE_WARNING
minimalKSnack
    .setMessage("This is minimal KSnack !") // message
    .setStyle(MinimalKSnackStyle.STYLE_SUCCESS) // style
    .setBackgroundColor(R.color.colorGray) // background color
    .setBackgrounDrawable(R.drawable.background_ex_one) // background drawable
    .setAnimation(Fade.In.getAnimation(), Fade.Out.getAnimation()) // show and hide animations
    .setDuration(4000) // you can use for auto close.
    .alignBottom() // bottom align option.
    .show(); 
  1. Close Minimal KSnack.
minimalKSnack.dismiss();

KSnack

  1. Initialize KSnack.
KSnack kSnack = new KSnack(MainActivity.this);
  1. Set Features.
kSnack
  .setListener(new KSnackBarEventListener() { // listener
      @Override
      public void showedSnackBar() {
          System.out.println("Showed");
      }

      @Override
      public void stoppedSnackBar() {
          System.out.println("Stopped");
      }
  })
  .setAction("Text", new View.OnClickListener() { // name and clicklistener
      @Override
      public void onClick(View v) {
          System.out.println("Your action !");
      }
  })
  .setMessage("Your message.") // message
  .setTextColor(R.color.white) // message text color
  .setBackColor(R.color.colorGray) // background color
  .setButtonTextColor(R.color.white) // action button text color
  .setBackgrounDrawable(R.drawable.background_ex_one) // background drawable
  .setAnimation(Slide.Up.getAnimation(kSnack.getSnackView()), Slide.Down.getAnimation(kSnack.getSnackView()))
  .setDuration(4000) // you can use for auto close.
  .show(); 
  1. Close Minimal KSnack.
kSnack.dismiss();

Animations

1. Fade

kSnack.setAnimation(Fade.In.getAnimation(), Fade.Out.getAnimation()) // show and hide animations

2. Slide

minimalKSnack.setAnimation(Slide.Down.getAnimation(minimalKSnack.getSnackView()), Slide.Up.getAnimation(minimalKSnack.getSnackView()))   

Slide animations need KSnack or MinimalKSnack view. You should use getSnackView() or getMinimalSnackView() functions for correct view object.

Installation

Step 1. Add the JitPack repository to your build file.

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

Step 2. Add the dependency.

dependencies {
  implementation 'com.github.onurkagan:KSnack:1.1.2'
}

ksnack's People

Contributors

onurkagan avatar qijaz221 avatar tanishq777 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ksnack's Issues

Typefaces

You wrote customizable typeface function for ksnack. This is a good feature for this package. Thank you. Can you write this for minimalksnack ?

@qijaz221

**REQUEST**

Minimal KSnack:

  • Add setPosition: TOP || BOTTOM

  • Add isDismissable: TRUE || FALSE

(if the user wants it to stay there and it doesn't get dismissed)

  • Add Slide down and Slide up animations

Thank you for the the good effort you put on there! one of the best SnackBars libs out there!

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.