Skip to content

Commit

Permalink
Merge pull request #1 from GuilhE/master
Browse files Browse the repository at this point in the history
Kotlin conversion:
  • Loading branch information
zijing07 authored Apr 6, 2020
2 parents a323a12 + 3d66680 commit f08a9a2
Show file tree
Hide file tree
Showing 44 changed files with 910 additions and 1,081 deletions.
64 changes: 24 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ExTextView

Android Extended TextView.
Android Extended TextView (know in Kotlin 🤩)

# Usage

Expand All @@ -21,48 +21,40 @@ allprojects {
Step 2. Add the dependency
``` gradle
dependencies {
implementation 'com.github.zijing07:ExTextView:v0.1.0'
implementation 'com.github.zijing07:ExTextView:v1.0.0'
}
```

### Code

```java
StrikeThroughPainting strikeThroughPainting = new StrikeThroughPainting(tv);
strikeThroughPainting = StrikeThroughPainting(tv)

// Basic Usage
strikeThroughPainting.strikeThrough();
strikeThroughPainting.strikeThrough()

// All Options
strikeThroughPainting
// default to true
.cutTextEdge(cutEdge)
// default to Color.BLACK
.color(strokeColor)
// default to 2F px
.strokeWidth(strokeWidth)
// default to StrikeThroughPainting.MODE_DEFAULT
.mode(StrikeThroughPainting.MODE_DEFAULT)
// default to 0.65F
.linePosition(0.7F)
// default to 0.6F, since the first line is calculated
// differently to the following lines
.firstLinePosition(0.6F)
// default to 1_000 milliseconds, aka 1s
.totalTime(10_000L)
// default to null
.callback(new StrikeThroughPainting.StrikeThroughPaintingCallback() {
@Override
public void onStrikeThroughEnd() {
Snackbar.make(findViewById(R.id.container),
"Callback after animation", Snackbar.LENGTH_LONG).show();
}
})
// do the draw!
.strikeThrough();
strikeThroughPainting // default to true
.cutTextEdge(cutEdge) // default to Color.BLACK
.color(strokeColor) // default to 2F px
.strokeWidth(strokeWidth) // default to StrikeThroughPainting.MODE_DEFAULT
.mode(StrikeThroughPainting.MODE_DEFAULT) // default to 0.65F
.linePosition(0.65f) // default to 0.6F, since the first line is calculated
// differently to the following lines
.firstLinePosition(0.6f) // default to 1_000 milliseconds, aka 1s
.totalTime(10000L) // default to null
.callback(object : StrikeThroughPainting.StrikeThroughPaintingCallback {
override fun onStrikeThroughEnd() {
Snackbar.make(
findViewById(R.id.container),
"Callback after animation", Snackbar.LENGTH_LONG
).show()
}
})
.strikeThrough()

// Clear Strike Through
strikeThroughPainting.clearStrikeThrough();
strikeThroughPainting.clearStrikeThrough()
```

# Done Features
Expand All @@ -73,12 +65,4 @@ strikeThroughPainting.clearStrikeThrough();
- What else to extend? Please feel free to tell via opening an issue.

# Demo
![demo](demo.gif)

# Something Else

This project is written without any Kotlin, just to make it easy to use. But after programming with Kotlin for some time, writing pure Java really pains a little.

The idea to write this library is that, I could not find one library to complete the `Animated Strike Through Textview` task. So I have to build it from scratch.

Well that's not too much though, and the `Spotlight Effect` to be done. Welcome to create PRs.
![demo](demo.gif)
28 changes: 0 additions & 28 deletions app/build.gradle

This file was deleted.

This file was deleted.

163 changes: 0 additions & 163 deletions app/src/main/java/lib/mozidev/me/demo/MainActivity.java

This file was deleted.

Loading

0 comments on commit f08a9a2

Please sign in to comment.