diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index ba1cefd..5aefbc8 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -41,5 +41,10 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index f381712..2341319 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -39,7 +39,7 @@
-
+
diff --git a/README.md b/README.md
index e70fe03..9ec1856 100644
--- a/README.md
+++ b/README.md
@@ -9,19 +9,18 @@ An ImageView subclass that draws one or more spannable, rotable, scalable texts
Provided that this is an ImageView subclass, you can use Picasso, Glide, or any Image loader that you like to load the image into TextImageView.
-## New in 3.0
-You can enable text scale and rotation via multitouch gestures just by declaring it in your layout.
-Now you can stack multiple texts one on top of the other and control them.
+## New in 4.0
+Rewritten in kotlin+androidx
## Requirements
-Android 2.2, API 8
+Android 4.0, API 14
## Usage
### Gradle dependency
```groovy
dependencies {
- compile 'com.antonionicolaspina:textimageview:3.1.2'
+ implementation 'com.antonionicolaspina:textimageview:4.0'
}
```
@@ -35,15 +34,13 @@ dependencies {
android:textSize="30sp"
android:textColor="#ff0000"
app:tiv_panEnabled="true"
- app:tiv_clampTextMode="textInside"
- app:tiv_interline="10sp"
app:tiv_scaleEnabled="true"
app:tiv_rotationEnabled="true"
android:src="@drawable/sample"/>
```
## License
- Copyright 2016 Antonio Nicolás Pina
+ Copyright 2020 YaikoStudio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/sample/build.gradle b/sample/build.gradle
index ca000fb..ba45a6e 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -1,10 +1,15 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 30
buildToolsVersion "29.0.2"
+ androidExtensions {
+ experimental = true
+ }
+
defaultConfig {
applicationId "com.antonionicolaspina.textimageview.sample"
minSdkVersion 14
diff --git a/sample/src/main/java/com/antonionicolaspina/textimageview/sample/MainActivity.kt b/sample/src/main/java/com/antonionicolaspina/textimageview/sample/MainActivity.kt
index 57dc265..2219267 100644
--- a/sample/src/main/java/com/antonionicolaspina/textimageview/sample/MainActivity.kt
+++ b/sample/src/main/java/com/antonionicolaspina/textimageview/sample/MainActivity.kt
@@ -1,22 +1,29 @@
package com.antonionicolaspina.textimageview.sample
+import android.graphics.Color
import android.graphics.Typeface
import android.os.Bundle
-import android.view.View
-import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
+import com.antonionicolaspina.textimageview.Text
import com.antonionicolaspina.textimageview.TextImageView
+import kotlinx.android.synthetic.main.activity_main.*
+import java.util.*
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
- val textImageView = findViewById(R.id.text_image) as TextImageView
- textImageView.setTypeface(Typeface.DEFAULT_BOLD)
- val textView = findViewById(R.id.text) as TextView
- textImageView.setOnTextMovedListener { position ->
- textView.text =
- String.format("Position: [%.2f%%, %.2f%%]", position.x * 100f, position.y * 100f)
+
+ text_image.listener = object : TextImageView.Listener {
+ override fun textsChanged(texts: List) {
+ position_textview.text = texts.joinToString("\n")
+ }
+ }
+
+ add_more_button.setOnClickListener {
+ text_image.addText("Text ${Date()}")
+ text_image.setTypeface(Typeface.DEFAULT_BOLD)
+ text_image.setTextColor(Color.RED)
}
}
}
diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml
index f6454b8..238bc39 100644
--- a/sample/src/main/res/layout/activity_main.xml
+++ b/sample/src/main/res/layout/activity_main.xml
@@ -7,26 +7,28 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
-
+ android:layout_weight="1">
+
+