use of android.graphics.drawable.ShapeDrawable in project UltimateAndroid by cymcsg.
the class FloatingActionButton method createDrawable.
private Drawable createDrawable(int color) {
OvalShape ovalShape = new OvalShape();
ShapeDrawable shapeDrawable = new ShapeDrawable(ovalShape);
shapeDrawable.getPaint().setColor(color);
if (mShadow) {
LayerDrawable layerDrawable = new LayerDrawable(new Drawable[] { getResources().getDrawable(R.drawable.floating_acition_button_shadow), shapeDrawable });
int shadowSize = getDimension(mType == TYPE_NORMAL ? R.dimen.fab_shadow_size : R.dimen.fab_mini_shadow_size);
layerDrawable.setLayerInset(1, shadowSize, shadowSize, shadowSize, shadowSize);
return layerDrawable;
} else {
return shapeDrawable;
}
}
use of android.graphics.drawable.ShapeDrawable in project UltimateAndroid by cymcsg.
the class ProgressbarWheelActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.progress_wheel_activity);
pw_two = (ProgressWheel) findViewById(R.id.progressBarTwo);
pw_three = (ProgressWheel) findViewById(R.id.progressBarThree);
pw_four = (ProgressWheel) findViewById(R.id.progressBarFour);
//pw_five = (ProgressWheel) findViewById(R.id.progressBarFive);
ShapeDrawable bg = new ShapeDrawable(new RectShape());
int[] pixels = new int[] { 0xFF2E9121, 0xFF2E9121, 0xFF2E9121, 0xFF2E9121, 0xFF2E9121, 0xFF2E9121, 0xFFFFFFFF, 0xFFFFFFFF };
Bitmap bm = Bitmap.createBitmap(pixels, 8, 1, Bitmap.Config.ARGB_8888);
Shader shader = new BitmapShader(bm, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
pw_three.setRimShader(shader);
pw_three.spin();
pw_four.spin();
final Runnable r = new Runnable() {
public void run() {
running = true;
while (progress < 361) {
pw_two.incrementProgress();
progress++;
try {
Thread.sleep(15);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
running = false;
}
};
Button spin = (Button) findViewById(R.id.btn_spin);
spin.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
if (!running) {
if (pw_two.isSpinning) {
pw_two.stopSpinning();
}
pw_two.resetCount();
pw_two.setText("Loading...");
pw_two.spin();
}
}
});
Button increment = (Button) findViewById(R.id.btn_increment);
increment.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
if (!running) {
progress = 0;
pw_two.resetCount();
Thread s = new Thread(r);
s.start();
}
}
});
}
use of android.graphics.drawable.ShapeDrawable in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class FloatingActionButton method createCircleDrawable.
private Drawable createCircleDrawable(int color, float strokeWidth) {
int alpha = Color.alpha(color);
int opaqueColor = opaque(color);
ShapeDrawable fillDrawable = new ShapeDrawable(new OvalShape());
final Paint paint = fillDrawable.getPaint();
paint.setAntiAlias(true);
paint.setColor(opaqueColor);
Drawable[] layers = { fillDrawable, createInnerStrokesDrawable(opaqueColor, strokeWidth) };
LayerDrawable drawable = alpha == 255 || !mStrokeVisible ? new LayerDrawable(layers) : new TranslucentLayerDrawable(alpha, layers);
int halfStrokeWidth = (int) (strokeWidth / 2f);
drawable.setLayerInset(1, halfStrokeWidth, halfStrokeWidth, halfStrokeWidth, halfStrokeWidth);
return drawable;
}
use of android.graphics.drawable.ShapeDrawable in project coins-android by bubelov.
the class StaticClusterRenderer method makeClusterBackground.
private LayerDrawable makeClusterBackground() {
mColoredCircleBackground = new ShapeDrawable(new OvalShape());
ShapeDrawable outline = new ShapeDrawable(new OvalShape());
// Transparent white.
outline.getPaint().setColor(Color.WHITE);
LayerDrawable background = new LayerDrawable(new Drawable[] { outline, mColoredCircleBackground });
int strokeWidth = (int) (mDensity * 1.5f);
background.setLayerInset(1, strokeWidth, strokeWidth, strokeWidth, strokeWidth);
return background;
}
Aggregations