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);
}
}
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);
}
}
Aggregations