Android BadgedImageView

Place Badges on your ImageView to describe the content.

License

License

GroupId

GroupId

com.klinkerapps
ArtifactId

ArtifactId

badged_imageview
Last Version

Last Version

1.0.5
Release Date

Release Date

Type

Type

aar
Description

Description

Android BadgedImageView
Place Badges on your ImageView to describe the content.
Project URL

Project URL

https://github.com/klinker24/Android-BadgedImageView
Source Code Management

Source Code Management

https://github.com/klinker24/Android-BadgedImageView

Download badged_imageview

How to add to project

<!-- https://jarcasting.com/artifacts/com.klinkerapps/badged_imageview/ -->
<dependency>
    <groupId>com.klinkerapps</groupId>
    <artifactId>badged_imageview</artifactId>
    <version>1.0.5</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.klinkerapps/badged_imageview/
implementation 'com.klinkerapps:badged_imageview:1.0.5'
// https://jarcasting.com/artifacts/com.klinkerapps/badged_imageview/
implementation ("com.klinkerapps:badged_imageview:1.0.5")
'com.klinkerapps:badged_imageview:aar:1.0.5'
<dependency org="com.klinkerapps" name="badged_imageview" rev="1.0.5">
  <artifact name="badged_imageview" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.klinkerapps', module='badged_imageview', version='1.0.5')
)
libraryDependencies += "com.klinkerapps" % "badged_imageview" % "1.0.5"
[com.klinkerapps/badged_imageview "1.0.5"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Android BadgedImageView

Screenshot

Easily add badges to an ImageView to describe its content.

Recently, in Talon for Twitter, one of my challenges was that you couldn't tell if media was a GIF, video, YouTube, etc. All the images just had the generic play button on them. This library, based off of Plaid, was my way to fix that.

Google+ uses a very similar style in their own app.

Features

Place a badge over the top of the ImageView to describe its content.

  • Use any text you like
  • Change the badge color
  • Change the placement of the badge using Gravity
  • Change the padding on the badge

Installation

There are two ways to use this library:

As a Gradle dependency

This is the preferred way. Simply add:

dependencies {
    compile 'com.klinkerapps:badged_imageview:1.0.5'
}

to your project dependencies and run ./gradlew build or ./gradlew assemble.

As a library project

Download the source code and import it as a library project in Eclipse. The project is available in the folder library. For more information on how to do this, read here.

Example Usage

Functionality can be found in the example's MainActivity. Badges on BadgedImageView can be added (or changed) from code:

badgedIv.setBadge("YouTube", Color.RED);
badgedIv.setBadge("GIF"); // default badge color is white

or they can be defined in XML layout:

<com.klinker.android.badged_imageview.BadgedImageView
    android:id="@+id/badged_iv"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    android:src="@drawable/gif"
    android:layout_margin="12dp"
    android:scaleType="centerCrop"
    app:badgeGravity="start|bottom"
    app:badgePadding="12dp"
    app:badgeColor="@android:color/white"
    app:badgeText="GIF" />

Contributing

Please fork this repository and contribute back using pull requests. Features can be requested using issues. All code, comments, and critiques are greatly appreciated.

Changelog

The full changelog for the library can be found here.

License

Copyright 2016 Luke Klinker

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.

Versions

Version
1.0.5
1.0.4
1.0.2
1.0.1
1.0.0