Skip to content

Commit

Permalink
* 优化设置渐变色过程处理
Browse files Browse the repository at this point in the history
  • Loading branch information
jenly1314 committed Dec 2, 2020
1 parent ea6a4ae commit 381d473
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 11 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ArcSeekBar

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

### Lvy:
```lvy
<dependency org='com.king.view' name='arcseekbar' rev='1.0.1'>
<dependency org='com.king.view' name='arcseekbar' rev='1.0.2'>
<artifact name='$AID' ext='pom'></artifact>
</dependency>
```
Expand Down Expand Up @@ -113,6 +113,9 @@ allprojects {

## 版本记录

#### v1.0.2:2020-12-2
* 优化设置渐变色过程处理

#### v1.0.1:2020-9-16
* 优化细节

Expand Down
Binary file modified app/release/app-release.apk
Binary file not shown.
2 changes: 1 addition & 1 deletion app/release/output.json
Original file line number Diff line number Diff line change
@@ -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":{}}]
[{"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":{}}]
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.king.view.arcseekbar.app;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;

import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
Expand All @@ -25,16 +27,17 @@ protected void onCreate(Bundle savedInstanceState) {
arcSeekBar1 = findViewById(R.id.arcSeekBar1);
arcSeekBar2 = findViewById(R.id.arcSeekBar2);
cb = findViewById(R.id.cb);

cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
arcSeekBar1.setShowTick(isChecked);
arcSeekBar2.setShowTick(isChecked);
}
});

}


public void onClick(View v){
switch (v.getId()){
case R.id.btn1:
Expand Down
12 changes: 10 additions & 2 deletions arcseekbar/src/main/java/com/king/view/arcseekbar/ArcSeekBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ public class ArcSeekBar extends View {
*/
private boolean isEnabledSingle = true;

private boolean isMeasureCircle = false;

private OnChangeListener mOnChangeListener;


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

//默认着色器
mShader = new SweepGradient(mCircleCenterX,mCircleCenterX,mShaderColors,null);
isMeasureCircle = true;

setMeasuredDimension(width,height);

Expand Down Expand Up @@ -822,8 +825,13 @@ public void setShader(Shader shader){
* @param colors
*/
public void setProgressColor(int... colors){
Shader shader = new SweepGradient(mCircleCenterX,mCircleCenterX,colors,null);
setShader(shader);
if(isMeasureCircle){
Shader shader = new SweepGradient(mCircleCenterX,mCircleCenterX,colors,null);
setShader(shader);
}else{
mShaderColors = colors;
isShader = true;
}
}

/**
Expand Down
1 change: 0 additions & 1 deletion arcseekbar/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
<attr name="arcEnabledDrag" format="boolean"/>
<attr name="arcEnabledSingle" format="boolean"/>


</declare-styleable>


Expand Down
4 changes: 2 additions & 2 deletions versions.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//App
def app_version = [:]
app_version.versionCode = 2
app_version.versionName = "1.0.1"
app_version.versionCode = 3
app_version.versionName = "1.0.2"
ext.app_version = app_version

//build version
Expand Down

0 comments on commit 381d473

Please sign in to comment.