Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency Update #31

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Changelog

All notable changes to this project will be documented in this file.

## Unreleased

### Added
- Option for changing color of rotating texts by [@Anu-123-gif](https://github.com/Anu-123-gif) and [@dev-ritik](https://github.com/dev-ritik) in [9d8a330](https://github.com/mdg-iitr/RotatingText/commit/9d8a330fee558856c564db7318579038c8ca1c40)
- Stop rotation after one cycle by [@Anu-123-gif](https://github.com/Anu-123-gif) and [@dev-ritik](https://github.com/dev-ritik) in [8ed21ea](https://github.com/mdg-iitr/RotatingText/commit/8ed21ea7825f4f3a87af523e1a0693a78eaf646e)
- Method to add words to rotating texts added by [@dev-ritik](https://github.com/dev-ritik) in [118ab03](https://github.com/mdg-iitr/RotatingText/commit/118ab03d598cdb19e8ee2b8cff6586e7e23a19e4)
- onMeasure method added by [@dev-ritik](https://github.com/dev-ritik) in [dea14a2](https://github.com/mdg-iitr/RotatingText/commit/dea14a2099f27ba730b62be30b786c94cb56c01a)
- Adaptable function added by [@dev-ritik](https://github.com/dev-ritik) in [075b235](https://github.com/mdg-iitr/RotatingText/commit/075b23527408ba89e201fec3afea9364343573dc)
- Added requestLayout() calls by [@harjot-oberai](https://github.com/harjot-oberai) in [a0f8a1f](https://github.com/mdg-iitr/RotatingText/commit/a0f8a1fc763b25870edd8831468df25792f1f9b5)
- Added rx-android dependencies by [@harjot-oberai](https://github.com/harjot-oberai) in [c90af4c](https://github.com/mdg-iitr/RotatingText/commit/c90af4c25c0110586b34d55ff9c6466082a701a9)

### Changed
- Used interface to rename word by [@dev-ritik](https://github.com/dev-ritik) in [289c04f](https://github.com/mdg-iitr/RotatingText/commit/289c04f1ff91e6653c798c39629a9e17e73d7cf7)
- Renamed addWord method to replaceWord by [@harjot-oberai](https://github.com/harjot-oberai) in [36c31fd](https://github.com/mdg-iitr/RotatingText/commit/3646f79dfe79bfe21fe13cb81bc24a4eb0d2604d)
- "One line only" warning added in app by by [@dev-ritik](https://github.com/dev-ritik) in [075b235](https://github.com/mdg-iitr/RotatingText/commit/075b23527408ba89e201fec3afea9364343573dc)
- Updated dependencies by by [@harjot-oberai](https://github.com/harjot-oberai) in [a46ceb9](https://github.com/mdg-iitr/RotatingText/commit/a46ceb945d6f8ba5f8d6dc6e1eccc45fd556780c)

### Fixed
- Code improved and one word bug fixed by [@dev-ritik](https://github.com/dev-ritik) in [f29c8b7](https://github.com/mdg-iitr/RotatingText/commit/f29c8b7bc9ce1caf79992af12e6690a4b5932509)
73 changes: 70 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
```

Expand Down Expand Up @@ -112,6 +112,71 @@ rotatingTextWrapper.setContent("This is ? and ?", rotatable, rotatable2);
#### Result
<img src="/screens/gif_example_3.gif"/>

## Example Usage 4 (Changing Colors)
#### XML

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

#### 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
<img src="/screens/gif_example_4.gif"/>

## Example Usage 5 (Stop rotations after given number of cycles)
#### XML

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

#### 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
<img src="/screens/gif_example_5.gif"/>

# Documentation

Rotating text is made of two parts : `RotatingTextWrapper` and `Rotatable`. <br>
Expand All @@ -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).
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public class MainActivity extends AppCompatActivity {
Spinner s1;
String word;
int nCycles;
EditText enterCycles;
EditText e1;
EditText enterCycles,e1;


Button button;
Integer[] color = new Integer[]{Color.BLUE,Color.MAGENTA,Color.RED};
Expand Down Expand Up @@ -67,7 +67,7 @@ protected void onCreate(Bundle savedInstanceState) {
rotatingTextWrapper.setContent("?abc ? abc", rotatable, rotatable2);
// rotatingTextWrapper.setContent("? abc", rotatable);

s1 = (Spinner) findViewById(R.id.spinner);
s1 = findViewById(R.id.spinner);



Expand All @@ -82,7 +82,7 @@ protected void onCreate(Bundle savedInstanceState) {
s1.setAdapter(dataAdapter);
s1.setSelection(0);

e1 = (EditText) findViewById(R.id.replaceWord);
e1 = findViewById(R.id.addWord);

button = findViewById(R.id.pause_button);
button.setOnClickListener(new View.OnClickListener() {
Expand All @@ -96,26 +96,9 @@ public void onClick(View view) {
}
});

Button button2 = findViewById(R.id.set_button);
button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
enterCycles = (EditText) findViewById(R.id.enterCycles);


if(!enterCycles.getText().toString().equals("") && enterCycles.getText() != null) {
nCycles = Integer.parseInt(enterCycles.getText().toString());
}

rotatable.setInitialWord(word);
rotatable.setCycles(nCycles);

if (rotatingTextWrapper.getSwitcherList().get(0).isPaused()) {
rotatingTextWrapper.resume(0);
}
}
});


Button buttonChange = findViewById(R.id.change);
buttonChange.setOnClickListener(new View.OnClickListener() {
@Override
Expand All @@ -125,17 +108,30 @@ public void onClick(View view) {
rotatable2.setApplyHorizontal(!apply);
}
});

}

public void replaceWord(View view) {
public void addNewWord(View view) {
String newWord = e1.getText().toString();
if (TextUtils.isEmpty(newWord)) e1.setText("can't be left empty");
else if (newWord.contains("\n")) e1.setText("one line only");
else {
rotatingTextWrapper.setAdaptable(true);
rotatingTextWrapper.addWord(0, (int) s1.getSelectedItem() - 1, newWord);
}
}

public void stopRotation(View view){
enterCycles = findViewById(R.id.enterCycles);
if(!enterCycles.getText().toString().equals("") && enterCycles.getText() != null) {
nCycles = Integer.parseInt(enterCycles.getText().toString());
}
rotatable.setInitialWord(word);
rotatable.setCycles(nCycles);

if (rotatingTextWrapper.getSwitcherList().get(0).isPaused()) {
rotatingTextWrapper.resume(0);
}
}
}

9 changes: 5 additions & 4 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
android:layout_height="wrap_content">

<EditText
android:id="@+id/replaceWord"
android:id="@+id/addWord"
android:layout_width="0dp"
android:layout_weight="5"
android:layout_height="wrap_content"
Expand All @@ -38,13 +38,13 @@
</LinearLayout>

<Button
android:id="@+id/replace_button"
android:id="@+id/add_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/replaceLayout"
android:layout_centerHorizontal="true"
android:onClick="replaceWord"
android:text="replace" />
android:onClick="addNewWord"
android:text="Add" />

<RelativeLayout
android:layout_width="match_parent"
Expand Down Expand Up @@ -90,6 +90,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Set"
android:onClick="stopRotation"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
/>
Expand Down
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4"
classpath "com.github.dcendents:android-maven-gradle-plugin:2.1"



// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Empty file modified gradlew
100644 → 100755
Empty file.
43 changes: 43 additions & 0 deletions rotatingtext/bintray.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apply plugin: 'com.jfrog.bintray'

version = libraryVersion

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}

// Bintray
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")

configurations = ['archives']
pkg {
repo = bintrayRepo
name = bintrayName
desc = libraryDescription
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = allLicenses
publish = true
publicDownloadNumbers = true
}
}
18 changes: 9 additions & 9 deletions rotatingtext/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apply plugin: 'com.android.library'

ext {
bintrayRepo = 'RotatingText'
bintrayName = 'rotatingtext'
bintrayRepo = 'rotating-text' //Repo name in bintray dashboard
bintrayName = 'com.sdsmdg.harjot.rotatingtextlibrary' // package name of the bintray repo

publishedGroupId = 'com.sdsmdg.harjot'
publishedGroupId = 'in.ac.iitr.mdg'
libraryName = 'RotatingText'
artifact = 'rotatingtext'

Expand All @@ -13,11 +13,11 @@ ext {
siteUrl = 'https://github.com/sdsmdg/RotatingText'
gitUrl = 'https://github.com/sdsmdg/RotatingText.git'

libraryVersion = '1.0.2'
libraryVersion = '1.1.0-alpha'

developerId = 'harjot-oberai'
developerName = 'Harjot Singh Oberai'
developerEmail = 'harjot.oberai@gmail.com'
developerId = 'mdg-iitr' // This is the bintray username under which the library has been published
developerName = 'Harjot Singh Oberai' // Developer's name
developerEmail = 'mdg.iitr@gmail.com'

licenseName = 'The MIT License'
licenseUrl = 'https://opensource.org/licenses/MIT'
Expand Down Expand Up @@ -54,6 +54,6 @@ dependencies {

}

apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
apply from: 'bintray.gradle'
apply from: 'install.gradle'

42 changes: 42 additions & 0 deletions rotatingtext/install.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apply plugin: 'com.github.dcendents.android-maven'

group = publishedGroupId

install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
groupId publishedGroupId
artifactId artifact

// Add your description here
name libraryName
description libraryDescription
url siteUrl

// Set your license
licenses {
license {
name licenseName
url licenseUrl
}
}
developers {
developer {
id developerId
name developerName
email developerEmail
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl

}
}
}
}
}
Loading