use of android.graphics.drawable.InsetDrawable in project actor-platform by actorapp.
the class ShareMenuButtonFactory method get.
public static StateListDrawable get(int color, Context context) {
ShapeDrawable bg = new ShapeDrawable(new OvalShape());
int padding = Screen.dp(5);
bg.getPaint().setColor(color);
ShapeDrawable bgPressed = new ShapeDrawable(new OvalShape());
bgPressed.getPaint().setColor(ActorStyle.getDarkenArgb(color, 0.95));
StateListDrawable states = new StateListDrawable();
states.addState(new int[] { android.R.attr.state_pressed }, new InsetDrawable(bgPressed, padding));
states.addState(StateSet.WILD_CARD, new InsetDrawable(bg, padding));
return states;
}
use of android.graphics.drawable.InsetDrawable in project plaid by nickbutcher.
the class PasswordEntry method getTextLeft.
private int getTextLeft() {
int left = 0;
if (getBackground() instanceof InsetDrawable) {
InsetDrawable back = (InsetDrawable) getBackground();
Rect padding = new Rect();
back.getPadding(padding);
left = padding.left;
}
return left;
}
use of android.graphics.drawable.InsetDrawable in project Shuttle by timusus.
the class SettingsFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (mPrefResId == R.xml.settings_headers) {
if (getListView() != null && getListView().getDivider() != null) {
Drawable drawable = getListView().getDivider();
InsetDrawable divider = new InsetDrawable(drawable, ResourceUtils.toPixels(72), 0, 0, 0);
getListView().setDivider(divider);
}
}
}
use of android.graphics.drawable.InsetDrawable in project material-components-android by material-components.
the class FloatingActionButtonLollipop method onPaddingUpdated.
@Override
void onPaddingUpdated(Rect padding) {
if (mShadowViewDelegate.isCompatPaddingEnabled()) {
mInsetDrawable = new InsetDrawable(mRippleDrawable, padding.left, padding.top, padding.right, padding.bottom);
mShadowViewDelegate.setBackgroundDrawable(mInsetDrawable);
} else {
mShadowViewDelegate.setBackgroundDrawable(mRippleDrawable);
}
}
use of android.graphics.drawable.InsetDrawable in project AmazeFileManager by TeamAmaze.
the class FastScroller method setPressedHandleColor.
public void setPressedHandleColor(int i) {
handle.setColorFilter(i);
StateListDrawable stateListDrawable = new StateListDrawable();
Drawable drawable = ContextCompat.getDrawable(getContext(), R.drawable.fastscroller_handle_normal);
Drawable drawable1 = ContextCompat.getDrawable(getContext(), R.drawable.fastscroller_handle_pressed);
stateListDrawable.addState(View.PRESSED_ENABLED_STATE_SET, new InsetDrawable(drawable1, getResources().getDimensionPixelSize(R.dimen.fastscroller_track_padding), 0, 0, 0));
stateListDrawable.addState(View.EMPTY_STATE_SET, new InsetDrawable(drawable, getResources().getDimensionPixelSize(R.dimen.fastscroller_track_padding), 0, 0, 0));
this.handle.setImageDrawable(stateListDrawable);
}
Aggregations