Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
###TextDrawable
### TextDrawable
This light-weight library provides images with letter/text like the Gmail app. It extends the `Drawable` class thus can be used with existing/custom/network `ImageView` classes. Also included is a [fluent interface](http://en.wikipedia.org/wiki/Fluent_interface) for creating drawables and a customizable `ColorGenerator`.

<p align="center"><img src ="https://github.com/amulyakhare/TextDrawable/blob/master/screens/screen1-material.png" width="350"/>
<img src ="https://github.com/amulyakhare/TextDrawable/blob/master/screens/screen2-material.png" width="350"/>
</p>

###How to use

### How to use

#### Import with Gradle:

Expand All @@ -17,11 +18,11 @@ repositories{
}

dependencies {
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
}
```

####1. Create simple tile:
#### 1. Create simple tile:

<p align="center"><img src ="https://github.com/amulyakhare/TextDrawable/blob/master/screens/screen3.png"/>
</p>
Expand All @@ -40,7 +41,7 @@ ImageView image = (ImageView) findViewById(R.id.image_view);
image.setImageDrawable(drawable);
```

####2. Create rounded corner or circular tiles:
#### 2. Create rounded corner or circular tiles:

<p align="center"><img src ="https://github.com/amulyakhare/TextDrawable/blob/master/screens/screen6.png"/>
</p>
Expand All @@ -53,7 +54,7 @@ TextDrawable drawable2 = TextDrawable.builder()
.buildRound("A", Color.RED);
```

####3. Add border:
#### 3. Add border:

<p align="center"><img src ="https://github.com/amulyakhare/TextDrawable/blob/master/screens/screen5.png"/>
</p>
Expand All @@ -66,7 +67,7 @@ TextDrawable drawable = TextDrawable.builder()
.buildRoundRect("A", Color.RED, 10);
```

####4. Modify font style:
#### 4. Modify font style:

```java
TextDrawable drawable = TextDrawable.builder()
Expand All @@ -80,7 +81,7 @@ TextDrawable drawable = TextDrawable.builder()
.buildRect("a", Color.RED)
```

####5. Built-in color generator:
#### 5. Built-in color generator:

```java
ColorGenerator generator = ColorGenerator.MATERIAL; // or use DEFAULT
Expand All @@ -99,9 +100,9 @@ TextDrawable.IBuilder builder = TextDrawable.builder()
// reuse the builder specs to create multiple drawables
TextDrawable ic1 = builder.build("A", color1);
TextDrawable ic2 = builder.build("B", color2);
```
```

####6. Specify the width / height:
#### 6. Specify the width / height:

```xml
<ImageView android:layout_width="wrap_content"
Expand All @@ -122,12 +123,12 @@ ImageView image = (ImageView) findViewById(R.id.image_view);
image.setImageDrawable(drawable);
```

####7. Other features:
#### 7. Other features:

1. Mix-match with other drawables. Use it in conjunction with `LayerDrawable`, `InsetDrawable`, `AnimationDrawable`, `TransitionDrawable` etc.

2. Compatible with other views (not just `ImageView`). Use it as background drawable, compound drawable for `TextView`, `Button` etc.

3. Use multiple letters or `unicode` characters to create interesting tiles.
3. Use multiple letters or `unicode` characters to create interesting tiles.

<p align="center"><img src ="https://github.com/amulyakhare/TextDrawable/blob/master/screens/screen7.png" width="350"/></p>