Java Code Examples for android.widget.ImageButton#setColorFilter()

The following examples show how to use android.widget.ImageButton#setColorFilter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlaybackControlLayer.java    From google-media-framework-android with Apache License 2.0 6 votes vote down vote up
/**
 * Ensure that the chrome, control, and text colors displayed on the screen are correct.
 */
public void updateColors() {
  currentTime.setTextColor(textColor);
  endTime.setTextColor(textColor);
  videoTitleView.setTextColor(textColor);

  fullscreenButton.setColorFilter(controlColor);
  pausePlayButton.setColorFilter(controlColor);
  seekBar.getProgressDrawable().setColorFilter(seekbarColor, PorterDuff.Mode.SRC_ATOP);
  seekBar.getThumb().setColorFilter(seekbarColor, PorterDuff.Mode.SRC_ATOP);

  // Hide the thumb drawable if the SeekBar is disabled
  if (canSeek) {
    seekBar.getThumb().mutate().setAlpha(255);
  } else {
    seekBar.getThumb().mutate().setAlpha(0);
  }

  for (ImageButton imageButton : actionButtons) {
    imageButton.setColorFilter(controlColor);
  }

  topChrome.setBackgroundColor(chromeColor);
  bottomChrome.setBackgroundColor(chromeColor);
}
 
Example 2
Source File: ZipAdapter.java    From PowerFileExplorer with GNU General Public License v3.0 6 votes vote down vote up
public ViewHolder(final View convertView) {
	super(convertView);
	name = (TextView) convertView.findViewById(R.id.name);
	size = (TextView) convertView.findViewById(R.id.items);
	attr = (TextView) convertView.findViewById(R.id.attr);
	lastModified = (TextView) convertView.findViewById(R.id.lastModified);
	type = (TextView) convertView.findViewById(R.id.type);
	cbx = (ImageButton) convertView.findViewById(R.id.cbx);
	image = (ImageView)convertView.findViewById(R.id.icon);
	more = (ImageButton)convertView.findViewById(R.id.more);

	more.setColorFilter(Constants.TEXT_COLOR);

	name.setTextColor(Constants.DIR_COLOR);
	size.setTextColor(Constants.TEXT_COLOR);
	//attr.setTextColor(Constants.TEXT_COLOR);
	lastModified.setTextColor(Constants.TEXT_COLOR);
	if (type != null) {
		type.setTextColor(Constants.TEXT_COLOR);
	}
	image.setScaleType(ImageView.ScaleType.FIT_CENTER);
	convertView.setTag(this);
	this.convertedView = convertView;
}
 
Example 3
Source File: SuitableMapsList.java    From Androzic with GNU General Public License v3.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
	View view = inflater.inflate(R.layout.dlg_suitable_maps_list, container, false);
	listView = (ListView) view.findViewById(android.R.id.list);
	View infoButton = view.findViewById(R.id.information_button);
	infoButton.setOnClickListener(onMapInformation);
	ImageButton editButton = (ImageButton) view.findViewById(R.id.edit_button);
	editButton.setColorFilter(disable);
	editButton.setOnClickListener(onMapEdit);
	openButton = view.findViewById(R.id.open_button);
	openButton.setOnClickListener(onMapOpen);
	return view;
}
 
Example 4
Source File: EmojiView.java    From Emoji with Apache License 2.0 5 votes vote down vote up
private ImageButton inflateButton(final Context context, @DrawableRes final int icon, @StringRes final int categoryName, final ViewGroup parent) {
  final ImageButton button = (ImageButton) LayoutInflater.from(context).inflate(R.layout.emoji_view_category, parent, false);

  button.setImageDrawable(AppCompatResources.getDrawable(context, icon));
  button.setColorFilter(themeIconColor, PorterDuff.Mode.SRC_IN);
  button.setContentDescription(context.getString(categoryName));

  parent.addView(button);

  return button;
}
 
