• This repository has been archived on 17/Jul/2023
  • Stars
    star
    108
  • Rank 321,259 (Top 7 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created about 9 years ago
  • Updated about 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Fill Drawable

Maven Central

Introduction

Convert any Drawable into filled drawable depending on progress value (.0F - 100.F). One image resource is used. No overdraw, no bitmap allocations.

There are 4 possible directions of progress: from_left, from_top, from_right, from_bottom

Usage

The idea behind FillDrawable is PorterDuffColorFilter, one for normal state & one for progress. The best image resource to use would be solid white

// obtain a Drawable object
final Drawable drawable = getDrawable(...);

// initialize bounds
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());

// create a FillDrawable
// Note, that you should call `mutate()`, otherwise changes made by FillDrawable
// will be reflected in other places where this drawable is used.
// It has to do it Android drawable cache
final FillDrawable fillDrawable = new FillDrawable(FillDrawable.FROM_LEFT, drawable.mutate())
    .setNormalColor(int color)
    .setFillColor(int color);

...

fillDrawable.setFillPercent(float percent);

Also, there is a FillImageView widget to initialize FillDrawable via XML. Attributes:

app:fiv_normalColor="@color/normal_color"
app:fiv_fillColor="@color/fill_color"
app:fiv_drawable="@drawable/ic_launcher"
app:fiv_from="left" <!-- (left|top|right"bottom) -->
app:fiv_percent="50.0"

License

  Copyright 2015 Dimitry Ivanov ([email protected])

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

More Repositories

1

Markwon

Android markdown library (no WebView)
Java
2,758
star
2

Scrollable

Android scrollable tabs
Java
1,237
star
3

ScrollingBackgroundView

Endless scrolling background with drawable tiling
Java
359
star
4

Enhance

Add API information (since/deprecation) to Android source code as javadoc tags
Java
81
star
5

Debug

Android logging utility
Java
62
star
6

Storm

Android SQLite database manager
Java
53
star
7

Prism4j

Simplified Java clone of prism-js
Java
51
star
8

ColorCrossFade

Color cross fade utility for Android
Java
46
star
9

Flatten

Flatten json response with Flatten & Gson
Java
35
star
10

SharedPreferencesGenerator

Android annotation based SharedPreferences Generator
Java
30
star
11

ScriptJava

Java REPL today
Java
21
star
12

Handle

Handler-based Eventbus for Android
Java
18
star
13

SimplePrefs

Android SharedPreferences made easy
Java
14
star
14

ParcelGen

Android easy Parcelable
Java
7
star
15

BuildTimeGradleCodeGen

The most trivial (and hacky) code generation with Gradle for Android
7
star
16

Lifebus

Lifecycle events bus for Android
Java
7
star
17

Tumbleweed-Tutorial

Create complex Android animations with Tumblweed library
Java
7
star
18

Requirements

Small utility library for Android to evaluate requirements in order for some action to proceed. For example: network connection, permissions (API 23), system services (location, bluetooth, ...), etc.
Java
7
star
19

Adapt

RecyclerView.Adapter only shorter
Kotlin
5
star
20

Storm2.0

Java
4
star
21

DemoUi

Command line tool to access Android Demo Ui
Java
3
star
22

ViewTypes

Android adapter view types abstraction
Java
3
star
23

CursorMock

CursorMock for Android
Java
3
star
24

DrawableUtils

Java
3
star
25

Lazy

Utility to postpone initialisation of a value
Java
2
star
26

SqlBuilder

Utility to build SQL statement with binding of named arguments
Java
2
star
27

BlogProjects

https://noties.io
Kotlin
2
star
28

StopShip

A convenience utility around Android's STOPSHIP functionality with build-in Lint support
Kotlin
2
star
29

android-prettify

Java
2
star
30

RxTask

Java
1
star
31

IconView

One image resource for multiple colors
Java
1
star
32

GithubPackageRegistryAndroid

Playground for Github Package Registry Android artifacts built with Gradle
Java
1
star
33

NullSafe

Null safe flow for Java & Android
Java
1
star
34

todo

Java
1
star
35

Remodel

Java
1
star
36

Tasker

Java
1
star
37

Permissions

Android permissions
Java
1
star
38

Maqueta

Java
1
star
39

Listeners

Simple data structure with iteration and adding/removal of elements without copying of underlying collection
Java
1
star