A periodic text updating library

Overview

RotatingText

platform API License: MIT By-MDG

Rotating text is an Android library that can be used to make text switching painless and beautiful, with the use of interpolators, typefaces and more customisations.

Usage

Just add the following dependency in your app's build.gradle

dependencies {
      compile 'com.sdsmdg.harjot:rotatingtext:1.0.2'
}

Example Usage 1 (Simple)

XML

<com.sdsmdg.harjot.rotatingtext.RotatingTextWrapper
        android:id="@+id/custom_switcher"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

Java

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);

Result

Example Usage 2 (Typeface + Interpolator)

XML

<com.sdsmdg.harjot.rotatingtext.RotatingTextWrapper
        android:id="@+id/custom_switcher"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

Java

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.parseColor("#FFA036"), 1000, "Word", "Word01", "Word02");
rotatable.setSize(35);
rotatable.setAnimationDuration(500);
rotatable.setTypeface(typeface);
rotatable.setInterpolator(new BounceInterpolator());

rotatingTextWrapper.setContent("This is ?", rotatable);

Result

Example Usage 3 (Multiple Rotatables)

XML

<com.sdsmdg.harjot.rotatingtext.RotatingTextWrapper
        android:id="@+id/custom_switcher"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

Java

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.parseColor("#FFA036"), 1000, "Word", "Word01", "Word02");
rotatable.setSize(35);
rotatable.setTypeface(typeface);
rotatable.setInterpolator(new AccelerateInterpolator());
rotatable.setAnimationDuration(500);

Rotatable rotatable2 = new Rotatable(Color.parseColor("#123456"), 1000, "Word03", "Word04", "Word05");
rotatable2.setSize(25);
rotatable2.setTypeface(typeface);
rotatable2.setInterpolator(new DecelerateInterpolator());
rotatable2.setAnimationDuration(500);

rotatingTextWrapper.setContent("This is ? and ?", rotatable, rotatable2);

Result

Documentation

Rotating text is made of two parts : RotatingTextWrapper and Rotatable.
Each rotatable encapsulates the collection of words that are two be periodically switched and also defines various properties related to these words, like, size, color, animation interpolator etc.
Each Rotatable must be a part of a RotatingTextWrapper. This defines the actual layout of the text and the positions of the rotating text.

For eg : rotatingTextWrapper.setContent("This is ?", rotatble);. Here the ? denotes the postion of the rotatable.

RotatingTextWrapper

Property Function Description
Content setContent(...) Set the actual content. Composed of a String and array of Rotatables.
Typeface setTypeface(...) Set the typeface of the non-rotating text
Size setSize(...) Set the size of the non-rotating text
Pause pause(x) Method to pause the 'x'th rotatable
Resume resume(x) Method to resume the 'x'th rotatable

Rotatable

Property Function Description
Color setColor(...) Set the color of the rotating text associated with this rotatable
Size setSize(...) Set the size of the rotating text associated with this rotatable
Typeface setTypeface(...) Set the typeface of the rotating text associated with this rotatable
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

License

RotatingText is licensed under MIT license. View license.

