Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
uknownothingsnow committed Mar 23, 2021
2 parents 16c3c78 + 489ed4a commit 1180ec9
Show file tree
Hide file tree
Showing 22 changed files with 679 additions and 245 deletions.
39 changes: 26 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ and CleanMaster

###Demo download [link](https://raw.githubusercontent.com/lzyzsd/CircleProgress/master/demos/example.apk)

###3 kinds of progress view are provided, DonutProgress, CircleProgress, ArcProgress
###3 kinds of progress view are provided, DonutProgress (supports inner drawables and VectorDrawables, CircleProgress, ArcProgress

##Usage

Expand All @@ -32,7 +32,7 @@ please use jitpack

```groovy
dependencies {
compile 'com.github.lzyzsd:circleprogress:1.2.1'
compile 'com.github.lzyzsd:circleprogress:1.2.4'
}
```

Expand All @@ -51,6 +51,20 @@ DonutProgress
custom:donut_progress="30"/>
```

```xml
<com.github.lzyzsd.circleprogress.DonutProgress
android:layout_marginLeft="50dp"
android:id="@+id/donut_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
custom:donut_finished_color="#0066FF"
custom:donut_finished_stroke_width="15dp"
custom:donut_inner_drawable="@drawable/ic_vector_star_black_48dp"
custom:donut_show_text="false"
custom:donut_unfinished_color="#f5f5f5"
custom:donut_unfinished_stroke_width="15dp"/>
```

![DonutProgress](https://raw.githubusercontent.com/lzyzsd/CircleProgress/master/demos/donutprogress_demo.png)

attrs for DonutProgress
Expand Down Expand Up @@ -135,16 +149,14 @@ attrs for ArchProgress
</declare-styleable>
```


donut_inner_drawable

support add a drawable to the center
support add a drawable/vectorDrawable to the center

donut_show_text

show or hide bottom text


###Build

run `./gradlew assembleDebug` (Mac/Linux)
Expand All @@ -153,21 +165,22 @@ or

run `gradlew.bat assembleDebug` (Windows)


###Changes

version 1.1.0: add bottom text to DonutProgressView

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Version 2, December 2004

Copyright (C) 2014 Bruce Lee <bruceinpeking#gmail.com>
Copyright (C) 2014 Bruce Lee <bruceinpeking#gmail.com>

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. You just DO WHAT THE FUCK YOU WANT TO.

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. You just DO WHAT THE FUCK YOU WANT TO.
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0-rc2'
classpath 'com.android.tools.build:gradle:3.1.3'
}
}

allprojects {
repositories {
jcenter()
google()
}
}
15 changes: 8 additions & 7 deletions example/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
compileSdkVersion 27

defaultConfig {
minSdkVersion 10
targetSdkVersion 21
minSdkVersion 14
//noinspection OldTargetApi
targetSdkVersion 26
versionCode 2
versionName "1.0.1"
}
Expand All @@ -18,7 +19,7 @@ android {
}

dependencies {
compile project(':library')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
implementation project(':library')
implementation 'com.android.support:appcompat-v7:27.0.1'
implementation 'com.android.support:support-v4:27.0.1'
}
41 changes: 21 additions & 20 deletions example/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http:https://schemas.android.com/apk/res/android"
package="com.github.lzyzsd.circleprogressexample" >
xmlns:tools="http:https://schemas.android.com/tools"
package="com.github.lzyzsd.circleprogressexample">

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<activity
android:name=".MyActivity"
android:label="@string/app_name" >
android:name=".MyActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".ViewPagerActivity" />
<activity android:name=".ViewPagerActivity"/>
<activity
android:name=".ItemListActivity"
android:label="@string/title_item_list" >
android:name=".ItemListActivity"
android:label="@string/title_item_list">
</activity>
<activity
android:name=".ItemDetailActivity"
android:label="@string/title_item_detail"
android:parentActivityName=".ItemListActivity" >
android:name=".ItemDetailActivity"
android:label="@string/title_item_detail"
android:parentActivityName=".ItemListActivity" tools:ignore="UnusedAttribute">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.github.lzyzsd.circleprogressexample.ItemListActivity" />
android:name="android.support.PARENT_ACTIVITY"
android:value="com.github.lzyzsd.circleprogressexample.ItemListActivity"/>
</activity>
<activity
android:name=".ArcInFragment"
android:label="@string/title_activity_arc_in_fragment" >
android:name=".ArcInFragment"
android:label="@string/title_activity_arc_in_fragment">
</activity>
</application>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,36 +1,41 @@
package com.github.lzyzsd.circleprogressexample;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;


public class ArcInFragment extends ActionBarActivity {
public class ArcInFragment extends AppCompatActivity
{

@Override
protected void onCreate(Bundle savedInstanceState) {
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_arc_in_fragment);
}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_arc_in, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
public boolean onOptionsItemSelected(MenuItem item)
{
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
if (id == R.id.action_settings)
{
return true;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.github.lzyzsd.circleprogressexample;

import android.content.Context;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import com.github.lzyzsd.circleprogress.ArcProgress;
import com.github.lzyzsd.circleprogress.CircleProgress;
import com.github.lzyzsd.circleprogress.DonutProgress;

public class CentralTextExampleActivity extends ActionBarActivity {

ArcProgress arcProgress;
CircleProgress circleProgress;
EditText editText;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_central_text_example);

arcProgress = findViewById(R.id.arc_progress);
arcProgress.setText("-50");
arcProgress.setSuffixText("°C");
arcProgress.setProgress(25);

circleProgress = findViewById(R.id.donut_progress);
circleProgress.setProgress(75);

editText = findViewById(R.id.editText);
}

public void setCustomText(View view){
if(String.valueOf(editText.getText()) != null || !String.valueOf(editText.getText()).equals("")) {
arcProgress.setText(String.valueOf(editText.getText()));
circleProgress.setText(String.valueOf(editText.getText()));
} else{
Toast.makeText(this, "Field should not be empty!", Toast.LENGTH_SHORT).show();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v4.app.NavUtils;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;


Expand All @@ -16,10 +16,12 @@
* This activity is mostly just a 'shell' activity containing nothing
* more than a {@link ItemDetailFragment}.
*/
public class ItemDetailActivity extends ActionBarActivity {
public class ItemDetailActivity extends AppCompatActivity
{

@Override
protected void onCreate(Bundle savedInstanceState) {
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_item_detail);

Expand All @@ -35,24 +37,27 @@ protected void onCreate(Bundle savedInstanceState) {
//
// http:https://developer.android.com/guide/components/fragments.html
//
if (savedInstanceState == null) {
if (savedInstanceState == null)
{
// Create the detail fragment and add it to the activity
// using a fragment transaction.
Bundle arguments = new Bundle();
arguments.putString(ItemDetailFragment.ARG_ITEM_ID,
getIntent().getStringExtra(ItemDetailFragment.ARG_ITEM_ID));
getIntent().getStringExtra(ItemDetailFragment.ARG_ITEM_ID));
ItemDetailFragment fragment = new ItemDetailFragment();
fragment.setArguments(arguments);
getSupportFragmentManager().beginTransaction()
.add(R.id.item_detail_container, fragment)
.commit();
.add(R.id.item_detail_container, fragment)
.commit();
}
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
public boolean onOptionsItemSelected(MenuItem item)
{
int id = item.getItemId();
if (id == android.R.id.home) {
if (id == android.R.id.home)
{
// This ID represents the Home or Up button. In the case of this
// activity, the Up button is shown. Use NavUtils to allow users
// to navigate up one level in the application structure. For
Expand Down
Loading

0 comments on commit 1180ec9

Please sign in to comment.