private void tintButtons(ColorStateList color) { ViewCompat.setBackgroundTintList(nextButton, color); ViewCompat.setBackgroundTintList(backButton, color); ViewCompat.setBackgroundTintList(skipButton, color); } }
@Override public void onAnimationUpdate(ValueAnimator animation) { ViewCompat.setBackgroundTintList(view, new ColorStateList(EMPTY, new int[]{(int) animation.getAnimatedValue()})); } });
@Override public void onAnimationEnd(Animator animation) { ViewCompat.setBackgroundTintList(view, new ColorStateList(EMPTY, new int[]{colorEnd})); }
ViewCompat.setBackgroundTintList(editText, tintColorStateList);
/** * display Material Design OverlayView */ public void setOverlayStyle_MaterialDesign(int color) { if (mMDOverlay == null) { initMDOverlay(color); } else { ViewCompat.setBackgroundTintList(mMDOverlay, ColorStateList.valueOf(color)); } mCenterOverlay = null; }
int backgroundDarker = Color.HSVToColor(backgroundDarkHsv); miPagerIndicator.setPageIndicatorColor(backgroundDarker); ViewCompat.setBackgroundTintList(miButtonNext, ColorStateList.valueOf(backgroundDarker)); ViewCompat.setBackgroundTintList(miButtonBack, ColorStateList.valueOf(backgroundDarker)); ViewCompat.setBackgroundTintList(miButtonCta.getChildAt(0), ColorStateList.valueOf(backgroundButtonCta)); ViewCompat.setBackgroundTintList(miButtonCta.getChildAt(1), ColorStateList.valueOf(backgroundButtonCta));
@Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle state) { View view = inflater.inflate(R.layout.filestack__fragment_local_files, container, false); Button openGalleryButton = view.findViewById(R.id.select_gallery); openGalleryButton.setOnClickListener(this); Theme theme = getArguments().getParcelable(ARG_THEME); ViewCompat.setBackgroundTintList(openGalleryButton, ColorStateList.valueOf(theme.getAccentColor())); openGalleryButton.setTextColor(theme.getBackgroundColor()); ImageViewCompat.setImageTintList((ImageView) view.findViewById(R.id.icon), ColorStateList.valueOf(theme.getTextColor())); return view; }
public static void setTint(@NonNull EditText editText, @ColorInt int color, boolean useDarker) { final ColorStateList editTextColorStateList = new ColorStateList(new int[][]{ new int[]{-android.R.attr.state_enabled}, new int[]{android.R.attr.state_enabled, -android.R.attr.state_pressed, -android.R.attr.state_focused}, new int[]{} }, new int[]{ ContextCompat.getColor(editText.getContext(), useDarker ? R.color.ate_text_disabled_dark : R.color.ate_text_disabled_light), ContextCompat.getColor(editText.getContext(), useDarker ? R.color.ate_control_normal_dark : R.color.ate_control_normal_light), color }); if (editText instanceof TintableBackgroundView) { ViewCompat.setBackgroundTintList(editText, editTextColorStateList); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { editText.setBackgroundTintList(editTextColorStateList); } setCursorTint(editText, color); }
@Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.filestack__fragment_camera, container, false); Button photoButton = root.findViewById(R.id.take_photo); Button videoButton = root.findViewById(R.id.take_video); Intent intent = requireActivity().getIntent(); String[] mimeTypes = intent.getStringArrayExtra(FsConstants.EXTRA_MIME_TYPES); // Disable buttons if associated MIME type isn't allowed if (mimeTypes != null) { if (!Util.mimeAllowed(mimeTypes, "image/jpeg")) { photoButton.setVisibility(View.GONE); } if (!Util.mimeAllowed(mimeTypes, "video/mp4")) { videoButton.setVisibility(View.GONE); } } theme = getArguments().getParcelable(ARG_THEME); photoButton.setTextColor(theme.getBackgroundColor()); ViewCompat.setBackgroundTintList(photoButton, ColorStateList.valueOf(theme.getAccentColor())); ViewCompat.setBackgroundTintList(videoButton, ColorStateList.valueOf(theme.getAccentColor())); videoButton.setTextColor(theme.getBackgroundColor()); photoButton.setOnClickListener(this); videoButton.setOnClickListener(this); ImageViewCompat.setImageTintList((ImageView) root.findViewById(R.id.icon), ColorStateList.valueOf(theme.getTextColor())); return root; }
ViewCompat.setBackgroundTintList(buttonGrantPermissions, ColorStateList.valueOf( ContextCompat.getColor(getContext(), backgroundDarkRes)));
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View baseView = inflater.inflate(R.layout.filestack__fragment_auth, container, false); ImageView iconView = baseView.findViewById(R.id.icon); iconView.setImageResource(sourceInfo.getIconId()); Theme theme = getArguments().getParcelable(ARG_THEME); String target = "Cloud"; String replacement = getString(sourceInfo.getTextId()); for (int id : TEXT_VIEW_IDS) { TextView textView = baseView.findViewById(id); textView.setTextColor(theme.getTextColor()); Util.textViewReplace(textView, target, replacement); } Button button = baseView.findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openAuthPage(authUrl); } }); ViewCompat.setBackgroundTintList(button, ColorStateList.valueOf(theme.getAccentColor())); button.setTextColor(theme.getBackgroundColor()); ImageViewCompat.setImageTintList(iconView, ColorStateList.valueOf(theme.getTextColor())); return baseView; }
ViewCompat.setBackgroundTintList(barAway, itemView.getContext().getResources() .getColorStateList(resKeyAway)); ViewCompat.setBackgroundTintList(barHome, itemView.getContext().getResources() .getColorStateList(resKeyHome));
ViewCompat.setBackgroundTintList(messageHeaderHolder.arrowHead, ColorStateList.valueOf(messageHeaderParent.getColor())); messageHeaderHolder.streamTextView.setBackgroundColor(messageHeaderParent.getColor()); messageHeaderHolder.streamTextView.setTextColor(Color.WHITE); messageHeaderHolder.topicTextView.setText(messageHeaderParent.getDisplayRecipent()); ViewCompat.setBackgroundTintList(messageHeaderHolder.arrowHead, ColorStateList.valueOf(mDefaultStreamHeaderColor)); messageHeaderHolder.streamTextView.setBackgroundColor(mDefaultStreamHeaderColor);
int backgroundDarker = Color.HSVToColor(backgroundDarkHsv); pagerIndicator.setPageIndicatorColor(backgroundDarker); ViewCompat.setBackgroundTintList(buttonNext, ColorStateList.valueOf(backgroundDarker)); ViewCompat.setBackgroundTintList(buttonSkip, ColorStateList.valueOf(backgroundDarker));