Coder Social home page Coder Social logo

chargingview's Introduction

ChargingView

Api reqeust MIT Licence Blog



gif1

中文

一个简单的充电view

使用

在根目录的build.gradle添加这一句代码:

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

在app目录下的build.gradle添加依赖使用:

dependencies {
    implementation 'com.github.samlss:ChargingView:1.1'
}

布局中使用:

<com.iigo.library.ChargingView
            android:id="@+id/cv2"
            android:layout_marginTop="10dp"
            android:layout_width="100dp"
            android:layout_height="200dp"
            app:progress="50"
            app:progressTextColor="@android:color/black"
            app:chargingColor="@android:color/holo_red_light"
            app:bg_color="#eeeeee"
            app:progressTextSize="20dp" />

代码中使用:

  chargingView.setProgress(95);
  chargingView.setBgColor(Color.parseColor("#aaaaaa"));
  chargingView.setChargingColor(Color.YELLOW);
  chargingView.setTextColor(Color.RED);
  chargingView.setTextSize(25);

属性说明:

属性 说明
bg_color 背景颜色
chargingColor 充电中颜色
progress 当前进度0-100
progressTextSize 显示进度text大小
progressTextColor 显示进度text颜色

如果不能满足你的需要,你可以下载源码自行修改。

English

A simple charging view.

Use

Add it in your root build.gradle at the end of repositories:

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

Add it in your app build.gradle at the end of repositories:

dependencies {
    implementation 'com.github.samlss:ChargingView:1.1'
}

in layout.xml:

<com.iigo.library.ChargingView
            android:id="@+id/cv2"
            android:layout_marginTop="10dp"
            android:layout_width="100dp"
            android:layout_height="200dp"
            app:progress="50"
            app:progressTextColor="@android:color/black"
            app:chargingColor="@android:color/holo_red_light"
            app:bg_color="#eeeeee"
            app:progressTextSize="20dp" />

in java code:

  chargingView.setProgress(95);
  chargingView.setBgColor(Color.parseColor("#aaaaaa"));
  chargingView.setChargingColor(Color.YELLOW);
  chargingView.setTextColor(Color.RED);
  chargingView.setTextSize(25);

Attributes description:

attr description
bg_color the background color
chargingColor the charging color
progress current progress:0-100
progressTextSize the progress text size
progressTextColor the progress text color

If you can not meet your needs, you can download the source code to modify it.

License

Copyright (c) 2018 samlss

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

chargingview's People

Contributors

samlss avatar

Watchers

 avatar  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.