Painter

General

Category
Free
Tag
Styling
License
MIT License
Min SDK
5 (Android 2.0 Eclair)
Registered
Jul 21, 2014
Favorites
2
Link
https://github.com/agrosner/Painter
See also
Stylish Widget
DressCode
Chameleon
Easel

Additional

Language
Java
Version
N/A
Created
Jul 18, 2014
Updated
Nov 18, 2014 (Retired)
Owner
Andrew Grosner (agrosner)
Contributor
Andrew Grosner (agrosner)
1
Activity
Badge
Generate
Download
Source code

Promotion

Painter

Why use different colors of the same asset when you can include one color and change it to fit your needs? Also how do you handle dynamic changes such as when you use a drawer and want to do some really neat effects? This library enables you to color a view, image icons, and text in a very simple way.

Usage

PreRequisites

  1. This project includes android support-v4:20.+ and appcompat-v7:20.+. I will make sure to make a version using only native dependencies or without appcompat.
  2. This project currently compiles with API 20 and buildToolsVersion 20.0.0, hopefully there will be a way to use project level in the future.
  3. MinSdk is 5, however with appcompat and support that is upped to 8. I will try to make it lower for non-support libraries.
  4. This project is currently in active development. Using the development branch has no guarantees of working functionality and or/breaking changes to code. The best bet is the master branch for all stable releases, or by using a remote aar dependency.

Including in your project

  1. Clone this repo
  2. Go to your build.gradle file
dependencies{
  compile 'com.github.agrosner:library:1.0.+'
  
  //or locally in the a folder named "Libraries"
  compile project(':Libraries:Painter');
}



Background Painting

Background painting will take the background of the item you pass in (namely it's background drawable) and change the color as well. It is strongly advised you do not paint the actionbar background more than once on first load as this is extremely inefficient due to the fact we cannot easily retrieve the background drawable once it is set on the actionbar.

//we can use many View, MenuItem's action view, or ActionBars new BackgroundPainter(cloneDrawable, Color.BLUE).paint(view, actionView, actionBar);

//can use different paints if you want new BackgroundPainter().paintColor(cloneDrawable, Color.Blue, objects);

### Sliders Sliders describe mutating a property from one value to the next based on a ratio from 0 to 1. <br /> Supported Sliders include: * AlphaSlider * ColorSlider * Create your own *PropertySlider* class #### Alpha Slider This will set the background alpha on the object you pass in whether its an ActionBar, MenuItem, or View. ```java //"slideOffset" is a number from 0...1 and "myObjects" is a varg param that operates on multiple objects new AlphaSlider(startFullAlpha).onSlide(slideOffset, myObjects); //this will set the color of the actionbar and begin sliding. // this required for an actionbar as there is no easy way to acquire the ActionBar drawable background new ActionBarAlphaSlider(startFullAlpha, actionBar, startColor);