Example 5
Source File: DrawAR.java    From ar-drawing-java with Apache License 2.0 5 votes vote down vote up
/**
 * onClickSettings toggles showing and hiding the Line Width, Smoothing, and Debug View toggle
 */
public void onClickSettings(View button) {
    ImageButton settingsButton = findViewById(R.id.settingsButton);

    if (mSettingsUI.getVisibility() == View.GONE) {
        mSettingsUI.setVisibility(View.VISIBLE);
        mLineDistanceScaleBar = findViewById(R.id.distanceScale);
        mLineWidthBar = findViewById(R.id.lineWidth);

        settingsButton.setColorFilter(getResources().getColor(R.color.active));
    } else {
        mSettingsUI.setVisibility(View.GONE);
        settingsButton.setColorFilter(getResources().getColor(R.color.gray));
    }
}
 
Example 6
Source File: TabsPagerTitleStrip.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void addIconTabWithCounter(final int position, int resId)
{
    ImageButton tab = new ImageButton(getContext());
    tab.setImageResource(resId);
    tab.setColorFilter(position == pager.getCurrentItem() ? tabTextIconSelectedColor : tabTextIconUnselectedColor, PorterDuff.Mode.SRC_IN);
    tab.setScaleType(ImageView.ScaleType.CENTER);
    addTabWithCounter(position, tab);
}
 
Example 7
Source File: MonthFragmentAdapter.java    From Birdays with Apache License 2.0 5 votes vote down vote up
private void disableButton(ImageButton button) {
    if (nightMode()) {
        button.setColorFilter(Color.rgb(112, 112, 112));
    } else {
        button.setColorFilter(Color.rgb(224, 224, 224));
    }
    button.setClickable(false);
}
 
Example 8
Source File: AppsFragment.java    From PowerFileExplorer with GNU General Public License v3.0 5 votes vote down vote up
private ViewHolder(View convertView) {
	super(convertView);
	name = (TextView) convertView.findViewById(R.id.name);
	items = (TextView) convertView.findViewById(R.id.items);
	attr = (TextView) convertView.findViewById(R.id.attr);
	lastModified = (TextView) convertView.findViewById(R.id.lastModified);
	type = (TextView) convertView.findViewById(R.id.type);
	cbx = (ImageButton) convertView.findViewById(R.id.cbx);
	image = (ImageView) convertView.findViewById(R.id.icon);
	more = (ImageButton) convertView.findViewById(R.id.more);
	ll = convertView;

	ll.setTag(this);
	ll.setOnClickListener(AppsAdapter.this);
	cbx.setOnClickListener(AppsAdapter.this);

	ll.setOnLongClickListener(AppsAdapter.this);
	cbx.setOnLongClickListener(AppsAdapter.this);
	more.setOnClickListener(AppsAdapter.this);

	more.setColorFilter(Constants.TEXT_COLOR);
	name.setTextColor(Constants.DIR_COLOR);
	items.setTextColor(Constants.TEXT_COLOR);
	attr.setTextColor(Constants.TEXT_COLOR);
	lastModified.setTextColor(Constants.TEXT_COLOR);
	type.setTextColor(Constants.TEXT_COLOR);
}
 
Example 9
Source File: HiddenAdapter.java    From PowerFileExplorer with GNU General Public License v3.0 5 votes vote down vote up
ViewHolder(final View view) {
          super(view);

          txtTitle = (TextView) view.findViewById(R.id.text1);
          image = (ImageButton) view.findViewById(R.id.delete_button);
          txtDesc = (TextView) view.findViewById(R.id.text2);
          row = (LinearLayout) view.findViewById(R.id.bookmarkrow);
	image.setColorFilter(Constants.TEXT_COLOR);
	txtDesc.setTextColor(Constants.TEXT_COLOR);
}
 
