Skip to content

Commit

Permalink
fixed warkiz#69 , update readme about proguard.
Browse files Browse the repository at this point in the history
  • Loading branch information
warkiz committed Jun 10, 2018
1 parent d79bc3b commit ef44743
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 19 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This is a customizable SeekBar library on Android. Also, If you don't need indic
## Setup

```gradle
implementation 'com.github.warkiz.widget:indicatorseekbar:2.0.5'
implementation 'com.github.warkiz.widget:indicatorseekbar:2.0.6'
```

## Usage
Expand Down Expand Up @@ -245,6 +245,12 @@ seekBar.setOnSeekChangeListener(new OnSeekChangeListener() {
});
```

## Proguard

``` groovy
-dontwarn com.warkiz.widget.**
```

## Attributes

[ attr.xml ](https://github.com/warkiz/IndicatorSeekBar/blob/master/indicatorseekbar/src/main/res/values/attr.xml)
Expand Down
9 changes: 8 additions & 1 deletion README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
## 初始化

```gradle
implementation 'com.github.warkiz.widget:indicatorseekbar:2.0.5'
implementation 'com.github.warkiz.widget:indicatorseekbar:2.0.6'
```

## 使用
Expand Down Expand Up @@ -243,6 +243,13 @@ seekBar.setOnSeekChangeListener(new OnSeekChangeListener() {
});
```

## 混淆配置

``` groovy
-dontwarn com.warkiz.widget.**
```


## 属性

[ attr.xml ](https://github.com/warkiz/IndicatorSeekBar/blob/master/indicatorseekbar/src/main/res/values/attr.xml)
Expand Down
6 changes: 3 additions & 3 deletions indicatorseekbar/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apply plugin: 'com.android.library'

def VERSION_NAME = "2.0.5"
def VERSION_NAME = "2.0.6"

ext {
bintrayRepo = 'maven'
Expand Down Expand Up @@ -49,5 +49,5 @@ dependencies {
}


//apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
//apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public class IndicatorSeekBar extends View {
private boolean mSeekSmoothly;//seek continuously
private float[] mProgressArr;//save the progress which at tickMark position.
private boolean mR2L;//right to left,compat local problem.
private int mSeekBarScreenX;
//tick texts
private boolean mShowTickText;//the palace where the tick text show .
private int mTickTextsHeight;//the height of text
Expand Down Expand Up @@ -1298,8 +1297,8 @@ private void updateStayIndicator() {
}
int indicatorOffset;
int arrowOffset;
if (measuredWidth / 2 + thumbCenterX > mScreenWidth - mSeekBarScreenX) {
indicatorOffset = (int) (mScreenWidth - measuredWidth - mSeekBarScreenX);
if (measuredWidth / 2 + thumbCenterX > mMeasuredWidth) {
indicatorOffset = mMeasuredWidth - measuredWidth;
arrowOffset = (int) (thumbCenterX - indicatorOffset - measuredWidth / 2);
} else if (thumbCenterX - measuredWidth / 2 < 0) {
indicatorOffset = 0;
Expand Down Expand Up @@ -1454,8 +1453,7 @@ private void apply(Builder builder) {
/**
* first showing when initial for indicator stay always.
*/
void updateStayIndicator(int seekBarScreenX) {
this.mSeekBarScreenX = seekBarScreenX;
void showStayIndicator() {
mIndicatorContentView.setVisibility(INVISIBLE);
postDelayed(new Runnable() {
@Override
Expand All @@ -1469,8 +1467,14 @@ public void run() {
}, 300);
}

View getIndicatorContentView(boolean indicatorStayAlways) {
/**
* @param indicatorStayAlways IndicatorStayLayout call this, always true.
*/
void setIndicatorStayAlways(boolean indicatorStayAlways) {
this.mIndicatorStayAlways = indicatorStayAlways;
}

View getIndicatorContentView() {
return mIndicatorContentView;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public void attachTo(IndicatorSeekBar seekBar, int index) {
private void layoutIndicator(View child, int index) {
if (child instanceof IndicatorSeekBar) {
IndicatorSeekBar seekBar = (IndicatorSeekBar) child;
View contentView = seekBar.getIndicatorContentView(true);
seekBar.setIndicatorStayAlways(true);
View contentView = seekBar.getIndicatorContentView();
if (contentView == null) {
throw new IllegalStateException("Can not find any indicator in the IndicatorSeekBar, please " +
"make sure you have called the attr: SHOW_INDICATOR_TYPE for IndicatorSeekBar and the value is not IndicatorType.NONE.");
Expand All @@ -86,7 +87,7 @@ private void layoutIndicator(View child, int index) {
layoutParams.setMargins(layoutParams.leftMargin, layoutParams.topMargin,
layoutParams.rightMargin, SizeUtils.dp2px(seekBar.getContext(), 2) - seekBar.getPaddingTop());
addView(contentView, index, layoutParams);
seekBar.updateStayIndicator(getViewScreenX());
seekBar.showStayIndicator();
}
}

Expand All @@ -99,10 +100,4 @@ public void setOrientation(int orientation) {
super.setOrientation(orientation);
}

private int getViewScreenX() {
int[] mLocation = new int[2];
getLocationOnScreen(mLocation);
return mLocation[0];
}

}

0 comments on commit ef44743

Please sign in to comment.