diff --git a/app/src/main/java/moe/codeest/enviewsdemo/ScrollActivity.java b/app/src/main/java/moe/codeest/enviewsdemo/ScrollActivity.java
index 4d25975..fe55d52 100644
--- a/app/src/main/java/moe/codeest/enviewsdemo/ScrollActivity.java
+++ b/app/src/main/java/moe/codeest/enviewsdemo/ScrollActivity.java
@@ -14,26 +14,22 @@
public class ScrollActivity extends Activity{
ENScrollView scrollView;
- Button btnSelect;
- Button btnUnSelect;
+ Button btnSwitch;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scroll);
scrollView = (ENScrollView) findViewById(R.id.view_scroll);
- btnSelect = (Button) findViewById(R.id.btn_select);
- btnUnSelect = (Button) findViewById(R.id.btn_unselect);
- btnSelect.setOnClickListener(new View.OnClickListener() {
+ btnSwitch = (Button) findViewById(R.id.btn_switch);
+ btnSwitch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- scrollView.select();
- }
- });
- btnUnSelect.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- scrollView.unSelect();
+ if (scrollView.isSelected()) {
+ scrollView.unSelect();
+ } else {
+ scrollView.select();
+ }
}
});
}
diff --git a/app/src/main/res/layout/activity_play.xml b/app/src/main/res/layout/activity_play.xml
index 4a7967c..9142159 100644
--- a/app/src/main/res/layout/activity_play.xml
+++ b/app/src/main/res/layout/activity_play.xml
@@ -18,17 +18,17 @@
app:play_bg_line_width="12"/>
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_scroll.xml b/app/src/main/res/layout/activity_scroll.xml
index cee1f97..a803f8c 100644
--- a/app/src/main/res/layout/activity_scroll.xml
+++ b/app/src/main/res/layout/activity_scroll.xml
@@ -15,20 +15,15 @@
app:scroll_line_color="#ffffff"
app:scroll_bg_line_color="#444a4f"
app:scroll_line_width="10"
- app:scroll_bg_line_width="10"/>
+ app:scroll_bg_line_width="10"
+ app:scroll_is_selected="false"
+ app:scroll_view_translation_x="16"/>
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_volume.xml b/app/src/main/res/layout/activity_volume.xml
index d6f59eb..694ff6a 100644
--- a/app/src/main/res/layout/activity_volume.xml
+++ b/app/src/main/res/layout/activity_volume.xml
@@ -14,7 +14,7 @@
android:layout_marginTop="20dp"
app:volume_line_color="#ffffff"
app:volume_line_width="10"
- app:volume_bg_line_color="#4f5559"
+ app:volume_bg_line_color="#64696d"
app:volume_bg_line_width="10"/>
0.2) {
+ if (mFraction <= 0.8 && mFraction > 0.2) { //嗷~ 在这画球
canvas.drawCircle(mCenterX - mCircleRadius + 2 * mCircleRadius * mFraction , mCenterY , mCircleRadius / 6 / 0.6f * (mFraction - 0.2f) , mColorPaint);
} else if (mFraction > 0.8) {
canvas.drawCircle(mCenterX - mCircleRadius + 2 * mCircleRadius * mFraction , mCenterY , mCircleRadius / 6 , mColorPaint);
diff --git a/library/src/main/java/moe/codeest/enviews/ENSearchView.java b/library/src/main/java/moe/codeest/enviews/ENSearchView.java
index 7ca04d8..a147d2f 100644
--- a/library/src/main/java/moe/codeest/enviews/ENSearchView.java
+++ b/library/src/main/java/moe/codeest/enviews/ENSearchView.java
@@ -119,7 +119,7 @@ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
- if (mFraction <= 0.2) {
+ if (mFraction <= 0.2) { //嗷~ 放大镜手柄收缩
canvas.drawCircle(mCenterX , mCenterY ,mCircleRadius - mCircleRadius * mFraction, mPaint);
canvas.drawLine(mCenterX + mCircleRadius / (float) Math.sqrt(2) + 1.2f * mCircleRadius / (float) Math.sqrt(2) / 0.2f * mFraction,
mCenterY + mCircleRadius / (float) Math.sqrt(2) + 1.2f * mCircleRadius / (float) Math.sqrt(2) / 0.2f * mFraction,
@@ -132,13 +132,13 @@ protected void onDraw(Canvas canvas) {
if (isDotShowing) {
isDotShowing = false;
} else {
- canvas.drawCircle(mCurrentPos[0], mCurrentPos[1], mDotSize, mPaint);
+ canvas.drawCircle(mCurrentPos[0], mCurrentPos[1], mDotSize, mPaint); //嗷~ 轨迹中的小球
isDotShowing = true;
}
} else {
canvas.drawCircle(mCurrentPos[0], mCurrentPos[1], mDotSize, mPaint);
}
- if (mFraction <= 0.3) {
+ if (mFraction <= 0.3) { //嗷~ 内圈粘性部分
canvas.drawCircle(mCenterX , mCenterY ,0.8f * mCircleRadius + mCircleRadius * 2 * (mFraction - 0.2f), mPaint);
} else {
canvas.drawCircle(mCenterX , mCenterY ,mCircleRadius , mPaint);
@@ -150,7 +150,7 @@ protected void onDraw(Canvas canvas) {
canvas.drawArc(mRectF, 45 - 55 / 0.05f * (0.4f - mFraction), 110 / 0.05f * (0.4f - mFraction), false, mArcPaint);
}
- if (mFraction <= 0.75 && mFraction > 0.7) {
+ if (mFraction <= 0.75 && mFraction > 0.7) { //嗷~ 外圈粘性部分
mArcPath.reset();
mArcPath.moveTo(mCenterX + mCircleRadius, mCenterY);
mArcPath.cubicTo(mCenterX + mCircleRadius + 8 / 0.05f * (mFraction - 0.7f), mCenterY + mCircleRadius / 2 + 8 / 0.05f * (mFraction - 0.7f),
@@ -165,7 +165,7 @@ protected void onDraw(Canvas canvas) {
mCenterX, mCenterY + mCircleRadius);
canvas.drawPath(mArcPath, mPaint);
}
- } else {
+ } else { //嗷~ 放大镜手柄伸长
canvas.drawCircle(mCenterX , mCenterY ,mCircleRadius , mPaint);
canvas.drawLine(mCenterX + 2.2f *mCircleRadius / (float) Math.sqrt(2) - 1.2f * mCircleRadius / (float) Math.sqrt(2) / 0.2f * (mFraction - 0.8f),
mCenterY + 2.2f * mCircleRadius / (float) Math.sqrt(2) - 1.2f * mCircleRadius / (float) Math.sqrt(2) / 0.2f * (mFraction - 0.8f),
diff --git a/library/src/main/java/moe/codeest/enviews/ENVolumeView.java b/library/src/main/java/moe/codeest/enviews/ENVolumeView.java
index 4d125a3..fcb4403 100644
--- a/library/src/main/java/moe/codeest/enviews/ENVolumeView.java
+++ b/library/src/main/java/moe/codeest/enviews/ENVolumeView.java
@@ -31,7 +31,7 @@ public class ENVolumeView extends View{
private static final int DEFAULT_LINE_COLOR = Color.WHITE;
- private static final int DEFAULT_BG_LINE_COLOR = 0xff4f5559;
+ private static final int DEFAULT_BG_LINE_COLOR = 0xff64696d;
private static final int DEFAULT_LINE_WIDTH = 10;
@@ -129,14 +129,14 @@ protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (mCurrentState != STATE_VIBRATE) {
if (mFraction <= 0.5) {
- mDstPath.reset();
+ mDstPath.reset(); //嗷~ 在这画喇叭
mPathMeasure.getSegment(0, mPathLength * 0.38f - mPathLength * 0.13f * mFraction, mDstPath, true);
canvas.drawPath(mDstPath, mBgPaint);
mDstPath.reset();
mPathMeasure.getSegment(mPathLength * 0.62f + mPathLength * 0.13f * mFraction, mPathLength, mDstPath, true);
canvas.drawPath(mDstPath, mBgPaint);
- canvas.save();
+ canvas.save(); //嗷~ 在这画X
canvas.translate(- mFraction * mBaseLength * 2, 0);
canvas.drawLine(mCenterX - mBaseLength * (0.5f - mFraction) , mCenterY - mBaseLength * (0.5f - mFraction)
,mCenterX + mBaseLength * (0.5f - mFraction), mCenterY + mBaseLength * (0.5f - mFraction), mBgPaint);
@@ -144,7 +144,7 @@ protected void onDraw(Canvas canvas) {
,mCenterX + mBaseLength * (0.5f - mFraction), mCenterY - mBaseLength * (0.5f - mFraction), mBgPaint);
canvas.restore();
} else {
- mDstPath.reset();
+ mDstPath.reset(); //嗷~ 在这画喇叭
mPathMeasure.getSegment(0, mPathLength * 0.25f + mPathLength * 0.13f * (mFraction - 0.5f), mDstPath, true);
canvas.drawPath(mDstPath, mBgPaint);
mDstPath.reset();
@@ -157,7 +157,7 @@ protected void onDraw(Canvas canvas) {
mPathMeasure.getSegment(mPathLength - mPathLength * 0.38f / 0.5f * (mFraction - 0.5f), mPathLength, mDstPath, true);
canvas.drawPath(mDstPath, mPaint);
- canvas.save();
+ canvas.save(); //嗷~ 在这画小声波
canvas.translate( - (1 - mFraction) * mBaseLength * 2, 0);
canvas.drawArc(mCenterX - 0.5f * mBaseLength - mBaseLength / 0.5f * (mFraction - 0.5f),
mCenterY - mBaseLength / 0.5f * (mFraction - 0.5f),
@@ -172,7 +172,7 @@ protected void onDraw(Canvas canvas) {
mCenterY + mBaseLength / 0.5f * (mFraction - 0.5f), -55 / 50 * sVolume, 110 / 50 * sVolume ,false, mPaint);
canvas.restore();
- canvas.save();
+ canvas.save(); //嗷~ 在这画大声波
canvas.translate( - (1 - mFraction) * mBaseLength * 3, 0);
canvas.drawArc(mCenterX - 1.6f * mBaseLength / 0.5f * (mFraction - 0.5f),
mCenterY - 1.6f * mBaseLength / 0.5f * (mFraction - 0.5f),
@@ -188,14 +188,14 @@ protected void onDraw(Canvas canvas) {
canvas.restore();
}
} else {
- mDstPath.reset();
+ mDstPath.reset(); //嗷~ 在这画喇叭
mPathMeasure.getSegment(0, mPathLength * 0.38f, mDstPath, true);
canvas.drawPath(mDstPath, mPaint);
mDstPath.reset();
mPathMeasure.getSegment(mPathLength - mPathLength * 0.38f, mPathLength, mDstPath, true);
canvas.drawPath(mDstPath, mPaint);
- canvas.save();
+ canvas.save(); //嗷~ 在这画小声波
canvas.translate( - (1 - mFraction) * mBaseLength / 3, 0);
canvas.drawArc(mCenterX - 1.5f * mBaseLength,
mCenterY - mBaseLength,
@@ -210,7 +210,7 @@ protected void onDraw(Canvas canvas) {
mCenterY + mBaseLength, -55 / 50 * sVolume, 110 / 50 * sVolume ,false, mPaint);
canvas.restore();
- canvas.save();
+ canvas.save(); //嗷~ 在这画大声波
canvas.translate( - (1 - mFraction) * mBaseLength / 3, 0);
canvas.drawArc(mCenterX - 1.6f * mBaseLength,
mCenterY - 1.6f * mBaseLength,
diff --git a/library/src/main/res/values/attrs.xml b/library/src/main/res/values/attrs.xml
index 5747b1b..d3979c2 100644
--- a/library/src/main/res/values/attrs.xml
+++ b/library/src/main/res/values/attrs.xml
@@ -27,6 +27,8 @@
+
+