Comments
  • Adding horizontal rotation of texts #27

    Adding horizontal rotation of texts #27

    Changes are made in RotatingTextSwitcher to enable horoizontal rotation of texts. Please review my code @CoderMayhem and suggest any changes that i need to make ,thanks!

    opened by Anu-123-gif 5
  • Option for changing color of the Rotating texts #9

    Option for changing color of the Rotating texts #9

    An array of integers representing colors chosen by the user is added to a rotatable and the words are displayed accordingly.

    Please review my code @CoderMayhem

    opened by Anu-123-gif 4
  • Fixed #7 -- Stop rotation after one cycle

    Fixed #7 -- Stop rotation after one cycle

    Fixes #7 - Rotations can be stopped after the no. of cycles user has specified.

    I have added code mainly in RotatingTextSwitcher.java to access the current word (I have considered the word at index 0 initially to be the first word of a cycle)and accordingly keep count of the no. of cycles .As soon as the specified no. of cycles are over the counter variables are reset to 0 and animation is paused.

    opened by Anu-123-gif 4
  • Add option to stop rotation after one cycle.

    Add option to stop rotation after one cycle.

    how do i disable auto slide feature from it??

    i would like to slide only one cycle and the effect to be ended.

    am i missing? or there is no fuctionality for that. or i should implement this by some stupid way (eg. disable the view) ??

    good first issue 
    opened by softmarshmallow 3
  • Support for API 16

    Support for API 16

    Hello, thanks for this great library but don't you think minimum Api level 19 is too high. If its possible can you please bring it down to Api 16. Thank you

    opened by sajorahasan 3
  • For every one second a new timer thread is being created.

    For every one second a new timer thread is being created.

    For every one second a new timer thread is being created. which is making more CPU usage every second. Can you solve the problem.

    Typeface custom_font = Typeface.createFromAsset(getAssets(), "fonts/Reckoner_Bold.ttf"); RotatingTextWrapper rotatingTextWrapper = (RotatingTextWrapper) findViewById(R.id.custom_switcher); rotatingTextWrapper.setSize(35); Rotatable rotatable = new Rotatable(Color.parseColor("#FFA036"), 1000, " Why ?", "What ?", " How ?"); rotatable.setSize(35); rotatable.setAnimationDuration(500); rotatable.setTypeface(custom_font); rotatable.setInterpolator(new BounceInterpolator()); rotatingTextWrapper.setContent("?",rotatable );

    screenshot 8

    opened by Durgaprasad1541996 2
  • Layout inflates on first start

    Layout inflates on first start

    solves issue #16 originally Double taxation helped to inflate layout for lower APIs, but it didn't seemed that way in 24+ API. Here a single call to onMeasure() does so.

    opened by dev-ritik 0
  • Nothing happen Getting error

    Nothing happen Getting error

    Process: com.ekincare.development, PID: 1407 java.lang.ClassCastException: dagger.hilt.android.internal.managers.ViewComponentManager$FragmentContextWrapper cannot be cast to android.app.Activity at com.sdsmdg.harjot.rotatingtext.RotatingTextSwitcher$9.run(RotatingTextSwitcher.java:287) at java.util.TimerThread.mainLoop(Timer.java:562) at java.util.TimerThread.run(Timer.java:512) 2022-06-02 19:06:35.944 1407-2875/com.ekincare.development E/Apxor: Observed Application crash

    opened by PhalugunaRao 0
  • Let's go for v1.1-alpha

    Let's go for v1.1-alpha

    • Compile the changelog since the last version (1.0.2).
    • Update the README to reflect on how to use the updated library.
    • Push the changes to repositories to get the updated alpha dependency.
    • Test and release v1.1

    Create a separate branch for these changes.

    opened by dev-ritik 0
  • Last letters overlap on each other when a rotating text is too long

    Last letters overlap on each other when a rotating text is too long

    Last letters overlap on each other when a rotating text is too long. That's because you don't make use of a dynamiclayout. But if you use it, then you can't animate it.

    Could you please find a solution or help me find one? Thank you! Best regards,

    opened by Jars-of-jam-Scheduler 1
  • How to rotate a DynamicLayout newly implemented in your API?

    How to rotate a DynamicLayout newly implemented in your API?

    Hi,

    I'm using your API "RotatingText" on my Android app (https://github.com/mdg-iitr/RotatingText). I've seen a bug: when the text is too long, the last letters overlap on top of each other. That's because you don't use any layout (dynamiclayout e.g.) in your widget-class RotatingTextSwitcher.

    So I use a dynamiclayout. A new problem occurs: it's not animated (in other words: its texts are not rotated). Indeed, I must use layout.draw(canvas); and I can't use canvas.drawTextOnPath(). That explains why there isn't any animation.

    Please, can you tell me how to make my dynamiclayout and/or it's text rotate in these conditions?

    I have created a well-received Stackoverflow question. A bounty of 300 is available ;-) : https://stackoverflow.com/questions/60028812/android-rotating-text-i-use-dynamiclayout-drawcanvas-but-it-doesnt-animate-a

    I hope you will answer me as soon as possible, Thank you in advance, Best regards,

    opened by Jars-of-jam-Scheduler 0
Owner
Mobile Development Group
Mobile Development Group create products to make experience of people at IITR easy.
Mobile Development Group
A TextView that automatically resizes text to fit perfectly within its bounds.

