类android.support.v4.widget.ImageViewCompat源码实例Demo

下面列出了怎么用android.support.v4.widget.ImageViewCompat的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: cronet   文件: ApiCompatibilityUtils.java
public static void setImageTintList(
        @NonNull ImageView view, @Nullable ColorStateList tintList) {
    if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) {
        // Work around broken workaround in ImageViewCompat, see https://crbug.com/891609#c3.
        if (tintList != null && view.getImageTintMode() == null) {
            view.setImageTintMode(PorterDuff.Mode.SRC_IN);
        }
    }
    ImageViewCompat.setImageTintList(view, tintList);
}
 
源代码2 项目: appinventor-extensions   文件: ImageViewUtil.java
public static void setMenuButtonColor(Activity activity, int color) {
  ColorStateList stateList = new ColorStateList(new int[][]{new int[]{}}, new int[]{color});
  ImageView view = findOverflowMenuView(activity);
  if (view != null) {
    ImageViewCompat.setImageTintMode(view, MULTIPLY);
    ImageViewCompat.setImageTintList(view, stateList);
  }
}
 
源代码3 项目: SuntimesWidget   文件: EquinoxView.java
public void themeViews( EquinoxViewOptions options, int position )
{
    title.setTextColor(SuntimesUtils.colorStateList((position  < EquinoxViewAdapter.CENTER_POSITION ? options.disabledColor : options.titleColor), options.disabledColor, options.pressedColor));

    ImageViewCompat.setImageTintList(btn_flipperNext, SuntimesUtils.colorStateList(options.titleColor, options.disabledColor, options.pressedColor));
    ImageViewCompat.setImageTintList(btn_flipperPrev, SuntimesUtils.colorStateList(options.titleColor, options.disabledColor, options.pressedColor));

    note_equinox_vernal.themeViews(options.labelColor, options.seasonColors[0], options.textColor);
    note_solstice_summer.themeViews(options.labelColor, options.seasonColors[1], options.textColor);
    note_equinox_autumnal.themeViews(options.labelColor, options.seasonColors[2], options.textColor);
    note_solstice_winter.themeViews(options.labelColor, options.seasonColors[3], options.textColor);
}
 
源代码4 项目: SuntimesWidget   文件: MoonApsisView.java
private void themeDrawables()
{
    ImageViewCompat.setImageTintList(forwardButton, SuntimesUtils.colorStateList(colorAccent, colorDisabled, colorPressed));
    SuntimesUtils.colorizeImageView(forwardButton, colorBackground);

    ImageViewCompat.setImageTintList(backButton, SuntimesUtils.colorStateList(colorAccent, colorDisabled, colorPressed));
    SuntimesUtils.colorizeImageView(backButton, colorBackground);
}
 
源代码5 项目: SuntimesWidget   文件: WorldMapDialog.java
@SuppressWarnings("ResourceType")
public void themeViews(Context context)
{
    if (themeOverride != null)
    {
        color_pressed = color_warning = themeOverride.getActionColor();
        color_normal = themeOverride.getTitleColor();
        color_accent = themeOverride.getAccentColor();

        dialogTitle.setTextColor(themeOverride.getTitleColor());
        utcTime.setTextColor(themeOverride.getTimeColor());
        worldmap.themeViews(context, themeOverride);
    }

    if (seekbar != null) {
        seekbar.setTrackColor(color_accent);
        seekbar.setTickColor(color_accent, color_accent, color_accent);
        seekbar.getThumb().setColorFilter(color_accent, PorterDuff.Mode.SRC_IN);
    }

    ImageViewCompat.setImageTintList(playButton, SuntimesUtils.colorStateList(color_normal, color_disabled, color_pressed));
    ImageViewCompat.setImageTintList(resetButton, SuntimesUtils.colorStateList(color_warning, color_disabled, color_pressed));
    ImageViewCompat.setImageTintList(recordButton, SuntimesUtils.colorStateList(color_warning, color_disabled, color_pressed));
    ImageViewCompat.setImageTintList(pauseButton, SuntimesUtils.colorStateList(color_accent, color_disabled, color_pressed));
    ImageViewCompat.setImageTintList(nextButton, SuntimesUtils.colorStateList(color_normal, color_disabled, color_pressed));
    ImageViewCompat.setImageTintList(prevButton, SuntimesUtils.colorStateList(color_normal, color_disabled, color_pressed));
    ImageViewCompat.setImageTintList(menuButton, SuntimesUtils.colorStateList(color_normal, color_disabled, color_pressed));

    if (speedButton != null) {
        speedButton.setTextColor(SuntimesUtils.colorStateList(color_normal, color_disabled, color_pressed));
    }
}
 
