List of usage examples for android.support.v4.content.res ResourcesCompat getDrawable
public static Drawable getDrawable(Resources resources, int i, Theme theme) throws NotFoundException
From source file:click.kobaken.rxirohaandroid_sample.util.AndroidSupportUtil.java
public static Drawable getDrawable(Context context, @DrawableRes int drawableId) { return ResourcesCompat.getDrawable(context.getResources(), drawableId, context.getTheme()); }
From source file:com.google.android.apps.santatracker.presentquest.util.VectorUtil.java
public static BitmapDescriptor vectorToBitmap(Context context, @DrawableRes int id) { Drawable vectorDrawable = ResourcesCompat.getDrawable(context.getResources(), id, null); Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(), vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);/*from w w w .j a va 2 s . c o m*/ Canvas canvas = new Canvas(bitmap); vectorDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); vectorDrawable.draw(canvas); return BitmapDescriptorFactory.fromBitmap(bitmap); }
From source file:com.doctoror.fuckoffmusicplayer.presentation.util.DrawableUtils.java
@Nullable public static Drawable getTintedDrawable(@NonNull final Context context, @DrawableRes final int res, @Nullable final ColorStateList tint) { final Drawable d = ResourcesCompat.getDrawable(context.getResources(), res, context.getTheme()); return getTintedDrawable(d, tint); }
From source file:com.example.android.leanback.ErrorFragment.java
@Override public void onCreate(Bundle savedInstanceState) { Log.i(TAG, "onCreate"); super.onCreate(savedInstanceState); setTitle("Leanback Sample App"); final Context context = getActivity(); setImageDrawable(ResourcesCompat.getDrawable(context.getResources(), R.drawable.lb_ic_sad_cloud, context.getTheme()));/*from w w w .jav a2 s.c o m*/ setMessage("An error occurred."); setDefaultBackground(TRANSLUCENT); setButtonText("Dismiss"); setButtonClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Log.i(TAG, "button clicked"); getFragmentManager().beginTransaction().remove(ErrorFragment.this).commit(); } }); }
From source file:com.example.android.leanback.StringPresenter.java
@Override public ViewHolder onCreateViewHolder(ViewGroup parent) { Log.d(TAG, "onCreateViewHolder"); final Context context = parent.getContext(); TextView tv = new TextView(context); tv.setFocusable(true);/*from w w w.ja v a 2 s.c o m*/ tv.setFocusableInTouchMode(true); tv.setBackground( ResourcesCompat.getDrawable(context.getResources(), R.drawable.text_bg, context.getTheme())); return new ViewHolder(tv); }
From source file:com.doctoror.fuckoffmusicplayer.presentation.util.DrawableUtils.java
@Nullable public static Drawable getTintedDrawable(@NonNull final Context context, @DrawableRes final int res, @ColorInt final int tint) { final Drawable d = ResourcesCompat.getDrawable(context.getResources(), res, context.getTheme()); return getTintedDrawable(d, tint); }
From source file:com.example.android.leanback.ErrorSupportFragment.java
@Override public void onCreate(Bundle savedInstanceState) { Log.i(TAG, "onCreate"); super.onCreate(savedInstanceState); setTitle("Leanback Sample App"); final Context context = getActivity(); setImageDrawable(ResourcesCompat.getDrawable(context.getResources(), R.drawable.lb_ic_sad_cloud, context.getTheme()));//w w w .j ava2 s.c om setMessage("An error occurred."); setDefaultBackground(TRANSLUCENT); setButtonText("Dismiss"); setButtonClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Log.i(TAG, "button clicked"); getFragmentManager().beginTransaction().remove(ErrorSupportFragment.this).commit(); } }); }
From source file:org.rudirect.android.activity.AttributionsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_attributions); // Setup the toolbar Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/* ww w . j a v a2s. co m*/ ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeAsUpIndicator( ResourcesCompat.getDrawable(getResources(), R.drawable.ic_action_toolbar_back, getTheme())); } // Build attributions text and set it to the textview text TextView attrTextView = (TextView) findViewById(R.id.attributions_textview); if (attrTextView != null) attrTextView.setText(getAttributionsMessage()); // Log the screen RUDirectApplication.getTracker().setScreenName(getString(R.string.attributions_screen)); RUDirectApplication.getTracker().send(new HitBuilders.ScreenViewBuilder().build()); }
From source file:com.sinenco.sharednews.listviewremovalanimation.BackgroundContainer.java
private void init() { mShadowedBackground = ResourcesCompat.getDrawable(getResources(), R.drawable.shadowed_background, null); }
From source file:com.jm.apps.postream.utilities.DividerItemDecoration.java
public DividerItemDecoration(Context context, int orientation) { final TypedArray a = context.obtainStyledAttributes(ATTRS); mDivider = ResourcesCompat.getDrawable(context.getResources(), R.drawable.line_divider, null); a.recycle();//w w w .j av a2s .c o m setOrientation(orientation); }