From 42eb46446a1d5c0e768ae42b74b203489c572e1b Mon Sep 17 00:00:00 2001 From: zijing07 Date: Thu, 19 Apr 2018 11:13:10 +0800 Subject: [PATCH] add callback demo --- .idea/caches/build_file_checksums.ser | Bin 594 -> 594 bytes .idea/misc.xml | 2 +- app/build.gradle | 1 + .../mozidev/me/extextview/MainActivity.java | 20 ++++++++++++++++++ app/src/main/res/layout/activity_main.xml | 15 +++++++++++-- demo.gif | Bin 534119 -> 447740 bytes .../StrikeThroughPainting.java | 6 ++++-- 7 files changed, 39 insertions(+), 5 deletions(-) diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 8f9db7bbedc98cac282eb6db65028543d52ebb41..6396938057f36d802825295ea8a81a70f1fa6966 100644 GIT binary patch delta 33 rcmV++0N(%71kwbMm;~F{>J_n^r2!EZ4#`< - + diff --git a/app/build.gradle b/app/build.gradle index a8eb520..e827735 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,6 +21,7 @@ android { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.android.support:appcompat-v7:27.1.1' + implementation 'com.android.support:design:27.1.1' implementation 'com.android.support.constraint:constraint-layout:1.1.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' diff --git a/app/src/main/java/lib/mozidev/me/extextview/MainActivity.java b/app/src/main/java/lib/mozidev/me/extextview/MainActivity.java index 884fba9..4b6d124 100644 --- a/app/src/main/java/lib/mozidev/me/extextview/MainActivity.java +++ b/app/src/main/java/lib/mozidev/me/extextview/MainActivity.java @@ -2,6 +2,7 @@ import android.graphics.Color; import android.os.Bundle; +import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.view.Gravity; import android.view.View; @@ -120,6 +121,25 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { } }); + findViewById(R.id.button5).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + strikeThroughPainting + .cutTextEdge(cutEdge) + .color(strokeColor) + .strokeWidth(strokeWidth) + .mode(StrikeThroughPainting.MODE_DEFAULT) + .callback(new StrikeThroughPainting.StrikeThroughPaintingCallback() { + @Override + public void onStrikeThroughEnd() { + Snackbar.make(findViewById(R.id.container), + "Callback after animation", Snackbar.LENGTH_LONG).show(); + } + }) + .strikeThrough(); + } + }); + findViewById(R.id.button4).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 475789c..f23fb88 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -4,6 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + android:id="@+id/container" tools:context=".MainActivity"> +