Search in sources :

Example 6 with Sprite

use of com.github.ybq.android.spinkit.sprite.Sprite in project Android-SpinKit by ybq.

the class CubeGrid method onBoundsChange.

@Override
protected void onBoundsChange(Rect bounds) {
    super.onBoundsChange(bounds);
    bounds = clipSquare(bounds);
    int width = (int) (bounds.width() * 0.33f);
    int height = (int) (bounds.height() * 0.33f);
    for (int i = 0; i < getChildCount(); i++) {
        int x = i % 3;
        int y = i / 3;
        int l = bounds.left + x * width;
        int t = bounds.top + y * height;
        Sprite sprite = getChildAt(i);
        sprite.setDrawBounds(l, t, l + width, t + height);
    }
}
Also used : RectSprite(com.github.ybq.android.spinkit.sprite.RectSprite) Sprite(com.github.ybq.android.spinkit.sprite.Sprite)

Example 7 with Sprite

use of com.github.ybq.android.spinkit.sprite.Sprite in project Android-SpinKit by ybq.

the class Wave method onBoundsChange.

@Override
protected void onBoundsChange(Rect bounds) {
    super.onBoundsChange(bounds);
    bounds = clipSquare(bounds);
    int rw = bounds.width() / getChildCount();
    int width = bounds.width() / 5 * 3 / 5;
    for (int i = 0; i < getChildCount(); i++) {
        Sprite sprite = getChildAt(i);
        int l = bounds.left + i * rw + rw / 5;
        int r = l + width;
        sprite.setDrawBounds(l, bounds.top, r, bounds.bottom);
    }
}
Also used : RectSprite(com.github.ybq.android.spinkit.sprite.RectSprite) Sprite(com.github.ybq.android.spinkit.sprite.Sprite)

Aggregations

Sprite (com.github.ybq.android.spinkit.sprite.Sprite)7 RectSprite (com.github.ybq.android.spinkit.sprite.RectSprite)5 Rect (android.graphics.Rect)2 SuppressLint (android.annotation.SuppressLint)1 PagerAdapter (android.support.v4.view.PagerAdapter)1 ViewPager (android.support.v4.view.ViewPager)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 TextView (android.widget.TextView)1 SpinKitView (com.github.ybq.android.spinkit.SpinKitView)1 Style (com.github.ybq.android.spinkit.Style)1