https://github.com/nikitagordia/cosin
Android loading view library 📊🍭
https://github.com/nikitagordia/cosin
android android-indicator animation animation-indicator calculations cosinus customview gradle graphics highlight indicator jitpack loading tutorial view waitingpage
Last synced: about 1 year ago
JSON representation
Android loading view library 📊🍭
- Host: GitHub
- URL: https://github.com/nikitagordia/cosin
- Owner: NikitaGordia
- License: mit
- Created: 2018-04-21T10:47:39.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-26T07:58:00.000Z (about 8 years ago)
- Last Synced: 2025-05-07T04:09:38.156Z (about 1 year ago)
- Topics: android, android-indicator, animation, animation-indicator, calculations, cosinus, customview, gradle, graphics, highlight, indicator, jitpack, loading, tutorial, view, waitingpage
- Language: Java
- Homepage:
- Size: 3.07 MB
- Stars: 124
- Watchers: 1
- Forks: 18
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
COSIN
Loading android view lib

# Gradle :
build.gradle (Project)
```groovy
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```
build.gradle (Module)
```groovy
implementation 'com.github.NikitaGordia:Cosin:1.1.0'
```
# Quick start guide
## Declaration
```xml
```
## Properties
| Property | Description |
| --------------------------------------|-----------------------------------------------------------------------------------------------------------|
| 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 rectangle |
## There are 6 default ColorAdapter implementation in box :
* DefaultColorAdapterGB (Green -> Blue)
* ColorAdapterBG (Blue -> Green)
* ColorAdapterBR (Blue -> Red)
* ColorAdapterGR (Green -> Blue)
* ColorAdapterRB (Red -> Blue)
* ColorAdapterRG (Red -> Green)
* ColorAdapterBG (Blue -> Green)
## There are 2 default TextAdapter implementation in box :
* DefaultBinaryTextAdapter (shows random [0, 1] symbols in each rectagle)
* WordTextAdapter (shows specified cycle String)
#### ColorAdapter overriding example :
```java
public class ColorAdapterBR implements Cosin.ColorAdapter {
@Override
public int getBackgroundColor() {
return Color.TRANSPARENT;
}
@Override
public int calcColor(int numOfRect, double percentOfHeight) {
return Color.argb(150, (int)(255 * (1d - percentOfHeight)), 0, (int)(255 * percentOfHeight));
}
}
```
#### TextAdapter overriding example :
```java
public class WordTextAdapter implements Cosin.TextAdapter {
private String word;
public WordTextAdapter(String word) {
this.word = word;
}
@Override
public char getString(int numOfRect) {
if (word.isEmpty()) return ' ';
return word.charAt(numOfRect % word.length());
}
}
```
#### A bit more gifs