Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 14 additions & 13 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ a circle progress bar with effect

```

## Install
```implementation 'com.github.immimu:RingProgress:1.0.0'```

## About me

An android developer in Hangzhou.
Expand Down
16 changes: 8 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
compileSdkVersion 29

defaultConfig {
applicationId "com.ldoublem.ringProgress"
minSdkVersion 15
targetSdkVersion 24
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -20,11 +20,11 @@ android {
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.0'
testCompile 'junit:junit:4.12'
compile project(':ringprogresslibrary')
implementation 'androidx.appcompat:appcompat:1.1.0'
testImplementation 'junit:junit:4.12'
implementation project(':ringprogresslibrary')
}
89 changes: 40 additions & 49 deletions app/src/main/java/com/ldoublem/ringProgress/Test2Activity.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,12 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.WindowManager;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.SeekBar;
import android.widget.Toast;

import com.ldoublem.ringPregressLibrary.OnSelectRing;
import androidx.appcompat.app.AppCompatActivity;
import com.ldoublem.ringPregressLibrary.Ring;
import com.ldoublem.ringPregressLibrary.RingProgress;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;
Expand All @@ -32,20 +26,32 @@ public class Test2Activity extends AppCompatActivity {
Random random = new Random();
List<Ring> mlistRing = new ArrayList<>();

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);//去掉信息栏
setContentView(R.layout.layout_test2);
getSupportActionBar().hide();

mRingProgress = (RingProgress) findViewById(R.id.lv_ringp);
mRingProgress.setDrawBg(false);
setData(maxTime, maxTime + "'", "Countdown", Color.rgb(86, 171, 228), Color.argb(100, 86, 171, 228));
private Handler mHandle = new Handler() {

@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
// mLVRingProgress.setProgress(msg.arg1);
if (msg.what == 0) {
int p = maxTime - msg.arg1;

}
if (p > 60) {
setData(p, p + "'", "Countdown", Color.rgb(86, 171, 228),
Color.argb(100, 86, 171, 228));
} else if (p > 30) {
setData(p, p + "'", "Countdown", Color.rgb(17, 205, 110),
Color.argb(100, 17, 205, 110));
} else {
setData(p, p + "'", "Countdown", Color.rgb(235, 79, 56),
Color.argb(100, 235, 79, 56));
}
} else {
Toast.makeText(Test2Activity.this, "ok", Toast.LENGTH_SHORT).show();
setData(maxTime, maxTime + "'", "Countdown", Color.rgb(86, 171, 228),
Color.argb(100, 86, 171, 228));
}
}
};


private void setData(int progress, String value, String title, int startColor,
Expand Down Expand Up @@ -108,45 +114,30 @@ private void startProgressAnim() {
timerTaskLVRingProgress();
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);//去掉信息栏
setContentView(R.layout.layout_test2);
getSupportActionBar().hide();

mRingProgress = findViewById(R.id.lv_ringp);
mRingProgress.setDrawBg(false);
setData(maxTime, maxTime + "'", "Countdown", Color.rgb(86, 171, 228),
Color.argb(100, 86, 171, 228));
}

private void stopProgressAnim() {
if (mTimerLVRingProgress != null) {
mTimerLVRingProgress.cancel();
int p = maxTime - (int) (mValueLVRingProgress);
int p = maxTime - mValueLVRingProgress;
setData(p, p + "'", "Pause", Color.rgb(234, 128, 16), Color.argb(100, 234, 128, 16));


}
}


private Handler mHandle = new Handler() {

@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
// mLVRingProgress.setProgress(msg.arg1);
if (msg.what == 0) {
int p = maxTime - (int) (msg.arg1);


if (p > 60) {
setData(p, p + "'", "Countdown", Color.rgb(86, 171, 228), Color.argb(100, 86, 171, 228));

} else if (p > 30) {
setData(p, p + "'", "Countdown", Color.rgb(17, 205, 110), Color.argb(100, 17, 205, 110));

} else {
setData(p, p + "'", "Countdown", Color.rgb(235, 79, 56), Color.argb(100, 235, 79, 56));

}
} else {
Toast.makeText(Test2Activity.this, "ok", Toast.LENGTH_SHORT).show();
setData(maxTime, maxTime + "'", "Countdown", Color.rgb(86, 171, 228), Color.argb(100, 86, 171, 228));

}
}
};

@Override
protected void onDestroy() {
super.onDestroy();
Expand Down
21 changes: 8 additions & 13 deletions app/src/main/java/com/ldoublem/ringProgress/TestActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,16 @@
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.WindowManager;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.SeekBar;
import android.widget.Toast;


import androidx.appcompat.app.AppCompatActivity;
import com.ldoublem.ringPregressLibrary.OnSelectRing;
import com.ldoublem.ringPregressLibrary.Ring;
import com.ldoublem.ringPregressLibrary.RingProgress;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;
Expand Down Expand Up @@ -47,19 +42,19 @@ protected void onCreate(Bundle savedInstanceState) {

getSupportActionBar().hide();

mRingProgress = (RingProgress) findViewById(R.id.lv_ringp);
mRingProgress = findViewById(R.id.lv_ringp);
mRingProgress.setOnSelectRing(new OnSelectRing() {
@Override
public void Selected(Ring r) {
Toast.makeText(TestActivity.this, r.getName(), Toast.LENGTH_SHORT).show();
}
});
mSeekBar = (SeekBar) findViewById(R.id.sb_with);
mSeekBar2 = (SeekBar) findViewById(R.id.sb_rotate);
mSeekBar3 = (SeekBar) findViewById(R.id.sb_sweepAngle);
mCheckBox = (CheckBox) findViewById(R.id.cb_background);
mCheckBox2 = (CheckBox) findViewById(R.id.cb_corner);
mCheckBox3 = (CheckBox) findViewById(R.id.cb_shadow);
mSeekBar = findViewById(R.id.sb_with);
mSeekBar2 = findViewById(R.id.sb_rotate);
mSeekBar3 = findViewById(R.id.sb_sweepAngle);
mCheckBox = findViewById(R.id.cb_background);
mCheckBox2 = findViewById(R.id.cb_corner);
mCheckBox3 = findViewById(R.id.cb_shadow);
setData();
mSeekBar.setProgress((int) (mRingProgress.getRingWidthScale() * 100));
mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
Expand Down
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

buildscript {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0-beta2'
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -14,7 +17,9 @@ buildscript {

allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
18 changes: 10 additions & 8 deletions ringprogresslibrary/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'

group ="com.ldoublem.ringProgressLibrary"

android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
compileSdkVersion 29

defaultConfig {
minSdkVersion 15
targetSdkVersion 24
targetSdkVersion 29
versionCode 1
versionName "1.0"
versionName "1.0.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

Expand All @@ -22,10 +24,10 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.0'
testCompile 'junit:junit:4.12'
implementation 'androidx.appcompat:appcompat:1.1.0'
testImplementation 'junit:junit:4.12'
}
27 changes: 10 additions & 17 deletions ringprogresslibrary/src/main/res/values/ringprogress_style.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
<resources>


<declare-styleable name="RingProgress">
<attr name="bgColor" format="color|reference"></attr>
<attr name="bgShadowColor" format="color|reference"></attr>
<attr name="rotate" format="integer"></attr>
<attr name="showBackground" format="boolean"></attr>
<attr name="showBackgroundShadow" format="boolean"></attr>
<attr name="showRingCorner" format="boolean"></attr>
<attr name="ringWidthScale" format="float"></attr>
<attr name="ringSweepAngle" format="integer"></attr>



</declare-styleable>


<declare-styleable name="RingProgress">
<attr format="color|reference" name="bgColor"/>
<attr format="color|reference" name="bgShadowColor"/>
<attr format="integer" name="rotate"/>
<attr format="boolean" name="showBackground"/>
<attr format="boolean" name="showBackgroundShadow"/>
<attr format="boolean" name="showRingCorner"/>
<attr format="float" name="ringWidthScale"/>
<attr format="integer" name="ringSweepAngle"/>
</declare-styleable>
</resources>