|
@@ -173,6 +173,7 @@ public class DoubleSlideSeekBar extends View {
|
|
private onRangeListener onRangeListener;
|
|
private onRangeListener onRangeListener;
|
|
|
|
|
|
//设置滑动的时间数据
|
|
//设置滑动的时间数据
|
|
|
|
+ //endValue: 37 18:00, startValue: 15 07:00
|
|
private String[] time = {"00:00", "00:30", "01:00", "01:30", "02:00", "02:30", "03:00", "03:30", "04:00", "04:30"
|
|
private String[] time = {"00:00", "00:30", "01:00", "01:30", "02:00", "02:30", "03:00", "03:30", "04:00", "04:30"
|
|
, "05:00", "05:30", "06:00", "06:30", "07:00", "07:30", "08:00", "08:30", "09:00", "09:30", "10:00", "10:30"
|
|
, "05:00", "05:30", "06:00", "06:30", "07:00", "07:30", "08:00", "08:30", "09:00", "09:30", "10:00", "10:30"
|
|
, "11:00", "11:30", "12:00", "12:30", "13:00", "13:30", "14:00", "14:30", "15:00", "15:30", "16:00", "16:30"
|
|
, "11:00", "11:30", "12:00", "12:30", "13:00", "13:30", "14:00", "14:30", "15:00", "15:30", "16:00", "16:30"
|
|
@@ -385,9 +386,8 @@ public class DoubleSlideSeekBar extends View {
|
|
Log.e(TAG, "smallRange算出来的 " + computRange(slideLowX));
|
|
Log.e(TAG, "smallRange算出来的 " + computRange(slideLowX));
|
|
Log.e(TAG, "bigRange算出来的" + computRange(slideBigX));
|
|
Log.e(TAG, "bigRange算出来的" + computRange(slideBigX));
|
|
|
|
|
|
- canvas.drawText(time[Integer.parseInt(String.format("%.0f", smallRange))], slideLowX - bitmapWidth / 2, textHeight, textPaint);
|
|
|
|
- canvas.drawText(time[Integer.parseInt(String.format("%.0f", bigRange)) -1 ], slideBigX - bitmapWidth / 2, textHeight, textPaint);
|
|
|
|
-
|
|
|
|
|
|
+ canvas.drawText(time[Integer.parseInt(String.format("%.0f", smallRange)) - 1], slideLowX - bitmapWidth / 2, textHeight, textPaint);
|
|
|
|
+ canvas.drawText(time[Integer.parseInt(String.format("%.0f", bigRange)) - 1], slideBigX - bitmapWidth / 2, textHeight, textPaint);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -508,7 +508,7 @@ public class DoubleSlideSeekBar extends View {
|
|
bigRange = computRange(slideBigX);
|
|
bigRange = computRange(slideBigX);
|
|
//接口 实现值的传递
|
|
//接口 实现值的传递
|
|
if (onRangeListener != null) {
|
|
if (onRangeListener != null) {
|
|
- onRangeListener.onRange(smallRange, bigRange, time[Integer.parseInt(String.format("%.0f", smallRange))], time[Integer.parseInt(String.format("%.0f", bigRange)) - 1]);
|
|
|
|
|
|
+ onRangeListener.onRange(smallRange, bigRange, time[Integer.parseInt(String.format("%.0f", smallRange))-1], time[Integer.parseInt(String.format("%.0f", bigRange)) - 1]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -559,17 +559,16 @@ public class DoubleSlideSeekBar extends View {
|
|
* 传时间返回对应的数据组
|
|
* 传时间返回对应的数据组
|
|
*/
|
|
*/
|
|
public int timeToArray(int tag, String times) {
|
|
public int timeToArray(int tag, String times) {
|
|
- int Index = getIndex(time, times)+1;//调用方法
|
|
|
|
- if (Index == -1) {
|
|
|
|
|
|
+ int index = getIndex(time, times)+1;//调用方法
|
|
|
|
+ if (index == -1) {
|
|
if (tag == 0) {
|
|
if (tag == 0) {
|
|
return (int) smallRange;
|
|
return (int) smallRange;
|
|
} else {
|
|
} else {
|
|
return (int) bigRange;
|
|
return (int) bigRange;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- return Index;
|
|
|
|
|
|
+ return index;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|