Coder Social home page Coder Social logo

vineshchauhan24 / circularstatusview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 3llomi/circularstatusview

0.0 1.0 0.0 654 KB

A Simple View that draws portions of a Circle depending on a number , just like what WhatsApp has done for Status

Java 100.00%

circularstatusview's Introduction

CircularStatusView

A Simple View that draws portions of a Circle depending on a number , just like what WhatsApp has done for Status

Demo

Install

Add this to your project build.gradle

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

Add this to your module build.gradle

dependencies {
  implementation 'com.github.3llomi:CircularStatusView:V1.0.2'
}

Usage

NOTE:you can replace CircleImageView with any view

XML

 <?xml version="1.0" encoding="utf-8"?>
  <RelativeLayout
        android:id="@+id/image_layout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="8dp"
        android:layout_marginTop="8dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent">


        <de.hdodenhof.circleimageview.CircleImageView
            android:layout_width="75dp"
            android:layout_height="75dp"
            android:layout_centerInParent="true"
            android:padding="6dp"
            android:src="@mipmap/ic_launcher" />

        <com.devlomi.circularstatusview.CircularStatusView
            android:id="@+id/circular_status_view"
            android:layout_width="75dp"
            android:layout_height="75dp"
            android:layout_centerInParent="true"
            app:portion_color="@color/colorAccent"
            app:portion_spacing="4dp"
            app:portion_width="4dp"
            app:portions_count="8" />


    </RelativeLayout>

Java

Basic Usage

        CircularStatusView circularStatusView = findViewById(R.id.record_view);
        circularStatusView.setPortionsCount(statusList.size());
        circularStatusView.setPortionsColor(getResources().getColor(R.color.colorAccent););

Advanced Usage

            if (userStatus.areAllSeen()) {
                //set all portions color
                circularStatusView.setPortionsColor(seenColor);
            } else {
                for (int i = 0; i < statusList.size(); i++) {
                    Status status = statusList.get(i);
                    int color = status.isSeen() ? seenColor : notSeenColor;
                    //set specific color for every portion
                    circularStatusView.setPortionColorForIndex(i, color);
                }

            }

for more info please check the sample app

Customization

            circularStatusView.setPortionSpacing(5);//set the spacing between portions
            circularStatusView.setPortionWidth(10);//set portion width
            circularStatusView.setCustomPaint(myPaint); //create your custom paint for portions
   Copyright 2018 AbdulAlim Rajjoub

   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.

circularstatusview's People

Contributors

3llomi avatar zihadrizkyef avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.