Search in sources :

Example 1 with InsetDrawable

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;
}
Also used : ShapeDrawable(android.graphics.drawable.ShapeDrawable) InsetDrawable(android.graphics.drawable.InsetDrawable) OvalShape(android.graphics.drawable.shapes.OvalShape) StateListDrawable(android.graphics.drawable.StateListDrawable)

Example 2 with InsetDrawable

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;
}
Also used : Rect(android.graphics.Rect) InsetDrawable(android.graphics.drawable.InsetDrawable) TextPaint(android.text.TextPaint)

Example 3 with InsetDrawable

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);
        }
    }
}
Also used : Drawable(android.graphics.drawable.Drawable) InsetDrawable(android.graphics.drawable.InsetDrawable) InsetDrawable(android.graphics.drawable.InsetDrawable)

Example 4 with InsetDrawable

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);
    }
}
Also used : InsetDrawable(android.graphics.drawable.InsetDrawable)

Example 5 with InsetDrawable

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);
}
Also used : InsetDrawable(android.graphics.drawable.InsetDrawable) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) StateListDrawable(android.graphics.drawable.StateListDrawable) InsetDrawable(android.graphics.drawable.InsetDrawable) StateListDrawable(android.graphics.drawable.StateListDrawable)

Aggregations

InsetDrawable (android.graphics.drawable.InsetDrawable)32 Drawable (android.graphics.drawable.Drawable)11 LayerDrawable (android.graphics.drawable.LayerDrawable)6 StateListDrawable (android.graphics.drawable.StateListDrawable)5 Resources (android.content.res.Resources)4 GradientDrawable (android.graphics.drawable.GradientDrawable)4 ShapeDrawable (android.graphics.drawable.ShapeDrawable)4 TypedArray (android.content.res.TypedArray)3 RoundRectShape (android.graphics.drawable.shapes.RoundRectShape)3 ImageView (android.widget.ImageView)3 TextView (android.widget.TextView)3 Attributes (com.cengalabs.flatui.Attributes)3 Typeface (android.graphics.Typeface)2 BitmapDrawable (android.graphics.drawable.BitmapDrawable)2 ColorDrawable (android.graphics.drawable.ColorDrawable)2 PaintDrawable (android.graphics.drawable.PaintDrawable)2 VectorDrawableCompat (android.support.graphics.drawable.VectorDrawableCompat)2 SuppressLint (android.annotation.SuppressLint)1 TargetApi (android.annotation.TargetApi)1 Context (android.content.Context)1