From ee780d4f28a212b3e5316af131a3cc21e68a9850 Mon Sep 17 00:00:00 2001 From: Naman Mishra Date: Mon, 22 Jun 2020 21:18:06 +0530 Subject: [PATCH 01/13] Created Changelog file --- CHANGELOG.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c2ed6a5 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,22 @@ +#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) [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) From dc01b3309dbc9acb8fa3db85c5e4be252e320620 Mon Sep 17 00:00:00 2001 From: Naman Mishra Date: Mon, 22 Jun 2020 21:22:13 +0530 Subject: [PATCH 02/13] Formatted file --- CHANGELOG.md | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2ed6a5..87d6d36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,22 +1,23 @@ -#Changelog +# Changelog + All notable changes to this project will be documented in this file. -##[Unreleased] +## 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) [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) +### 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) [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) +### 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) +### 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) From 76c5ce2aea6f55c4abd588156b80b9a0f1088214 Mon Sep 17 00:00:00 2001 From: Naman Mishra Date: Mon, 22 Jun 2020 21:23:11 +0530 Subject: [PATCH 03/13] Formatted file --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87d6d36..e99221f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ 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) [9d8a330](https://github.com/mdg-iitr/RotatingText/commit/9d8a330fee558856c564db7318579038c8ca1c40) +- 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) From b629af3aa1b2d9febdc2d31772e4a6362c780308 Mon Sep 17 00:00:00 2001 From: CoderMayhem Date: Tue, 23 Jun 2020 12:38:51 +0530 Subject: [PATCH 04/13] Refactored app code and removed redundant casts --- .../rotatingtextlibrary/MainActivity.java | 40 ++++++++----------- app/src/main/res/layout/activity_main.xml | 9 +++-- 2 files changed, 22 insertions(+), 27 deletions(-) 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 1c36a17..603543e 100644 --- a/app/src/main/java/com/sdsmdg/harjot/rotatingtextlibrary/MainActivity.java +++ b/app/src/main/java/com/sdsmdg/harjot/rotatingtextlibrary/MainActivity.java @@ -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}; @@ -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); @@ -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() { @@ -96,28 +96,10 @@ 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); - } - } - }); } - 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"); @@ -125,7 +107,19 @@ public void replaceWord(View view) { 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); + } } } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 0a861eb..a217376 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -19,7 +19,7 @@ android:layout_height="wrap_content">