源代码6 项目: SuntimesWidget   文件: MoonPhasesView1.java
private void themeDrawables()
{
    ImageViewCompat.setImageTintList(forwardButton, SuntimesUtils.colorStateList(colorAccent, colorDisabled, colorPressed));
    SuntimesUtils.colorizeImageView(forwardButton, colorBackground);

    ImageViewCompat.setImageTintList(backButton, SuntimesUtils.colorStateList(colorAccent, colorDisabled, colorPressed));
    SuntimesUtils.colorizeImageView(backButton, colorBackground);
}
 
源代码7 项目: SuntimesWidget   文件: CardViewHolder.java
protected void themeCardViews(Context context, CardAdapter.CardAdapterOptions options)
{
    if (options.themeOverride != null) {
        themeCardViews(context, options.themeOverride, options);
    }
    ImageViewCompat.setImageTintList(btn_flipperNext, SuntimesUtils.colorStateList(options.color_accent, options.color_disabled, options.color_pressed));
    ImageViewCompat.setImageTintList(btn_flipperPrev, SuntimesUtils.colorStateList(options.color_accent, options.color_disabled, options.color_pressed));
}
 
源代码8 项目: aircon   文件: TintColorSetter.java
@Override
protected void setAttr(final ImageView view, final int color) {
	ImageViewCompat.setImageTintList(view, ColorStateList.valueOf(color));
}
 
源代码9 项目: relight   文件: BaseImageWidget.java
public T imageTintList(ColorStateList tint) {
    ImageViewCompat.setImageTintList(view, tint);
    return self();
}
 
源代码10 项目: com.ruuvi.station   文件: RuuviTagAdapter.java
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
    final RuuviTag tag = getItem(position);


    if (convertView == null) {
        convertView = LayoutInflater.from(getContext()).inflate(R.layout.row_item_main, parent, false);
    }

    TextView txtId = convertView.findViewById(R.id.id);
    TextView lastseen = convertView.findViewById(R.id.lastseen);
    TextView temp = convertView.findViewById(R.id.row_main_temperature);
    TextView humid = convertView.findViewById(R.id.row_main_humidity);
    TextView pres = convertView.findViewById(R.id.row_main_pressure);
    TextView signal = convertView.findViewById(R.id.row_main_signal);

    txtId.setText(tag.getDispayName());

    int ballColorRes = (position % 2 == 0) ? R.color.main : R.color.mainLight;

    ((ImageView)convertView.findViewById(R.id.row_main_letter))
            .setImageBitmap(Utils.createBall((int)getContext().getResources().getDimension(R.dimen.letter_ball_radius),
                    getContext().getResources().getColor(ballColorRes),
                    Color.WHITE,
                    txtId.getText().charAt(0) + ""));

    convertView.findViewById(R.id.row_main_root).setTag(tag);
    //convertView.findViewById(R.id.row_main_letter).setOnClickListener(tagMenuClickListener);

    String updatedAt = getContext().getResources().getString(R.string.updated) + " " + Utils.strDescribingTimeSince(tag.updateAt);

    lastseen.setText(updatedAt);
    AppCompatImageView bell = convertView.findViewById(R.id.bell);
    int status = AlarmChecker.getStatus(tag);
    switch (status) {
        case -1:
            bell.setVisibility(View.VISIBLE);
            bell.setImageResource(R.drawable.ic_notifications_off_24px);
            break;
        case 0:
            bell.setVisibility(View.VISIBLE);
            bell.setImageResource(R.drawable.ic_notifications_on_24px);
            break;
        case 1:
            bell.setImageResource(R.drawable.ic_notifications_active_24px);
            bell.setVisibility(bell.getVisibility() == View.VISIBLE ? View.INVISIBLE : View.VISIBLE);
            break;
    }
    ImageViewCompat.setImageTintList(bell, ColorStateList.valueOf(getContext().getResources().getColor(R.color.main)));

    temp.setText(tag.getTemperatureString(getContext()));
    humid.setText(String.format(getContext().getString(R.string.humidity_reading), tag.humidity));
    pres.setText(String.format(getContext().getString(R.string.pressure_reading), tag.pressure));
    signal.setText(String.format(getContext().getString(R.string.signal_reading), tag.rssi));

    return convertView;
}