Need help with Cosin?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

NikitaGordia
129 Stars 18 Forks MIT License 7 Commits 0 Opened issues

Description

Android loading view library 📊🍭

Services available

!
?

Need anything else?

Contributors list

# 324,694
Gradle
Java
jitpack
Android
6 commits

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


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 :

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 :

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

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.