Android Widget

Overview

Circular Counter

Circular Counter is an Android Widget I needed to implement for an application I was developing. As it could be useful to more people, I tried to make it generic enough to share and be used by others.

The view shows a value in the center together with 3 bars that grow depending on the values received. Digging into the code you can easily increase or decrease the number of bars.

Android app on Google Play

Android Arsenal

Screenshot

Demo Screenshot

Usage

Add CircularCounter widget to your layout. Configure the view customization elements using styleable attributes or/and programatically. This is a basic example, explore the code to get to know it in detail.

    <com.db.circularcounter.CircularCounter
        xmlns:counter="http://schemas.android.com/apk/res-auto"
        android:id="@+id/counter"
        android:layout_width="300dp"
        android:layout_height="300dp"
        counter:range="60"
        counter:textSize="100sp"
        counter:textColor="#ffffff"
        counter:metricSize="20sp"
        counter:metricText="metric"
    />
    //First Bar
    counter.setFirstWidth(getResources().getDimension(R.dimen.first))
    counter.setFirstColor(Color.parseColor(colors[0]))

    //Second Bar
    counter.setSecondWidth(getResources().getDimension(R.dimen.second))
    counter.setSecondColor(Color.parseColor(colors[1]))

    //Third Bar
    counter.setThirdWidth(getResources().getDimension(R.dimen.third))
    counter.setThirdColor(Color.parseColor(colors[2]))
            
    counter.setBackgroundColor(Color.parseColor(colors[3]));

To pass values to the view use setValues(value1, value2, value3). First value will be the one shown in text.

You might also like...
TourGuide is an Android library that aims to provide an easy way to add pointers with animations over a desired Android View

TourGuide TourGuide is an Android library. It lets you add pointer, overlay and tooltip easily, guiding users on how to use your app. Refer to the exa

Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.
Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.

Bubbles for Android Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your

View that imitates Ripple Effect on click which was introduced in Android L  (for Android 2.3+)
View that imitates Ripple Effect on click which was introduced in Android L (for Android 2.3+)

RippleView View that imitates Ripple Effect on click which was introduced in Android L. Usage For a working implementation, Have a look at the Sample

A new canvas drawing library for Android. Aims to be the Fabric.js for Android. Supports text, images, and hand/stylus drawing input. The library has a website and API docs, check it out

FabricView - A new canvas drawing library for Android. The library was born as part of a project in SD Hacks (www.sdhacks.io) on October 3rd. It is cu

MarkdownView is an Android webview with the capablity of loading Markdown text or file and display it as HTML, it uses MarkdownJ and extends Android webview.
MarkdownView is an Android webview with the capablity of loading Markdown text or file and display it as HTML, it uses MarkdownJ and extends Android webview.

About MarkdownView (Markdown For Android) is an Android library that helps you display Markdown text or files (local/remote) as formatted HTML, and st

SwipeBack for Android Activities to do pretty the same as the android
SwipeBack for Android Activities to do pretty the same as the android "back-button" will do, but in a really intuitive way by using a swipe gesture

SwipeBack SwipeBack is for Android Activities to do pretty the same as the android "back-button" will do, but in a really intuitive way by using a swi

A backport of the SwitchPreference component that was introduced on Android 4 (ICS / level 14). This port works on Android 2.1+ (Eclair MR1 / level 7).

Android Switch Preference Backport A backport of the SwitchPreference component that was introduced on Android 4 (ICS / level 14). This port works on

