From 5e4a0f77be3467e90a3e3133c537fdd4702ca326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Nicol=C3=A1s=20Pina?= Date: Thu, 5 May 2016 09:29:38 +0200 Subject: [PATCH] Enable or disable pan, scale and rotation programatically. Addresses #3. --- README.md | 2 +- textimageview/build.gradle | 4 ++-- .../textimageview/TextImageView.java | 24 +++++++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9046251..1611064 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Android 2.2, API 8 ```groovy dependencies { - compile 'com.antonionicolaspina:textimageview:3.0.0' + compile 'com.antonionicolaspina:textimageview:3.1.0' } ``` diff --git a/textimageview/build.gradle b/textimageview/build.gradle index b980da7..3d819e9 100644 --- a/textimageview/build.gradle +++ b/textimageview/build.gradle @@ -13,7 +13,7 @@ ext { siteUrl = 'https://github.com/ANPez/TextImageView' gitUrl = 'https://github.com/ANPez/TextImageView.git' - libraryVersion = '3.0.0' + libraryVersion = '3.1.0' developerId = 'anpez' developerName = 'Antonio Nicolás Pina' @@ -32,7 +32,7 @@ android { minSdkVersion 8 targetSdkVersion 23 versionCode 9 - versionName "3.0.0" + versionName "3.1.0" } buildTypes { release { diff --git a/textimageview/src/main/java/com/antonionicolaspina/textimageview/TextImageView.java b/textimageview/src/main/java/com/antonionicolaspina/textimageview/TextImageView.java index 5762f0e..1adc927 100644 --- a/textimageview/src/main/java/com/antonionicolaspina/textimageview/TextImageView.java +++ b/textimageview/src/main/java/com/antonionicolaspina/textimageview/TextImageView.java @@ -395,6 +395,30 @@ public void setTypeface(Typeface typeface) { invalidate(); } + /** + * Enable or disable user-pan for the view. + * @param enabled Whether panning should be enabled. + */ + public void setPanEnabled(boolean enabled) { + panEnabled = enabled; + } + + /** + * Enable or disable user-scaling for the view. + * @param enabled Whether scaling should be enabled. + */ + public void setScaleEnabled(boolean enabled) { + scaleEnabled = enabled; + } + + /** + * Enable or disable user-rotation for the view. + * @param enabled Whether rotation should be enabled. + */ + public void setRotationEnabled(boolean enabled) { + rotationEnabled = enabled; + } + /** * Set the text color. * @param color Color in the format of android.graphics.Color.