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:com.google.blockly.android.ui.vertical.FieldColorView.java
private void maybeAcquireParentBlockView() { BlockView blockView = (mHelper != null && ViewCompat.isAttachedToWindow(this)) ? (BlockView) mHelper.getClosestAncestorBlockView(this) : null;//w ww .ja v a 2 s . c o m if (blockView != null) { int foregroundId = blockView.getBlock().isShadow() ? R.drawable.inset_field_border_shadow : R.drawable.inset_field_border; Drawable foreground = ResourcesCompat.getDrawable(getResources(), foregroundId, null); foreground.setColorFilter(blockView.getColorFilter()); setForeground(foreground); } }
From source file:ir.besteveryeverapp.ui.Components.ResourceLoader.java
public static void loadRecources(Context context) { if (backgroundDrawableIn == null) { backgroundDrawableIn = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_in, null); backgroundDrawableInSelected = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_in_selected, null); backgroundDrawableOut = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_out, null); backgroundDrawableOutSelected = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_out_selected, null); backgroundMediaDrawableIn = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_in_photo, null); backgroundMediaDrawableInSelected = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_in_photo_selected, null); backgroundMediaDrawableOut = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_out_photo, null); backgroundMediaDrawableOutSelected = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_out_photo_selected, null); checkDrawable = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_check, null); halfCheckDrawable = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_halfcheck, null); clockDrawable = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_clock, null); checkMediaDrawable = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_check_w, null); halfCheckMediaDrawable = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_halfcheck_w, null); clockMediaDrawable = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_clock_photo, null); clockChannelDrawable[0] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_clock2, null); clockChannelDrawable[1] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_clock2_s, null); errorDrawable = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_warning, null); mediaBackgroundDrawable = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.phototime, null); broadcastDrawable = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.broadcast3, null); broadcastMediaDrawable = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.broadcast4, null); backgroundBlack = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.system_black, null); backgroundBlue = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.system_blue, null); viewsCountDrawable = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.post_views, null); viewsOutCountDrawable = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.post_viewsg, null); viewsMediaCountDrawable[0] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.post_views_w, null); viewsMediaCountDrawable[1] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.post_views_s, null); audioStatesDrawable[0][2] = audioStatesDrawable[0][0] = ResourcesCompat .getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.play_w2, null); audioStatesDrawable[0][1] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.play_w2_pressed, null); audioStatesDrawable[1][2] = audioStatesDrawable[1][0] = ResourcesCompat .getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.pause_w2, null); audioStatesDrawable[1][1] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.pause_w2_pressed, null); audioStatesDrawable[2][0] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.download_g, null); audioStatesDrawable[2][1] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.download_g_pressed, null); audioStatesDrawable[2][2] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.download_g_s, null); audioStatesDrawable[3][0] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.pause_g, null); audioStatesDrawable[3][1] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.pause_g_pressed, null); audioStatesDrawable[3][2] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.pause_g_s, null); audioStatesDrawable[4][0] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.cancel_g, null); audioStatesDrawable[4][1] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.cancel_g_pressed, null); audioStatesDrawable[4][2] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.cancel_g_s, null); audioStatesDrawable[5][2] = audioStatesDrawable[5][0] = ResourcesCompat .getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.play_w, null); audioStatesDrawable[5][1] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.play_w_pressed, null); audioStatesDrawable[6][2] = audioStatesDrawable[6][0] = ResourcesCompat .getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.pause_w, null); audioStatesDrawable[6][1] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.pause_w_pressed, null); audioStatesDrawable[7][0] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.download_b, null); audioStatesDrawable[7][1] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.download_b_pressed, null); audioStatesDrawable[7][2] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.download_b_s, null); audioStatesDrawable[8][0] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.pause_b, null); audioStatesDrawable[8][1] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.pause_b_pressed, null); audioStatesDrawable[8][2] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.pause_b_s, null); audioStatesDrawable[9][0] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.cancel_b, null); audioStatesDrawable[9][1] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.cancel_b_pressed, null); audioStatesDrawable[9][2] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.cancel_b_s, null); placeholderDocDrawable[0] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.doc_blue, null); placeholderDocDrawable[1] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.doc_green, null); placeholderDocDrawable[2] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.doc_blue_s, null); buttonStatesDrawables[0] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.photoload, null); buttonStatesDrawables[1] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.photocancel, null); buttonStatesDrawables[2] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.photogif, null); buttonStatesDrawables[3] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.playvideo, null); buttonStatesDrawables[4] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.photopause, null); buttonStatesDrawables[5] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.burn, null); buttonStatesDrawables[6] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.circle, null); buttonStatesDrawables[7] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.photocheck, null); buttonStatesDrawablesDoc[0][0] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.docload_b, null); buttonStatesDrawablesDoc[0][1] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.docload_g, null); buttonStatesDrawablesDoc[0][2] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.docload_b_s, null); buttonStatesDrawablesDoc[1][0] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.doccancel_b, null); buttonStatesDrawablesDoc[1][1] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.doccancel_g, null); buttonStatesDrawablesDoc[1][2] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.doccancel_b_s, null); buttonStatesDrawablesDoc[2][0] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.docpause_b, null); buttonStatesDrawablesDoc[2][1] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.docpause_g, null); buttonStatesDrawablesDoc[2][2] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.docpause_b_s, null); videoIconDrawable = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.ic_video, null); docMenuDrawable[0] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.doc_actions_b, null); docMenuDrawable[1] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.doc_actions_g, null); docMenuDrawable[2] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.doc_actions_b_s, null); shareDrawable[0][0] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.shareblue, null); shareDrawable[0][1] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.shareblue_pressed, null); shareDrawable[1][0] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.shareblack, null); shareDrawable[1][1] = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.shareblack_pressed, null); geoInDrawable = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.location_b, null); geoOutDrawable = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.location_g, null); context.getResources().getDrawable(ir.besteveryeverapp.telegram.R.drawable.attach_camera_states); context.getResources().getDrawable(ir.besteveryeverapp.telegram.R.drawable.attach_gallery_states); context.getResources().getDrawable(ir.besteveryeverapp.telegram.R.drawable.attach_video_states); context.getResources().getDrawable(ir.besteveryeverapp.telegram.R.drawable.attach_audio_states); context.getResources().getDrawable(ir.besteveryeverapp.telegram.R.drawable.attach_file_states); context.getResources().getDrawable(ir.besteveryeverapp.telegram.R.drawable.attach_contact_states); context.getResources().getDrawable(ir.besteveryeverapp.telegram.R.drawable.attach_location_states); context.getResources().getDrawable(ir.besteveryeverapp.telegram.R.drawable.attach_hide_states); backgroundDrawableInF = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_in_f, null); backgroundDrawableInSelectedF = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_in_selected_f, null); backgroundDrawableOutF = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_out_f, null); backgroundDrawableOutSelectedF = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_out_selected_f, null); backgroundMediaDrawableInF = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_in_photo_f, null); backgroundMediaDrawableInSelectedF = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_in_photo_selected_f, null); backgroundMediaDrawableOutF = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_out_photo_f, null); backgroundMediaDrawableOutSelectedF = ResourcesCompat.getDrawable(context.getResources(), ir.besteveryeverapp.telegram.R.drawable.msg_out_photo_selected_f, null); checkDrawableF = checkDrawable;//context.getResources().getDrawable(R.drawable.msg_check); halfCheckDrawableF = halfCheckDrawable;//context.getResources().getDrawable(R.drawable.msg_halfcheck); broadcastDrawableF = broadcastDrawable;//context.getResources().getDrawable(R.drawable.broadcast3); viewsCountDrawableF = viewsCountDrawable;//context.getResources().getDrawable(R.drawable.post_views); viewsOutCountDrawableF = viewsOutCountDrawable;//context.getResources().getDrawable(R.drawable.post_viewsg); clockDrawableF = clockDrawable;//context.getResources().getDrawable(R.drawable.msg_clock); docMenuDrawableF[0] = docMenuDrawable[0]; docMenuDrawableF[1] = docMenuDrawable[1]; docMenuDrawableF[2] = docMenuDrawable[2]; //:ramin/*from w w w.j a v a 2s. c o m*/ ColorUtils.init(context); } if (ChitSettings.showFantasy) { checkDrawableF.setColorFilter(0xff68a7ad, PorterDuff.Mode.SRC_ATOP); halfCheckDrawableF.setColorFilter(0xff68a7ad, PorterDuff.Mode.SRC_ATOP); clockDrawableF.setColorFilter(0xff68a7ad, PorterDuff.Mode.SRC_ATOP); viewsOutCountDrawableF.setColorFilter(0xff68a7ad, PorterDuff.Mode.SRC_ATOP); viewsCountDrawableF.setColorFilter(0xffb5a564, PorterDuff.Mode.SRC_ATOP); broadcastDrawableF.setColorFilter(0xff68a7ad, PorterDuff.Mode.SRC_ATOP); docMenuDrawableF[0].setColorFilter(ChatBaseColors.timeInF, PorterDuff.Mode.SRC_ATOP); docMenuDrawableF[1].setColorFilter(ChatBaseColors.timeOutF, PorterDuff.Mode.SRC_ATOP); docMenuDrawableF[2].setColorFilter(ChatBaseColors.timeInSelectedF, PorterDuff.Mode.SRC_ATOP); } }
From source file:nya.miku.wishmaster.chans.wizchan.WizchanModule.java
@Override public Drawable getChanFavicon() { return ResourcesCompat.getDrawable(resources, R.drawable.favicon_wizchan, null); }
From source file:com.nttec.everychan.chans.WakabaFactory.java
private static ChanModule createChanModule(SharedPreferences preferences, Resources resources, String url, final DateFormat df) { Uri uri = Uri.parse(url);// w w w. j a v a2s. c o m final String name = uri.getHost(); final boolean https = uri.getScheme() != null && uri.getScheme().equalsIgnoreCase("https"); return new AbstractWakabaModule(preferences, resources) { private final List<DateFormat> dateFormats; { dateFormats = Arrays .asList(new DateFormat[] { df, new SimpleDateFormat("yy/MM/dd(EEE)HH:mm", Locale.US), new SimpleDateFormat("EEE dd MMM yyyy HH:mm:ss", Locale.US), new SimpleDateFormat("dd.MM.yyyy HH:mm:ss", Locale.US) { private static final long serialVersionUID = 1L; public Date parse(String string) throws ParseException { return super.parse(string.replaceAll(" ?\\(.*?\\)", "")); } }, new SimpleDateFormat("EEE yy/MM/dd HH:mm", Locale.US), new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US) }); } @Override public String getDisplayingName() { return name; } @Override public String getChanName() { return name; } @Override public Drawable getChanFavicon() { return ResourcesCompat.getDrawable(resources, R.drawable.favicon_cirno, null); } @Override protected String getUsingDomain() { return name; } @Override protected SimpleBoardModel[] getBoardsList() { return new SimpleBoardModel[0]; } @Override protected boolean canHttps() { return true; } protected boolean useHttpsDefaultValue() { return https; }; @Override protected boolean canCloudflare() { return true; } @SuppressWarnings("serial") @SuppressLint("SimpleDateFormat") @Override protected WakabaReader getWakabaReader(InputStream stream, UrlPageModel urlModel) { return new WakabaReader(stream, new SimpleDateFormat() { // universal date format @Override public Date parse(String string) throws ParseException { for (DateFormat df : dateFormats) { try { return df.parse(string); } catch (Exception e) { } } Logger.d(TAG, "couldn't parse: '" + string + "'"); return new Date(0); } }); } }; }
From source file:com.nttec.everychan.chans.chan76.Chan76Module.java
@Override public Drawable getChanFavicon() { return ResourcesCompat.getDrawable(resources, R.drawable.favicon_76chan, null); }
From source file:com.giaquino.pastel.layouts.TintTypedArray.java
public Drawable getDrawableIfKnown(int index) { if (mWrapped.hasValue(index)) { final int resourceId = mWrapped.getResourceId(index, 0); if (resourceId != 0) { return ResourcesCompat.getDrawable(mContext.getResources(), resourceId, null); }/* w ww . j a va 2 s. co m*/ } return null; }
From source file:com.nttec.everychan.chans.haruhichan.HaruhiModule.java
@Override public Drawable getChanFavicon() { return ResourcesCompat.getDrawable(resources, R.drawable.favicon_haruhichan, null); }
From source file:org.getlantern.firetweet.util.ImageLoadingHandler.java
@Override public void onLoadingComplete(final String imageUri, final View view, final Bitmap bitmap) { if (view == null) return;/*from w w w . j a v a 2 s . c o m*/ mLoadingUris.remove(view); final ViewGroup parent = (ViewGroup) view.getParent(); if (view instanceof ForegroundImageView) { final Drawable foreground; if (isVideoItem(parent)) { foreground = ResourcesCompat.getDrawable(view.getResources(), R.drawable.ic_card_media_play, null); } else { foreground = null; } ((ForegroundImageView) view).setForeground(foreground); } final ProgressBar progress = findProgressBar(parent); if (progress != null) { progress.setVisibility(View.GONE); } }
From source file:org.mariotaku.twidere.util.MediaLoadingHandler.java
public static void setVideoIndicator(View view, ViewGroup parent) { if (view instanceof ForegroundImageView) { final Drawable foreground; if (isVideoItem(parent)) { foreground = ResourcesCompat.getDrawable(view.getResources(), R.drawable.ic_card_media_play, null); } else {//from w w w. j a va2 s . c o m foreground = null; } ((ForegroundImageView) view).setForeground(foreground); } }
From source file:com.google.samples.apps.topeka.widget.AvatarView.java
private void setAvatarPreLollipop(@DrawableRes int resId) { Drawable drawable = ResourcesCompat.getDrawable(getResources(), resId, getContext().getTheme()); BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable; @SuppressWarnings("ConstantConditions") RoundedBitmapDrawable roundedDrawable = RoundedBitmapDrawableFactory.create(getResources(), bitmapDrawable.getBitmap()); roundedDrawable.setCircular(true);// w ww .ja va 2 s . co m setImageDrawable(roundedDrawable); }