diff --git a/README.md b/README.md
index ec0dbe9..36e80f8 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ Rotating text is an Android library that can be used to make text switching pain
Just add the following dependency in your app's `build.gradle`
```
dependencies {
- compile 'com.sdsmdg.harjot:rotatingtext:1.0.2'
+ implementation 'in.ac.iitr.mdg:rotatingtext:1.1.0-alpha'
}
```
@@ -112,6 +112,71 @@ rotatingTextWrapper.setContent("This is ? and ?", rotatable, rotatable2);
#### Result
+## Example Usage 4 (Changing Colors)
+#### XML
+
+```
+
+```
+
+#### Java
+
+```
+ Integer[] color = new Integer[]{Color.parseColor("#ecc19c"),Color.parseColor("#1e847f"),Color.parseColor("#000000")};
+
+ Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/Raleway-Light.ttf");
+ Typeface typeface2 = Typeface.createFromAsset(getAssets(), "fonts/Reckoner_Bold.ttf");
+
+ RotatingTextWrapper rotatingTextWrapper = (RotatingTextWrapper) findViewById(R.id.custom_switcher);
+ rotatingTextWrapper.setSize(35);
+ rotatingTextWrapper.setTypeface(typeface2);
+
+ Rotatable rotatable = new Rotatable(color , 1000, "Rotating", "Text", "Library");
+ rotatable.setSize(30);
+ rotatable.setTypeface(typeface);
+ rotatable.setInterpolator(new AccelerateInterpolator());
+ rotatable.setAnimationDuration(500);
+
+ rotatingTextWrapper.setContent("This is ?", rotatable);
+```
+#### Result
+
+
+## Example Usage 5 (Stop rotations after given number of cycles)
+#### XML
+
+```
+
+```
+
+#### Java
+
+```
+ String word;
+ int nCycles;
+
+ RotatingTextWrapper rotatingTextWrapper = (RotatingTextWrapper) findViewById(R.id.custom_switcher);
+ rotatingTextWrapper.setSize(35);
+
+ Rotatable rotatable = new Rotatable(Color.parseColor("#FFA036"), 1000, "Word", "Word01", "Word02");
+ rotatable.setSize(35);
+ rotatable.setAnimationDuration(500);
+
+ rotatingTextWrapper.setContent("This is ?", rotatable);
+ word = rotatable.getTextAt(0); //Set the index of the word on which you want the rotation to stop
+ nCycles = 2;
+ rotatable.setCycles(nCycles);
+ rotatable.setInitialWord(word);
+```
+#### Result
+
+
# Documentation
Rotating text is made of two parts : `RotatingTextWrapper` and `Rotatable`.
@@ -138,8 +203,10 @@ For eg : `rotatingTextWrapper.setContent("This is ?", rotatble);`. Here the `?`
|Interpolator | setInterpolator(...) | Set the animation interpolator used while switching text |
|Update Duration | setUpdateDuration(...) | Set the interval between switching the words |
|Animation Duration | setAnimationDuration(...) | Set the duration of the switching animation |
-|Center Align | setCenter(...) |Align the rotating text to center of the textview if set to **true** |
-
+|Center Align | setCenter(...) | Align the rotating text to center of the textview if set to **true** |
+|Text | getTextAt(...) | Get the rotating text at a particular index |
+|Initial Word | setInitialWord(...) | Set the word on which the rotation has to stop |
+|Cycles | setCycles(...) | Set the number of cyles of rotations needed before stopping |
# License
RotatingText is licensed under `MIT license`. View [license](LICENSE.md).
diff --git a/app/src/main/java/com/sdsmdg/harjot/rotatingtextlibrary/MainActivity.java b/app/src/main/java/com/sdsmdg/harjot/rotatingtextlibrary/MainActivity.java
index 603543e..41aee96 100644
--- a/app/src/main/java/com/sdsmdg/harjot/rotatingtextlibrary/MainActivity.java
+++ b/app/src/main/java/com/sdsmdg/harjot/rotatingtextlibrary/MainActivity.java
@@ -97,6 +97,18 @@ public void onClick(View view) {
});
+
+
+ Button buttonChange = findViewById(R.id.change);
+ buttonChange.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ boolean apply = rotatable.getApplyHorizontal();
+ rotatable.setApplyHorizontal(!apply);
+ rotatable2.setApplyHorizontal(!apply);
+ }
+ });
+
}
public void addNewWord(View view) {
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index a217376..6e7de32 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -51,6 +51,13 @@
android:layout_height="match_parent"
android:layout_alignParentBottom="true">
+
+