All Projects → v2rc → Badger

v2rc / Badger

Licence: Apache-2.0 license
A badge for any drawable 🔴

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Badger

MadeWithUnityBadges
GitHub-ReadMe-Bagdes displaying "Made With Unity" with the Unity-Logo, based on shields.io badges, in markdown
Stars: ✭ 17 (-70.69%)
Mutual labels:  badge, badges
badgemaker
The Nim badgemaker tool.
Stars: ✭ 15 (-74.14%)
Mutual labels:  badge, badges
laravel-gamify
Laravel Gamify: Gamification System with Points & Badges support
Stars: ✭ 35 (-39.66%)
Mutual labels:  badge, badges
Open Source Badges
Open Source & Licence Badges
Stars: ✭ 368 (+534.48%)
Mutual labels:  badge, badges
Badgeforappicon
The unread badges of the android launcher icon.
Stars: ✭ 83 (+43.1%)
Mutual labels:  badge, badges
autobadge
Simple CLI tool to generate essential repository badges with ease
Stars: ✭ 16 (-72.41%)
Mutual labels:  badge, badges
github-profile-achievements
A collection listing all Achievements available on the GitHub profile 🏆
Stars: ✭ 1,060 (+1727.59%)
Mutual labels:  badge, badges
Badgeview
a BadeView base on android
Stars: ✭ 654 (+1027.59%)
Mutual labels:  badge, badges
Badges4 Readme.md Profile
👩‍💻👨‍💻 Improve your README.md profile with these amazing badges.
Stars: ✭ 929 (+1501.72%)
Mutual labels:  badge, badges
Google Play Badge Svg
Hosting for localized versions of Google Play badges in SVG format.
Stars: ✭ 137 (+136.21%)
Mutual labels:  badge, badges
vscode-exts
Visual Studio Code Extensions
Stars: ✭ 33 (-43.1%)
Mutual labels:  badge, badges
maintainer
👨‍💻 🐳 Generate personal daily reports or summary, AUTHORS, CONTRIBUTING, CHANGELOG and so on for GitHub user or repository.
Stars: ✭ 199 (+243.1%)
Mutual labels:  badges
CP-Badges
Support for Competitive Coding badges to add in Github readme or portfolio websites.
Stars: ✭ 78 (+34.48%)
Mutual labels:  badges
phpbadge
A PHP library to build badges as seen in README's of many open source libraries.
Stars: ✭ 24 (-58.62%)
Mutual labels:  badge
jest-badges-readme
Creates a group of coverage badges from Jest into your README
Stars: ✭ 30 (-48.28%)
Mutual labels:  badge
silly-android
Android plugins for Java, making core Android APIs easy to use
Stars: ✭ 40 (-31.03%)
Mutual labels:  drawables
ShortcutBadger
Xamarin.Android library supports badge notification like iOS in Samsung, LG, Sony and HTC launchers. Port of
Stars: ✭ 24 (-58.62%)
Mutual labels:  badges
duing
😱 The progress bar / status badge of SVG generator service
Stars: ✭ 68 (+17.24%)
Mutual labels:  badge
travis-ci-tutorial-java
Just to learn how to use travis-ci in a java project!
Stars: ✭ 38 (-34.48%)
Mutual labels:  badge
sympetrum-v2
A communicative piece of wearable electronics.
Stars: ✭ 22 (-62.07%)
Mutual labels:  badge

Icon Badger

Build Release Versions Arsenal

Badger is a generalized single purpose library for adding badges to drawables in general and menu items in particular.

sett (also set) - The earth or burrow of a badger.

Running with the Badger theme, it is all about the method sett. Home to the badger, it is comprised of many tunnels and several entrances. It is the ideal entry point to provide you with badges where mere drawables lived before.

Usage

The Badger.sett() methods add a BadgeDrawable to the original drawable. This results in a LayerDrawable with the BadgeDrawable added to the layer with id badger_drawable. If the original drawable is a LayerDrawable having a badge already set, this one gets reused instead.

Add a badge to a MenuItem

BadgeDrawable badge = Badger.sett(menuItem, badgeFactory);

Add a badge to an ImageView

BadgeDrawable badge = Badger.sett(imageView, badgeFactory);

Add a badge to a Drawable

Badger<?> badger = Badger.sett(drawable, badgeFactory);
BadgeDrawable badge = badger.badge;
drawable = badger.drawable;

The BadgeDrawable

The BadgeDrawable implements handling of alpha values and color filters for a default Drawable. Badger includes a general TextBadge with a single purpose implementation CountBadge.

The BadgeDrawable.Factory

The type of the badge itself is determined by the implementation of the BadgeDrawable.Factory supplied.

public interface Factory<T extends BadgeDrawable> {
    T createBadge();
}

The provided BadgeDrawable implementations define their own factories TextBadge.Factory and CountBadge.Factory.

The BadgeShape

The BadgeShape is a simplified version of an Android Shape to be used with TextBadge. With its scale, aspectRatio and gravity it defines the actual size and position of the badge itself.

BadgeShape itself provides factories for circle, square, oval, rect, round-rect and round-square.

Example

BadgeShape.oval(1f, 2f, Gravity.BOTTOM) // scale = 1 | aspectRatio = 2
BadgeShape.square(1f, Gravity.NO_GRAVITY, .5f) // scale = 1 | radiusFactor = 0.5
BadgeShape.circle(.5f, Gravity.END | Gravity.TOP) // scale = 0.5

scale

The scale determines the actual size of the badge drawable relative to the size of the original drawable.

aspectRatio

The aspectRatio determines the actual shape of the badge itself. It is the ratio between width and height. A value bigger than 1 makes the badge wider than high, a value smaller than 1 makes it higher than wide.

gravity

The gravity determines the actual position of the badge inside the original drawable. Layout directions are supported.

radiusFactor

The radiusFactor determines the actual radius of the circle, used to round the corners of the rectangle, relative to the radius of the inner circle of the badge.

Installation

Add the updated dependency supporting AndroidX

dependencies {
    implementation "com.github.v2rc:badger:$badgerVersion"
}

or the legacy version supporting the Support Library

dependencies {
    implementation 'berlin.volders:badger:0.2.1'
}

Shortcomings

The TextBadge only supports the RTL layout direction for Android Marshmallow and later.

License

Copyright (C) 2016 Christian Schmitz
Copyright (C) 2016 volders GmbH with <3 in Berlin

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].