Wizard Pager is a library that provides an example implementation of a Wizard UI on Android, it's based of Roman Nurik's wizard pager (https://github.com/romannurik/android-wizardpager)
Wizard Pager is a library that provides an example implementation of a Wizard UI on Android, it's based of Roman Nurik's wizard pager (https://github.com/romannurik/android-wizardpager)

Wizard Pager Wizard Pager is a library that provides an example implementation of a Wizard UI on Android, it's based of Roman Nurik's wizard pager (ht

Sample project created to show some of the best Android practices to work in the Android UI Layer. The UI layer of this project has been implemented using MVP or MVVM (without binding engine) to show how this patterns works. This project is used during the talk
Comments
  • Failed to resolve com.github.diogobernardino:CircularCounter:5a6a405282

    Failed to resolve com.github.diogobernardino:CircularCounter:5a6a405282

    i have this code in my gradle repositories { maven { url "https://jitpack.io" } } dependencies { compile('com.github.diogobernardino:CircularCounter:5a6a405282') { exclude group: 'com.android.support', module: 'support-v4' }

    repositories {
        mavenCentral()
    }
    dependencies {
        compile 'me.leolin:ShortcutBadger:1.1.3@aar'
    }
    

    } but i have the error "faied to resolve com.github.diogobernardino:CircularCounter:5a6a405282" ??

    opened by elabedkhaled 3
  • Project unavailable from jitpack.io

    Project unavailable from jitpack.io

    This is an error I get (also the same if selecting different version and adding @aar signature)

    Error:(41, 13) Failed to resolve: com.github.diogobernardino:CircularCounter:-SNAPSHOT Show in File
    Show in Project Structure dialog

    opened by ghost 0
  • Improper args passed

    Improper args passed

    Great work man :) Would like to bring to your notice that In your CircularCounter.java mOneBounds = new Rect(left, top, right, bottom). You seem to have it as mOneBounds = new Rect(top, left, right, bottom)

    opened by deepakbaliga 0
Owner
Diogo Bernardino
Diogo Bernardino
segmentcontrol widget for android

中文 a simple SegmentControl Widget 使用: 添加依赖到build.gradle: dependencies { compile 'com.7heaven.widgets:segmentcontrol:1.17' } 相关属性: selectedColor 设置

7heaven 614 Nov 26, 2022
Android Thermometer Widget.

Thermometer Android Thermometer Widget. Developer Kofi Gyan ([email protected]) License Copyright 2016 Kofi Gyan. Licensed under the Apache Licen

Kofi Gyan 125 Nov 17, 2022
Custom wheel widget for android

Wheel widget for Android To include the wheel widget in the current layout, you should add in the layout xml this lines: <it.sephiroth.android

Alessandro Crugnola 384 Nov 21, 2022
Android Widget

Circular Counter Circular Counter is an Android Widget I needed to implement for an application I was developing. As it could be useful to more people

Diogo Bernardino 254 Nov 25, 2022
A Pin view widget for Android

PinView A Pin view widget for Android. PinView has a feature that allows you to find out when they have completed all parameters. Support for Android

David Pizarro 287 Nov 14, 2022
This is a sample Android Studio project that shows the necessary code to create a note list widget, And it's an implementation of a lesson on the Pluralsight platform, but with some code improvements

NoteKeeper-Custom-Widgets This is a sample Android Studio project that shows the necessary code to create a note list widget, And it's an implementati

Ibrahim Mushtaha 3 Oct 29, 2022
A library that provides an implementation of the banner widget from the Material design.

MaterialBanner A banner displays a prominent message and related optional actions. MaterialBanner is a library that provides an implementation of the

Sergey Ivanov 252 Nov 18, 2022
It's a flip way to show share widget.

What's FlipShare ? It's a cool way to show share widget. Demo Usage step 1. Confirm your parentView to locate the share widget, and then you can custo

巴掌 630 Sep 5, 2022
TabSlider - An expanding slider widget which displays selected value

TabSlider - An expanding slider widget which displays selected value

null 1 Apr 20, 2022
Android library used to create an awesome Android UI based on a draggable element similar to the last YouTube graphic component.

Draggable Panel DEPRECATED. This project is not maintained anymore. Draggable Panel is an Android library created to build a draggable user interface

Pedro Vicente Gómez Sánchez 3k Dec 6, 2022