Skip to content

Commit 381d473

Browse files
committed
* 优化设置渐变色过程处理
1 parent ea6a4ae commit 381d473

File tree

7 files changed

+24
-11
lines changed

7 files changed

+24
-11
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ArcSeekBar
22

33
[![Download](https://img.shields.io/badge/download-App-blue.svg)](https://raw.githubusercontent.com/jenly1314/ArcSeekBar/master/app/release/app-release.apk)
4-
[![JCenter](https://img.shields.io/badge/JCenter-1.0.1-46C018.svg)](https://bintray.com/beta/#/jenly/maven/arcseekbar)
4+
[![JCenter](https://img.shields.io/badge/JCenter-1.0.2-46C018.svg)](https://bintray.com/beta/#/jenly/maven/arcseekbar)
55
[![JitPack](https://jitpack.io/v/jenly1314/ArcSeekBar.svg)](https://jitpack.io/#jenly1314/ArcSeekBar)
66
[![CI](https://travis-ci.org/jenly1314/ArcSeekBar.svg?branch=master)](https://travis-ci.org/jenly1314/ArcSeekBar)
77
[![CircleCI](https://circleci.com/gh/jenly1314/ArcSeekBar.svg?style=svg)](https://circleci.com/gh/jenly1314/ArcSeekBar)
@@ -63,18 +63,18 @@ ArcSeekBar for Android 是一个弧形的拖动条进度控件,配置参数完
6363
<dependency>
6464
<groupId>com.king.view</groupId>
6565
<artifactId>arcseekbar</artifactId>
66-
<version>1.0.1</version>
66+
<version>1.0.2</version>
6767
<type>pom</type>
6868
</dependency>
6969
```
7070
### Gradle:
7171
```gradle
72-
implementation 'com.king.view:arcseekbar:1.0.1'
72+
implementation 'com.king.view:arcseekbar:1.0.2'
7373
```
7474

7575
### Lvy:
7676
```lvy
77-
<dependency org='com.king.view' name='arcseekbar' rev='1.0.1'>
77+
<dependency org='com.king.view' name='arcseekbar' rev='1.0.2'>
7878
<artifact name='$AID' ext='pom'></artifact>
7979
</dependency>
8080
```
@@ -113,6 +113,9 @@ allprojects {
113113

114114
## 版本记录
115115

116+
#### v1.0.2:2020-12-2
117+
* 优化设置渐变色过程处理
118+
116119
#### v1.0.1:2020-9-16
117120
* 优化细节
118121

app/release/app-release.apk

116 Bytes
Binary file not shown.

app/release/output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":2,"versionName":"1.0.1","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release","dirName":""},"path":"app-release.apk","properties":{}}]
1+
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":3,"versionName":"1.0.2","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release","dirName":""},"path":"app-release.apk","properties":{}}]

app/src/main/java/com/king/view/arcseekbar/app/MainActivity.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package com.king.view.arcseekbar.app;
22

33
import androidx.appcompat.app.AppCompatActivity;
4+
import androidx.core.content.ContextCompat;
45

6+
import android.graphics.Color;
57
import android.os.Bundle;
68
import android.util.Log;
79
import android.view.View;
@@ -25,16 +27,17 @@ protected void onCreate(Bundle savedInstanceState) {
2527
arcSeekBar1 = findViewById(R.id.arcSeekBar1);
2628
arcSeekBar2 = findViewById(R.id.arcSeekBar2);
2729
cb = findViewById(R.id.cb);
30+
2831
cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
2932
@Override
3033
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
3134
arcSeekBar1.setShowTick(isChecked);
3235
arcSeekBar2.setShowTick(isChecked);
3336
}
3437
});
35-
3638
}
3739

40+
3841
public void onClick(View v){
3942
switch (v.getId()){
4043
case R.id.btn1:

arcseekbar/src/main/java/com/king/view/arcseekbar/ArcSeekBar.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ public class ArcSeekBar extends View {
225225
*/
226226
private boolean isEnabledSingle = true;
227227

228+
private boolean isMeasureCircle = false;
229+
228230
private OnChangeListener mOnChangeListener;
229231

230232

@@ -399,6 +401,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
399401

400402
//默认着色器
401403
mShader = new SweepGradient(mCircleCenterX,mCircleCenterX,mShaderColors,null);
404+
isMeasureCircle = true;
402405

403406
setMeasuredDimension(width,height);
404407

@@ -822,8 +825,13 @@ public void setShader(Shader shader){
822825
* @param colors
823826
*/
824827
public void setProgressColor(int... colors){
825-
Shader shader = new SweepGradient(mCircleCenterX,mCircleCenterX,colors,null);
826-
setShader(shader);
828+
if(isMeasureCircle){
829+
Shader shader = new SweepGradient(mCircleCenterX,mCircleCenterX,colors,null);
830+
setShader(shader);
831+
}else{
832+
mShaderColors = colors;
833+
isShader = true;
834+
}
827835
}
828836

829837
/**

arcseekbar/src/main/res/values/attrs.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
<attr name="arcEnabledDrag" format="boolean"/>
3838
<attr name="arcEnabledSingle" format="boolean"/>
3939

40-
4140
</declare-styleable>
4241

4342

versions.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//App
22
def app_version = [:]
3-
app_version.versionCode = 2
4-
app_version.versionName = "1.0.1"
3+
app_version.versionCode = 3
4+
app_version.versionName = "1.0.2"
55
ext.app_version = app_version
66

77
//build version

0 commit comments

Comments
 (0)