Example 10
Source File: TabsPagerTitleStrip.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void addIconTabWithCounter(final int position, int resId)
{
    ImageButton tab = new ImageButton(getContext());
    tab.setImageResource(resId);
    tab.setColorFilter(position == pager.getCurrentItem() ? tabTextIconSelectedColor : tabTextIconUnselectedColor, PorterDuff.Mode.SRC_IN);
    tab.setScaleType(ImageView.ScaleType.CENTER);
    addTabWithCounter(position, tab);
}
 
Example 11
Source File: RichEditWidgetView.java    From android-notepad with MIT License 4 votes vote down vote up
private void setActionOff(ImageButton view){
	view.setBackgroundResource(0);
	view.setColorFilter(App.CONTEXT.getResources().getColor(R.color.md_blue_grey_300));
}
 
Example 12
Source File: DocumentActivity.java    From Mupdf with Apache License 2.0 4 votes vote down vote up
private void setButtonEnabled(ImageButton button, boolean enabled) {
    button.setEnabled(enabled);
    button.setColorFilter(enabled ? Color.argb(255, 255, 255, 255) : Color.argb(255, 128, 128, 128));
}
 
Example 13
Source File: DocumentActivity.java    From AndroidDocumentViewer with MIT License 4 votes vote down vote up
private void setButtonEnabled(ImageButton button, boolean enabled) {
    button.setEnabled(enabled);
    button.setColorFilter(enabled ? Color.argb(255, 255, 255, 255) : Color.argb(255, 128, 128, 128));
}
 
Example 14
Source File: PDFFragment.java    From PowerFileExplorer with GNU General Public License v3.0 4 votes vote down vote up
private void setButtonEnabled(ImageButton button, boolean enabled) {
	button.setEnabled(enabled);
	button.setColorFilter(enabled ? Color.argb(255, 255, 255, 255) : Color.argb(255, 128, 128, 128));
}
 
Example 15
Source File: DocumentActivity.java    From AndroidMuPDF with Apache License 2.0 4 votes vote down vote up
private void setButtonEnabled(ImageButton button, boolean enabled) {
	button.setEnabled(enabled);
	button.setColorFilter(enabled ? Color.argb(255, 255, 255, 255) : Color.argb(255, 128, 128, 128));
}
 
Example 16
Source File: MuPDFActivity.java    From mupdf-android with GNU Affero General Public License v3.0 4 votes vote down vote up
private void setButtonEnabled(ImageButton button, boolean enabled) {
	button.setEnabled(enabled);
	button.setColorFilter(enabled ? Color.argb(255, 255, 255, 255):Color.argb(255, 128, 128, 128));
}
 
Example 17
Source File: FilterState.java    From financisto with GNU General Public License v2.0 4 votes vote down vote up
static void updateFilterColor(Context context, WhereFilter filter, ImageButton button) {
    int color = filter.isEmpty() ? context.getResources().getColor(R.color.bottom_bar_tint) : context.getResources().getColor(R.color.holo_blue_dark);
    button.setColorFilter(color);
}
 
Example 18
Source File: MuPDFFragment.java    From mupdf-android with GNU Affero General Public License v3.0 4 votes vote down vote up
private void setButtonEnabled(ImageButton button, boolean enabled) {
	button.setEnabled(enabled);
	button.setColorFilter(enabled ? Color.argb(255, 255, 255, 255) : Color.argb(255, 128, 128, 128));
}
 
Example 19
Source File: RichEditWidgetView.java    From android-notepad with MIT License 4 votes vote down vote up
private void setActionOn(ImageButton view){
	view.setBackgroundResource(R.drawable.background_rich_edit_action_on);
	view.setColorFilter(App.CONTEXT.getResources().getColor(R.color.md_blue_grey_500));
}
 
Example 20
Source File: AppIntro.java    From GithubApp with Apache License 2.0 2 votes vote down vote up
/**
 * Override next button arrow color
 *
 * @param color your color
 */
public void setNextArrowColor(@ColorInt final int color) {
    ImageButton nextButton = (ImageButton) findViewById(R.id.next);
    nextButton.setColorFilter(color);
}