• Stars
    star
    1,584
  • Rank 29,334 (Top 0.6 %)
  • Language
    Java
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A periodic text updating library

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.

More Repositories

1

trianglify

Highly customizable library to generate beautiful triangle art views for android.
Java
262
star
2

Swipper

Android library for swipable gestures
Java
106
star
3

scrollytell

Cross-platform Scrolly Telling library built using Flutter.
Dart
47
star
4

flasto

A FLoating ASsistive TOuch library for android!
Java
25
star
5

codephile-mobile

Dart
24
star
6

recommends

A collection of resources and reading material that we recommend
23
star
7

appetizer-flutter

Flutter App for Appetizer
Dart
21
star
8

bot

Slack bot (bro) for MDG Space, IITR.
CoffeeScript
19
star
9

codephile-backend

Back-end for Official Codephile App
Go
16
star
10

campusbuddy-flutter

Dart
8
star
11

echofy

JavaScript
8
star
12

domain-forge

A tool designed to help members of MDG space generate dynamic subdomains.
TypeScript
7
star
13

JMusic

WIP: A minified audio extraction library compatible with Android
Java
7
star
14

activity-leaderboard-backend

Activity Leaderboard Backend
Java
6
star
15

Cognizance17

Official app for the IIT Roorkee Tech fest cognizance'17
Java
5
star
16

liener

Android app to load hyperlinks behind the curtains seamlessly
Java
5
star
17

TEDx-ReactNative

React native mobile app for TEDx IITRoorkee
JavaScript
3
star
18

attachable-floating-menu

A Floating Action Button's Menu which attaches to any View!
Kotlin
3
star
19

Netforms

C++
3
star
20

iitr-chatbot

ChatBot for the IITR website
Python
2
star
21

CampusBuddy-iOS

Campus Buddy - Revolutionising IITR
Swift
2
star
22

CampusBuddy

Campus Buddy is an assistant who helps you search Telephone Directory of IIT Roorkee and keeps you updated with the facebook feed of campus groups at IIT Roorkee.
Java
2
star
23

server-setup

script to setup ec2 instances for mdgspace
Shell
2
star
24

Cognizance14

Android Application for Cognizance 2014 , technical fest of IIT-Roorkee
Java
1
star
25

Codinghandles-Api-s

A service which provides api's for extracting popular codinghandles data
Python
1
star
26

productivity-launcher

Apps will disappear from the launcher when their daily or session limits are expended.
Kotlin
1
star
27

CodeforcesAPI

This is my attempt at some python web scraping.
Python
1
star
28

PhoneLinux-Desktop

Python
1
star
29

wipe_out

JavaScript
1
star
30

iitr-chatbot-backend

Python
1
star
31

calling-text

Java
1
star
32

tracer

Track your progress, healthy competition in organization others, and unleash your GitHub potential
Java
1
star
33

activity-leaderboard

TypeScript
1
star