AutoFitTextView A TextView that automatically resizes text to fit perfectly within its bounds. Usage dependencies { compile 'me.grantland:autofitt

Grantland Chew 4.2k Jan 8, 2023
:page_facing_up: Android Text Full Jusiftication / Wrapping / Justify / Hyphenate - V2.0

LIBRARY IS NO LONGER MAINTAINED If you want to adopt + maintain this library, please drop me a message - [email protected] Android Full Justific

Mathew Kurian 1.9k Dec 29, 2022
Floating hint from edit text - inspired by Matt D. Smith's design: http://dribbble.com/shots/1254439--GIF-Mobile-Form-Interaction?list=users

Float Labeled EditText Simple implementation of a Float Labeled EditText: An Android ViewGroup which uses a child EditText and puts the hint on top of

Wrapp Archive 1.1k Nov 14, 2022
A different beautiful Floating Edit Text

MaterialTextField A different beautiful Floating Edit Text Usage Surround your EditText by a MaterialTextField <com.github.florent37.materialtextfield

Florent CHAMPIGNY 1.5k Nov 11, 2022
Android Library to make it easy to create CodeEditor or IDE that support any languages and themes

CodeView Android Library to make it easy to create your CodeEditor or IDE for any programming language even for your programming language, just config

Amr Hesham 294 Jan 6, 2023
A lightweight Kotlin library for a form state management and field validation.

Chassis A lightweight Kotlin library for a form state management and field validation. Setup Library and it's snapshots are available on Maven Central

Bogusz Pawłowski 30 Dec 12, 2022
WorkManager ,One time,Sequential Execution, Periodic time Execution

WokManagerSample WorkManager ,One time,Sequential Execution, Periodic time Execu

Chhote Lal Pal 0 Dec 21, 2021
An app full of Constantly updating Google Pixel wallpapers

An app full of Stock Google Pixel wallpapers! Download: Found a Wallpaper not on the app? Submit and issue to the Google Pixel Wallpaper repository Sc

Jack Sam 118 Dec 25, 2022
Gradle plugin for updating a project version catalog

Version catalog update plugin This plugin helps to keep the versions in a Gradle version catalog toml file up to date. The version updates are determi

Little Robots 307 Dec 26, 2022
This tool patches the CVE-2021-44228 Log4J vulnerability present in all minecraft versions NOTE THIS TOOL MUST BE RE-RUN after downloading or updating versions of minecraft as its not a perminent patch

WARNING THIS EXPLOIT EFFECTS BOTH CLIENTS AND SERVERS There is currently a exploit going around that affects all versions of Minecraft this exploit ab

Jacobtread 6 Aug 23, 2022
A library that gives full control over text related technologies such as bidirectional algorithm, open type shaping, text typesetting and text rendering

Tehreer-Android Tehreer is a library which gives full control over following text related technologies. Bidirectional Algorithm OpenType Shaping Engin

Tehreer 61 Dec 15, 2022
Speech-Text Converter is a simple task that enable the user to convert the speech to text or convert text to speech (by Mic)

Speech-Text Converter About Speech-Text Converter is a simple task that enable the user to convert the speech to text or convert text to speech (by Mi

Kareem Saeed 1 Oct 21, 2021
A editable text with a constant text/placeholder for Android.

ParkedTextView A EditText with a constant text in the end. How to use <com.goka.parkedtextview.ParkedTextView xmlns:app="http://schemas.android.co

goka 270 Nov 11, 2022
A editable text with a constant text/placeholder for Android.

ParkedTextView A EditText with a constant text in the end. How to use <com.goka.parkedtextview.ParkedTextView xmlns:app="http://schemas.android.co

goka 270 Nov 11, 2022
Jetpack Compose Text composable to show html text from resources

HtmlText Current Compose Version: 1.0.3 Compose HtmlText Text composable to show html text from resources Add to your project Add actual HtmlText libr

Alexander Karkossa 57 Dec 23, 2022
Pdf Reader: Read text in PDF with Text to Speech

PDF Reader PDF Reader Read text in PDF with Text to Speech APK Link Here | App D

Rushikesh Suryawanshi 0 Jan 21, 2022
RTL marquee text view android right to left moving text - persian - farsi - arabic - urdo

RTL marquee text view android right to left moving text - persian - farsi - arabic - urdo

mehran elyasi 4 Feb 14, 2022
Expandable text, similar to Text() in Jetpack Compose

A small library to display expandable texts in Jetpack Compose.

null 3 Sep 8, 2022
A new canvas drawing library for Android. Aims to be the Fabric.js for Android. Supports text, images, and hand/stylus drawing input. The library has a website and API docs, check it out

FabricView - A new canvas drawing library for Android. The library was born as part of a project in SD Hacks (www.sdhacks.io) on October 3rd. It is cu

Antwan Gaggi 1k Dec 13, 2022