├── .gitignore ├── .idea ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── org │ │ └── altmail │ │ └── displaytextview │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── org │ │ │ └── altmail │ │ │ └── displaytextview │ │ │ └── DisplayTextView.java │ └── res │ │ └── values │ │ └── attr.xml │ └── test │ └── java │ └── org │ └── altmail │ └── displaytextview │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── screenshot ├── screen1.gif ├── screen2.gif └── screen3.gif └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 37 | 38 | 39 | 40 | 41 | 42 | 44 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DisplayTextView 2 | 3 | 4 | Custom TextView that show text in animation 5 | 6 | 7 | ## Download 8 | 9 | 10 | Include the following dependency in your build.gradle file : 11 | 12 | ```java 13 | dependencies { 14 | ... 15 | implementation 'org.altmail:display-textview:1.1' 16 | } 17 | ``` 18 | 19 | ## Usage 20 | 21 | ```xml 22 | 36 | ``` 37 | 38 | **In main Activy or Fragment :** 39 | 40 | ```java 41 | 42 | DisplayTextView myTextView = (DisplayTextView) findViewById(R.id.my_text_view); 43 | ... 44 | myTextView.startAnimation(); 45 | 46 | 47 | ``` 48 | 49 | ### Attribute description 50 | 51 | 52 | **MaxTextSize :** size of characters during animation (default = textSize * 2) 53 | 54 | **AutoSizePadding :** automatically calculate the padding so the animation is not partially hidden (default = true) 55 | 56 | **CharacterAnimatedTogether :** number of animated characters at the same time (default = 2) 57 | 58 | **MultiLineAnimation :** animate the entire paragraph, otherwise line by line, if true the AnimationDuration is not respected (default = false) 59 | 60 | **TextViewInterpolator :** animation interpolator (default = linear) 61 | 62 | **hideUntilAnimation :** hide text until animation starts 63 | 64 | 65 | ## Examples 66 | 67 | ```xml 68 | 78 | ``` 79 | 80 | ![picture alt](https://github.com/ronpattern/DisplayTextView/blob/master/screenshot/screen2.gif) 81 | 82 | ```xml 83 | 93 | ``` 94 | 95 | ![picture alt](https://github.com/ronpattern/DisplayTextView/blob/master/screenshot/screen3.gif) 96 | 97 | 98 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | ext { 4 | PUBLISH_GROUP_ID = 'org.altmail' 5 | PUBLISH_ARTIFACT_ID = 'display-textview' 6 | PUBLISH_VERSION = '1.1' 7 | } 8 | 9 | android { 10 | 11 | compileSdkVersion 28 12 | 13 | defaultConfig { 14 | 15 | minSdkVersion 15 16 | targetSdkVersion 28 17 | versionCode 2 18 | versionName "1.1" 19 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 20 | } 21 | 22 | buildTypes { 23 | 24 | release { 25 | 26 | minifyEnabled false 27 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 28 | } 29 | } 30 | } 31 | 32 | dependencies { 33 | 34 | implementation fileTree(dir: 'libs', include: ['*.jar']) 35 | implementation 'com.android.support:appcompat-v7:28.0.0' 36 | testImplementation 'junit:junit:4.12' 37 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 38 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 39 | } 40 | 41 | apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle' 42 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/org/altmail/displaytextview/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package org.altmail.displaytextview; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("org.altmail.displaytextview", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/java/org/altmail/displaytextview/DisplayTextView.java: -------------------------------------------------------------------------------- 1 | package org.altmail.displaytextview; 2 | 3 | import android.animation.Animator; 4 | import android.animation.ValueAnimator; 5 | import android.content.Context; 6 | import android.content.res.TypedArray; 7 | import android.graphics.Canvas; 8 | import android.graphics.Paint; 9 | import android.os.Build; 10 | import android.text.Layout; 11 | import android.text.TextPaint; 12 | import android.util.AttributeSet; 13 | import android.util.TypedValue; 14 | import android.view.animation.AccelerateDecelerateInterpolator; 15 | import android.view.animation.AccelerateInterpolator; 16 | import android.view.animation.DecelerateInterpolator; 17 | import android.view.animation.Interpolator; 18 | import android.view.animation.LinearInterpolator; 19 | 20 | 21 | public class DisplayTextView extends android.support.v7.widget.AppCompatTextView implements ValueAnimator.AnimatorUpdateListener { 22 | 23 | private CharSequence mText; 24 | private final TextPaint mPaint; 25 | private float mProgress, mMaxTextSize, mTextSize; 26 | private int mAnimationDuration, mCharacterAnimatedTogether; 27 | private boolean mMultiLineAnimation, mAnimationDurationChanged, mInterpolatorChanged, 28 | mAnimatorListenerChanged, mHideUntilAnimation; 29 | private Interpolator mInterpolator; 30 | private float[] mCharWidthList; 31 | private Animator.AnimatorListener mAnimatorListener; 32 | 33 | private final ValueAnimator mValueAnimator = ValueAnimator.ofFloat(ANIMATION_MIN_VALUE, ANIMATION_MAX_VALUE); 34 | 35 | private final static int MAX_ALPHA = 255; 36 | private final static int DEFAULT_ANIMATION_DURATION_PER_CHARACTER = 150; 37 | private final static int DEFAULT_MAX_SIZE_FACTOR = 2; 38 | private final static int DEFAULT_CHARACTERS_ANIMATED_TOGETHER = 2; 39 | private final static float HALF_DIVIDER = 2f; 40 | private final static float FLOAT_TO_INT_ROUND_VALUE = 0.5f; 41 | 42 | private final static int LINEAR_INTERPOLATOR_ID = 0; 43 | private final static int DECELERATE_INTERPOLATOR_ID = 1; 44 | private final static int ACCELERATE_INTERPOLATOR_ID = 2; 45 | private final static int ACCELERATE_DECELERATE_INTERPOLATOR_ID = 3; 46 | 47 | private final static float ANIMATION_MIN_VALUE = 0f; 48 | private final static float ANIMATION_MAX_VALUE = 1f; 49 | 50 | private final static double ZOOM_DIFF_DIVIDER = 2.9d; 51 | 52 | 53 | public DisplayTextView(Context context) { 54 | this(context, null); 55 | } 56 | 57 | public DisplayTextView(Context context, AttributeSet attrs) { 58 | this(context, attrs, 0); 59 | } 60 | 61 | public DisplayTextView(Context context, AttributeSet attrs, int defStyleAttr) { 62 | super(context, attrs, defStyleAttr); 63 | 64 | mText = getText(); 65 | mProgress = ANIMATION_MAX_VALUE; 66 | mPaint = getPaint(); 67 | final boolean autoSizePadding; 68 | final int interpolator; 69 | 70 | initAnimation(); 71 | 72 | if (attrs != null) { 73 | 74 | final TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.DisplayTextView); 75 | 76 | mMaxTextSize = typedArray.getDimension(R.styleable.DisplayTextView_MaxTextSize, getDefaultMaxTextSize()); 77 | mMultiLineAnimation = typedArray.getBoolean(R.styleable.DisplayTextView_MultiLineAnimation, true); 78 | mCharacterAnimatedTogether = typedArray.getInteger(R.styleable.DisplayTextView_CharacterAnimatedTogether, DEFAULT_CHARACTERS_ANIMATED_TOGETHER); 79 | mAnimationDuration = typedArray.getInt(R.styleable.DisplayTextView_AnimationDuration, getDefaultAnimationDuration()); 80 | mHideUntilAnimation = typedArray.getBoolean(R.styleable.DisplayTextView_hideUntilAnimation, true); 81 | autoSizePadding = typedArray.getBoolean(R.styleable.DisplayTextView_AutoSizePadding, true); 82 | interpolator = typedArray.getInteger(R.styleable.DisplayTextView_TextViewInterpolator, LINEAR_INTERPOLATOR_ID); 83 | 84 | typedArray.recycle(); 85 | 86 | } else { 87 | 88 | mMaxTextSize = getDefaultMaxTextSize(); 89 | mMultiLineAnimation = true; 90 | mCharacterAnimatedTogether = DEFAULT_CHARACTERS_ANIMATED_TOGETHER; 91 | mAnimationDuration = getDefaultAnimationDuration(); 92 | mHideUntilAnimation = true; 93 | autoSizePadding = true; 94 | interpolator = LINEAR_INTERPOLATOR_ID; 95 | } 96 | 97 | if (autoSizePadding) { 98 | 99 | autoSizePadding(); 100 | } 101 | 102 | switch (interpolator) { 103 | 104 | case LINEAR_INTERPOLATOR_ID: 105 | 106 | mInterpolator = new LinearInterpolator(); 107 | 108 | break; 109 | 110 | case DECELERATE_INTERPOLATOR_ID: 111 | 112 | mInterpolator = new DecelerateInterpolator(); 113 | 114 | break; 115 | 116 | case ACCELERATE_INTERPOLATOR_ID: 117 | 118 | mInterpolator = new AccelerateInterpolator(); 119 | 120 | break; 121 | 122 | case ACCELERATE_DECELERATE_INTERPOLATOR_ID: 123 | 124 | mInterpolator = new AccelerateDecelerateInterpolator(); 125 | 126 | break; 127 | } 128 | 129 | mValueAnimator.addUpdateListener(this); 130 | 131 | mAnimatorListenerChanged = true; 132 | mAnimationDurationChanged = true; 133 | mInterpolatorChanged = true; 134 | mTextSize = this.getTextSize(); 135 | } 136 | 137 | @Override 138 | public void onDraw(Canvas canvas) { 139 | 140 | if (!mHideUntilAnimation) { 141 | 142 | final Layout layout = getLayout(); 143 | final double d = (ANIMATION_MAX_VALUE / ((double) mText.length())) * ((mCharacterAnimatedTogether + 1) / HALF_DIVIDER); 144 | final int paddingTop = getPaddingTop(); 145 | final Paint paint = mPaint; 146 | final float progress = mProgress; 147 | final float textSize = mTextSize; 148 | final boolean multiLineAnimation = mMultiLineAnimation; 149 | final double characterAnimatedTogether = (double) mCharacterAnimatedTogether; 150 | final CharSequence text = mText; 151 | final float[] charWidthList = mCharWidthList; 152 | final float maxTextSize = mMaxTextSize; 153 | 154 | int paddingLeft, alpha, lineStart, lineEnd, pos; 155 | 156 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { 157 | 158 | paddingLeft = getPaddingStart(); 159 | 160 | } else { 161 | 162 | paddingLeft = getPaddingLeft(); 163 | } 164 | 165 | paint.setColor(getCurrentTextColor()); 166 | 167 | float lineLeft, lineBaseline; 168 | int gapIndex = 0; 169 | double zoomDiff, tmpProgress, zoomSize; 170 | String lineText; 171 | 172 | for (int i = 0; i < layout.getLineCount(); i++) { 173 | 174 | lineStart = layout.getLineStart(i); 175 | lineEnd = layout.getLineEnd(i); 176 | lineLeft = layout.getLineLeft(i) + paddingLeft; 177 | lineBaseline = layout.getLineBaseline(i) + paddingTop; 178 | lineText = text.subSequence(lineStart, lineEnd).toString(); 179 | 180 | for (int j = 0; j < lineText.length(); j++) { 181 | 182 | pos = multiLineAnimation ? j : gapIndex; 183 | 184 | if (progress <= (pos * (d / characterAnimatedTogether)) + d) { 185 | 186 | if (progress > (pos * (d / characterAnimatedTogether))) { 187 | 188 | tmpProgress = progress - (pos * (d / characterAnimatedTogether)); 189 | alpha = (int) ((tmpProgress / d) * MAX_ALPHA); 190 | zoomDiff = (maxTextSize - textSize) * (ANIMATION_MAX_VALUE - (tmpProgress / d)); 191 | zoomSize = textSize + zoomDiff; 192 | 193 | paint.setAlpha(alpha); 194 | paint.setTextSize((float) (zoomSize)); 195 | canvas.drawText(String.valueOf(lineText.charAt(j)), (float) (lineLeft - (zoomDiff / ZOOM_DIFF_DIVIDER)), 196 | (float) (lineBaseline + (zoomDiff / ZOOM_DIFF_DIVIDER)), paint); 197 | } 198 | 199 | } else { 200 | 201 | paint.setAlpha(MAX_ALPHA); 202 | paint.setTextSize(textSize); 203 | canvas.drawText(String.valueOf(lineText.charAt(j)), lineLeft, lineBaseline, paint); 204 | } 205 | 206 | lineLeft += charWidthList[gapIndex++]; 207 | } 208 | } 209 | } 210 | } 211 | 212 | public void startAnimation() { 213 | 214 | if (mValueAnimator.isStarted()) { 215 | 216 | mValueAnimator.cancel(); 217 | } 218 | 219 | initAnimation(); 220 | 221 | if (mAnimationDuration == 0 || mAnimationDurationChanged) { 222 | 223 | mValueAnimator.setDuration((long) mAnimationDuration); 224 | 225 | mAnimationDurationChanged = false; 226 | } 227 | 228 | if (mInterpolator != null && mInterpolatorChanged) { 229 | 230 | mValueAnimator.setInterpolator(mInterpolator); 231 | 232 | mInterpolatorChanged = false; 233 | } 234 | 235 | if (mAnimatorListener != null && mAnimatorListenerChanged) { 236 | 237 | mValueAnimator.removeAllListeners(); 238 | mValueAnimator.addListener(mAnimatorListener); 239 | 240 | mAnimatorListenerChanged = false; 241 | } 242 | 243 | if (mHideUntilAnimation) { 244 | 245 | mHideUntilAnimation = false; 246 | } 247 | 248 | mValueAnimator.start(); 249 | } 250 | 251 | private void initAnimation() { 252 | 253 | mPaint.setTextSize(mTextSize); 254 | 255 | mCharWidthList = new float[mText.length()]; 256 | 257 | for (int i = 0; i < mText.length(); i++) { 258 | 259 | mCharWidthList[i] = mPaint.measureText(String.valueOf(mText.charAt(i))); 260 | } 261 | } 262 | 263 | private void autoSizePadding() { 264 | 265 | final int newPadding = (int) (((mMaxTextSize - mTextSize) / HALF_DIVIDER) + FLOAT_TO_INT_ROUND_VALUE); 266 | 267 | this.setPadding(newPadding, newPadding, newPadding, newPadding); 268 | } 269 | 270 | public void setMaxTextSize(float maxTextSize, boolean paddingAutoSize) { 271 | 272 | setMaxTextSize(TypedValue.COMPLEX_UNIT_SP, maxTextSize, paddingAutoSize); 273 | } 274 | 275 | public void setMaxTextSize(int unit, float maxTextSize, boolean paddingAutoSize) { 276 | 277 | if (!mValueAnimator.isStarted()) { 278 | 279 | this.mMaxTextSize = TypedValue.applyDimension(unit, maxTextSize, getResources().getDisplayMetrics()); 280 | 281 | if (paddingAutoSize) { 282 | 283 | autoSizePadding(); 284 | } 285 | } 286 | } 287 | 288 | public void setAnimationDuration(int animationDuration) { 289 | 290 | this.mAnimationDuration = animationDuration; 291 | this.mAnimationDurationChanged = true; 292 | } 293 | 294 | public void setCharacterAnimatedTogether(int characterAnimatedTogether) { 295 | 296 | if (!mValueAnimator.isStarted()) { 297 | 298 | this.mCharacterAnimatedTogether = characterAnimatedTogether; 299 | } 300 | } 301 | 302 | public void setMultiLineAnimation(boolean multiLineAnimation) { 303 | 304 | if (!mValueAnimator.isStarted()) { 305 | 306 | this.mMultiLineAnimation = multiLineAnimation; 307 | } 308 | } 309 | 310 | public void setInterpolator(Interpolator interpolator) { 311 | 312 | mInterpolator = interpolator; 313 | mInterpolatorChanged = true; 314 | } 315 | 316 | public void setAnimatorListener(final Animator.AnimatorListener animatorListener) { 317 | 318 | this.mAnimatorListener = animatorListener; 319 | this.mAnimatorListenerChanged = true; 320 | } 321 | 322 | public void setHideUntilAnimation(boolean hideUntilAnimation) { 323 | 324 | this.mHideUntilAnimation = hideUntilAnimation; 325 | 326 | invalidate(); 327 | } 328 | 329 | private float getDefaultMaxTextSize() { 330 | 331 | return this.getTextSize() * DEFAULT_MAX_SIZE_FACTOR; 332 | } 333 | 334 | private int getDefaultAnimationDuration() { 335 | 336 | return mText.length() * DEFAULT_ANIMATION_DURATION_PER_CHARACTER; 337 | } 338 | 339 | public float getFinalTextSize() { 340 | 341 | return mTextSize; 342 | } 343 | 344 | @Override 345 | public void setText(CharSequence text, BufferType type) { 346 | 347 | if (paramChangeAllowed()) { 348 | 349 | if (mPaint != null) { 350 | 351 | mText = text; 352 | 353 | initAnimation(); 354 | } 355 | 356 | super.setText(text, type); 357 | } 358 | } 359 | 360 | 361 | @Override 362 | public void setTextSize(int unit, float size) { 363 | 364 | if (paramChangeAllowed()) { 365 | 366 | super.setTextSize(unit, size); 367 | 368 | if (mPaint != null) { 369 | 370 | mTextSize = getTextSize(); 371 | 372 | initAnimation(); 373 | } 374 | } 375 | } 376 | 377 | @Override 378 | public void onAnimationUpdate(ValueAnimator animation) { 379 | 380 | mProgress = (float) animation.getAnimatedValue(); 381 | DisplayTextView.this.invalidate(); 382 | } 383 | 384 | private boolean paramChangeAllowed() { 385 | 386 | return mValueAnimator == null || !mValueAnimator.isStarted(); 387 | } 388 | } -------------------------------------------------------------------------------- /app/src/main/res/values/attr.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/test/java/org/altmail/displaytextview/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package org.altmail.displaytextview; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.3.2' 11 | 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronpattern/DisplayTextView/ed30cb5c78b230cd9ebb3545ef61ff0077444d31/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Mar 26 00:02:14 CET 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /screenshot/screen1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronpattern/DisplayTextView/ed30cb5c78b230cd9ebb3545ef61ff0077444d31/screenshot/screen1.gif -------------------------------------------------------------------------------- /screenshot/screen2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronpattern/DisplayTextView/ed30cb5c78b230cd9ebb3545ef61ff0077444d31/screenshot/screen2.gif -------------------------------------------------------------------------------- /screenshot/screen3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronpattern/DisplayTextView/ed30cb5c78b230cd9ebb3545ef61ff0077444d31/screenshot/screen3.gif -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------