Skip to content

Commit

Permalink
change coordinates of the tick
Browse files Browse the repository at this point in the history
  • Loading branch information
SparkYuan committed Jul 24, 2016
1 parent 824d72a commit 7e25c47
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 15 additions & 10 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,22 @@
<com.spark.submitbutton.SubmitButton
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="OK"
android:textSize="10sp"
android:textColor="@color/gray"
app:sub_btn_background="@color/white"
app:sub_btn_tick_color="@color/yellow"
app:sub_btn_duration="1000" />

app:sub_btn_duration="1000"
app:sub_btn_line_color="@color/colorPrimary"
app:sub_btn_ripple_color="@color/colorPrimary"
/>

<com.spark.submitbutton.SubmitButton
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="提交"
android:text="Submit"
android:textColor="@color/gray"
android:textSize="12sp"
app:sub_btn_background="@color/white"
app:sub_btn_duration="2000"
app:sub_btn_line_color="@color/colorPrimary"
Expand All @@ -34,20 +41,18 @@
<com.spark.submitbutton.SubmitButton
android:layout_width="match_parent"
android:layout_height="match_parent"
app:sub_btn_tick_color="@color/white"
android:text="Submit"
android:textColor="@color/gray"
app:sub_btn_background="@color/white"
app:sub_btn_duration="3000"
app:sub_btn_line_color="@color/colorPrimary"
app:sub_btn_ripple_color="@color/colorPrimary"
app:sub_btn_tick_color="@color/white" />
android:textSize="15sp"
android:textColor="@color/white"
app:sub_btn_duration="3000" />

<com.spark.submitbutton.SubmitButton
android:id="@+id/btn3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Submit"
android:textColor="@color/white"
android:textSize="20sp"
android:textSize="18sp"
app:sub_btn_duration="4000" />
</LinearLayout>
Binary file modified pic/submitbutton.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions submitbutton/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apply plugin: 'com.github.dcendents.android-maven'


group = 'me.spark' // Change this to match your package name
version = '1.0.0' // Change this to match your version number
version = '1.0.1' // Change this to match your version number


android {
Expand All @@ -15,7 +15,7 @@ android {
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
versionName "1.0.1"
}
buildTypes {
release {
Expand Down Expand Up @@ -64,8 +64,8 @@ bintray {
desc = "A cool and elegant Submit Button."

version {
name = '1.0.0'
desc = 'A cool and elegant Submit Button.'
name = '1.0.1'
desc = 'A cool, practical and elegant Submit Button.'
vcsTag = 'Android,Submit,Button,Animator,Animation'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ public void startTickAnim() {
rightEndPath.cubicTo(cxRight + 2 * mLineRadius, cyRight - 2 * mLineRadius,
cxRight + 2 * mLineRadius,
cyRight + 2 * mLineRadius,
(float) (cxLeft + mRecWidth / 2 - 1.5 * mTickLen),
(float) (cxLeft + mRecWidth * 0.48 - 1.5 * mTickLen),
(float) (cyLeft - mRadius * 0.25));
final PathMeasure mPathMeasureRightEnd = new PathMeasure(rightEndPath, false);
Path rightStartPath = new Path();
Expand All @@ -370,23 +370,23 @@ public void startTickAnim() {
cyRight - 2 * mLineRadius,
cxRight + 2 * mLineRadius,
cyRight + 2 * mLineRadius,
cxLeft + mRecWidth / 2,
(float) (cxLeft + mRecWidth * 0.48),
(float) (cyLeft + mTickLen * Math.cos(45)));
final PathMeasure mPathMeasureRightStart = new PathMeasure(rightStartPath, false);
Path leftEndPath = new Path();
leftEndPath.moveTo(cxRight, cyRight + mLineRadius);
leftEndPath.cubicTo(cxLeft - 2 * mLineRadius, cyRight - 2 * mLineRadius,
cxLeft - 2 * mLineRadius,
cyLeft + 2 * mLineRadius,
cxLeft + mRecWidth / 2 + 2 * mTickLen,
(float) (cxLeft + mRecWidth * 0.48 + 2 * mTickLen),
cyLeft - mTickLen);

Path leftStartPath = new Path();
leftStartPath.moveTo(cxRight, cyRight + mLineRadius);
leftStartPath.cubicTo(cxLeft - 3 * mLineRadius, cyRight - 3 * mLineRadius,
cxLeft - 3 * mLineRadius,
cyLeft + 3 * mLineRadius,
cxLeft + mRecWidth / 2,
(float) (cxLeft + mRecWidth * 0.48),
(float) (cyLeft + mTickLen * Math.cos(45)));

final PathMeasure mPathMeasureLeftEnd = new PathMeasure(leftEndPath, false);
Expand Down

0 comments on commit 7e25c47

Please sign in to comment.