Skip to content

Commit

Permalink
compact warkiz#120
Browse files Browse the repository at this point in the history
  • Loading branch information
warkiz committed Dec 8, 2018
1 parent 9122629 commit 78c3847
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 22 deletions.
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/thumb.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<solid android:color="#FF7E00"/>

<size
android:width="12dp"
android:height="12dp"/>
</shape>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/tick_mark.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<solid android:color="#122200"/>

<size
android:width="12dp"
android:height="12dp"/>
</shape>
1 change: 1 addition & 0 deletions app/src/main/res/layout/continuous.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
app:isb_only_thumb_draggable="true"
app:isb_show_indicator="circular_bubble"
app:isb_show_tick_texts="true"
app:isb_thumb_drawable="@drawable/thumb"
app:isb_ticks_count="2" />

</com.warkiz.widget.IndicatorStayLayout>
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/res/layout/custom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,19 @@
app:isb_tick_marks_color="#FFFFFFFF"
app:isb_ticks_count="6" />

<TextView
style="@style/subtitle_text_style"
android:text="8. thumb_drawable=@drawable/thumb, tick_drawable=@drawable/tick_mark" />

<com.warkiz.widget.IndicatorSeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:isb_progress="20"
app:isb_thumb_drawable="@drawable/thumb"
app:isb_thumb_size="26dp"
app:isb_tick_marks_drawable="@drawable/tick_mark"
app:isb_ticks_count="6" />

<include layout="@layout/source_code_link" />

</LinearLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

/**
* Created by zhuangguangquan on 2017/12/13.
* <p>
* https://github.com/warkiz/IndicatorSeekBar
*/

public class CircleBubbleView extends View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

/**
* created by zhuangguangquan on 2017/9/9
* <p>
* https://github.com/warkiz/IndicatorSeekBar
*/
public class Indicator {
private final int mWindowWidth;
Expand Down Expand Up @@ -289,7 +291,7 @@ public void setContentView(@NonNull View customIndicatorView) {
* call this method to replace the current indicator with a new indicator view, indicator arrow will be replace ,too.
*
* @param customIndicatorView a new content view for indicator.
* @param progressTextView this TextView will show the progress or tick text, must be found in @param topContentView
* @param progressTextView this TextView will show the progress or tick text, must be found in @param customIndicatorView
*/
public void setContentView(@NonNull View customIndicatorView, TextView progressTextView) {
this.mProgressTextView = progressTextView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1018,10 +1018,7 @@ private void initThumbBitmap() {
if (mThumbDrawable == null) {
return;
}
if (mThumbDrawable instanceof BitmapDrawable) {
mThumbBitmap = getDrawBitmap(mThumbDrawable, true);
mPressedThumbBitmap = mThumbBitmap;
} else if (mThumbDrawable instanceof StateListDrawable) {
if (mThumbDrawable instanceof StateListDrawable) {
try {
StateListDrawable listDrawable = (StateListDrawable) mThumbDrawable;
Class<? extends StateListDrawable> aClass = listDrawable.getClass();
Expand Down Expand Up @@ -1049,12 +1046,12 @@ private void initThumbBitmap() {
throw new IllegalArgumentException("the format of the selector thumb drawable is wrong!");
}
} catch (Exception e) {
throw new RuntimeException("Something wrong happened when parsing thumb selector drawable." + e.getMessage());
mThumbBitmap = getDrawBitmap(mThumbDrawable, true);
mPressedThumbBitmap = mThumbBitmap;
}

} else {
//please check your selector drawable's format, please see above to correct.
throw new IllegalArgumentException("Nonsupport this drawable's type for custom thumb drawable!");
mThumbBitmap = getDrawBitmap(mThumbDrawable, true);
mPressedThumbBitmap = mThumbBitmap;
}
}

Expand All @@ -1077,17 +1074,8 @@ private void initThumbBitmap() {
* </selector>
*/
private void initTickMarksBitmap() {
if (mTickMarksDrawable instanceof BitmapDrawable) {
mUnselectTickMarksBitmap = getDrawBitmap(mTickMarksDrawable, false);
mSelectTickMarksBitmap = mUnselectTickMarksBitmap;
} else if (mTickMarksDrawable instanceof StateListDrawable) {
if (mTickMarksDrawable instanceof StateListDrawable) {
StateListDrawable listDrawable = (StateListDrawable) mTickMarksDrawable;
//This library has used some android hidden API ,so it‘s will occur some error if you android sdk is in normal.
// if you want to run this library with firm belief, you can download the hidden API [android.jar]
// (https://github.com/warkiz/android-hidden-api/blob/master/android-27/android.jar) and replace
// the old one in \SDK\platforms\android-27\ . Btw, take a backup first.
// int stateCount = listDrawable.getStateCount();

try {
Class<? extends StateListDrawable> aClass = listDrawable.getClass();
Method getStateCount = aClass.getMethod("getStateCount");
Expand Down Expand Up @@ -1115,12 +1103,14 @@ private void initTickMarksBitmap() {
throw new IllegalArgumentException("the format of the selector TickMarks drawable is wrong!");
}
} catch (Exception e) {
throw new RuntimeException("Something wrong happened when parsing TickMarks selector drawable." + e.getMessage());
mUnselectTickMarksBitmap = getDrawBitmap(mTickMarksDrawable, false);
mSelectTickMarksBitmap = mUnselectTickMarksBitmap;
}
} else {
//please check your selector drawable's format, please see above to correct.
throw new IllegalArgumentException("Nonsupport this drawable's type for custom TickMarks drawable!");
mUnselectTickMarksBitmap = getDrawBitmap(mTickMarksDrawable, false);
mSelectTickMarksBitmap = mUnselectTickMarksBitmap;
}

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
/**
* created by zhuangguangquan on 2018/5/27
* <p>
* https://github.com/warkiz/IndicatorSeekBar
* <p>
* the container for IndicatorSeekBar to make the indicator stay always
*/
public class IndicatorStayLayout extends LinearLayout {
Expand Down

0 comments on commit 78c3847

Please sign in to comment.