Skip to content

jrvansuita/IconHandler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

42 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Buy Me a Coffee at ko-fi.com Get it on Google Play

Icon Handler

This is an Android project. This library handle the drawable customization and position on View, EditText, ImageView, TextView, Button and etc. You can do a lot with a few lines of code, like change the icon color, alpha or even the size. This library has a lot more customization and features than is able to show here. Please check the sample app and feel free to help with a pull request.


Android Arsenal MaterialUp

Appetize.io Demo Codacy Badge API

Setup

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

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

Step #2. Add the dependency (See latest release).

dependencies {
       compile 'com.github.jrvansuita:IconHandler:+'
}

Implamentation

//Setting up a icon on background of a View.
Icon.put(yourView, R.mipmap.your_icon);

//Setting up a icon on the ImageView.
Icon.put(yourImageView, R.mipmap.your_icon);

//Setting up a icon on the left of the TextView. Also can use right(), top() and bottom() methods.
Icon.left(yourTextView, R.mipmap.your_icon);

//Setting up a icon on MenuItem
Icon.on(yourMenuItem).icon(R.mipmap.your_icon).put();

//Setting up a icon to the ImageView and converting it to blue.
Icon.top(yourTextView).gray(R.mipmap.your_icon).put();

//Setting up a icon to the ImageView and converting it to your custom color.
Icon.on(yourImageView).color(R.color.your_color).icon(R.mipmap.your_icon).put();

//Setting up a bitmap as a icon.
Icon.right(yourTextView).bitmap(yourBitmap).put();

//Setting up a icon on dynamic position
Icon.on(yourTextView).icon(R.mipmap.your_icon).position(Gravity.LEFT).put();

//You can merge the usage with colors transformations.
Icon.on(yourImageView).black(R.mipmap.your_icon).put();

//Setting up a icon to the ImageView and applying alpha. (0-255)
Icon.on(yourImageView).white(R.mipmap.your_icon).alpha(130).put();

//Will make the icon appears weak. Receiving focus will reveals the real color of icon.
Icon.focusable(yourEditText, R.mipmap.your_icon, Gravity.RIGHT);

//Just another edit text to lose the focus of the first.
Icon.focusable(yourEditText).position(Gravity.RIGHT).icon(R.mipmap.your_icon).put();

yourImageButton.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
         //Clearing all icons of the View.
         Icon.clear(yourImageButton);
      }
    });

Instagram Github Google Play Store E-mail