From 91016ff4bbb6932c3351068a969a2664d2ab4201 Mon Sep 17 00:00:00 2001 From: NikitaGordia Date: Sat, 26 May 2018 10:57:14 +0300 Subject: [PATCH] onEnd animation --- .idea/modules.xml | 3 ++ README.md | 9 +++-- .../cosinloading/MainActivity.java | 8 ++++ app/src/main/res/layout/activity_main.xml | 6 +++ .../java/com/nikitagordia/cosin/Cosin.java | 38 +++++++++++++++---- .../cosin/colorAdapters/ColorAdapterBG.java | 4 +- .../cosin/colorAdapters/ColorAdapterBR.java | 4 +- .../cosin/colorAdapters/ColorAdapterGR.java | 4 +- .../cosin/colorAdapters/ColorAdapterRB.java | 4 +- .../cosin/colorAdapters/ColorAdapterRG.java | 4 +- .../colorAdapters/DefaultColorAdapterGB.java | 4 +- 11 files changed, 64 insertions(+), 24 deletions(-) diff --git a/.idea/modules.xml b/.idea/modules.xml index 995a4bf..124ea16 100755 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,8 +2,11 @@ + + + diff --git a/README.md b/README.md index 1d7c332..0deca4d 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ allprojects { build.gradle (Module) ```groovy -implementation 'com.github.NikitaGordia:Cosin:1.0.0' +implementation 'com.github.NikitaGordia:Cosin:1.1.0' ``` # Quick start guide @@ -50,12 +50,13 @@ implementation 'com.github.NikitaGordia:Cosin:1.0.0' | --------------------------------------|-----------------------------------------------------------------------------------------------------------| | speed | Angle speed | | isLoading | If 'true' shows symbols on rectangle | +| setEnd | Shows end animation (optionally you may pass onEnd(OnEnd)) | rectWidth | Width each of rectangle | | period | Determine period of cosinusoidal function | | colorAdapter | Define color changes by two parameters (position count, height percent) for each rectagle | | offset | Moving bottom offset | | directionRight | Determine movement side | -| textAdapter | Define text changes by position count for each rectagle | +| textAdapter | Define text changes by position count for each rectangle | ## There are 6 default ColorAdapter implementation in box : @@ -84,8 +85,8 @@ public class ColorAdapterBR implements Cosin.ColorAdapter { } @Override - public int calcColor(int numOfRect, double percentOfHeght) { - return Color.argb(150, (int)(255 * (1d - percentOfHeght)), 0, (int)(255 * percentOfHeght)); + public int calcColor(int numOfRect, double percentOfHeight) { + return Color.argb(150, (int)(255 * (1d - percentOfHeight)), 0, (int)(255 * percentOfHeight)); } } ``` diff --git a/app/src/main/java/com/nikitagordia/cosinloading/MainActivity.java b/app/src/main/java/com/nikitagordia/cosinloading/MainActivity.java index c165017..2ac28a0 100755 --- a/app/src/main/java/com/nikitagordia/cosinloading/MainActivity.java +++ b/app/src/main/java/com/nikitagordia/cosinloading/MainActivity.java @@ -5,6 +5,7 @@ import android.support.v7.app.AppCompatActivity; import android.text.Editable; import android.text.TextWatcher; +import android.view.View; import android.widget.CompoundButton; import android.widget.RadioGroup; import android.widget.SeekBar; @@ -230,6 +231,13 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { bind.cosin.setDirectionRight(isChecked); } }); + + bind.stop.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + bind.cosin.setEnd(); + } + }); } private int part(int x, Cosin.Limit lim) { diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 31c9722..ea2fa9d 100755 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -489,6 +489,12 @@ +