Example usage for android.graphics LightingColorFilter LightingColorFilter

List of usage examples for android.graphics LightingColorFilter LightingColorFilter

Introduction

In this page you can find the example usage for android.graphics LightingColorFilter LightingColorFilter.

Prototype

public LightingColorFilter(@ColorInt int mul, @ColorInt int add) 

Source Link

Document

Create a colorfilter that multiplies the RGB channels by one color, and then adds a second color.

Usage

From source file:io.bunnyblue.noticedog.app.overlay.ui.OverlayNotificationBarView.java

private void setButton(Button button, Message message, int index) {
    List<Action> actions = message.getActions();
    if (index >= actions.size()) {
        button.setVisibility(View.GONE);
        return;/*ww  w . ja va  2  s .  c  o  m*/
    }
    Action action = (Action) actions.get(index);
    button.setOnClickListener(null);
    button.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
    button.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, 0, 0);
    button.setVisibility(View.VISIBLE);
    Drawable icon = getActionIcon(message.getAppId(), action.icon);
    icon.setColorFilter(new LightingColorFilter(ViewCompat.MEASURED_STATE_MASK, 6914181));
    button.setCompoundDrawablesRelativeWithIntrinsicBounds(icon, null, null, null);
    button.setText(action.title);
}

From source file:com.waz.zclient.ui.audiomessage.AudioMessageRecordingView.java

public void setAccentColor(int color) {
    Drawable drawable = recordingSeekBar.getProgressDrawable();
    if (drawable == null) {
        return;//from w  w w. ja  v a  2  s .  c  om
    }
    if (drawable instanceof LayerDrawable) {
        LayerDrawable layerDrawable = (LayerDrawable) drawable;
        Drawable progress = layerDrawable.findDrawableByLayerId(android.R.id.progress);
        if (progress != null) {
            drawable = progress;
        }
    }
    drawable.setColorFilter(new LightingColorFilter(0xFF000000, color));
    drawable = recordingSeekBar.getThumb();
    drawable.setColorFilter(new LightingColorFilter(0xFF000000, color));
}

From source file:org.mozilla.gecko.AwesomeBarTabs.java

private TabSpec addAwesomeTab(String id, int titleId, int contentId) {
    TabSpec tab = newTabSpec(id);// ww  w.  j  a  v a2 s  .  c o  m

    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    View indicatorView = inflater.inflate(R.layout.awesomebar_tab_indicator, null);
    Drawable background = indicatorView.getBackground();
    try {
        background.setColorFilter(
                new LightingColorFilter(Color.WHITE, GeckoApp.mBrowserToolbar.getHighlightColor()));
    } catch (Exception e) {
        Log.d(LOGTAG, "background.setColorFilter failed " + e);
    }
    TextView title = (TextView) indicatorView.findViewById(R.id.title);
    title.setText(titleId);

    tab.setIndicator(indicatorView);
    tab.setContent(contentId);

    addTab(tab);

    return tab;
}

From source file:com.forrestguice.suntimeswidget.SuntimesUtils.java

/**
 * Creates a tinted copy of the supplied bitmap.
 * @param b a bitmap image//  w  ww.  ja  va  2s.  c o m
 * @param color a color
 * @return a bitmap tinted to color
 */
public static Bitmap tintBitmap(Bitmap b, int color) {
    Bitmap tinted = Bitmap.createBitmap(b.getWidth(), b.getHeight(), b.getConfig());
    Canvas c = new Canvas(tinted);
    Paint p = new Paint();
    p.setColorFilter(new LightingColorFilter(color, 0));
    c.drawBitmap(b, 0, 0, p);
    return tinted;
}

From source file:com.androzic.MapActivity.java

protected final void updateZoomInfo() {
    double zoom = application.getZoom() * 100;

    if (zoom == 0.0) {
        mapZoom.setText("---%");
    } else {/*www.j  a va 2s .c o m*/
        int rz = (int) Math.floor(zoom);
        String zoomStr = zoom - rz != 0.0 ? String.format("%.1f", zoom) : String.valueOf(rz);
        mapZoom.setText(zoomStr + "%");
    }

    ImageButton zoomin = (ImageButton) findViewById(R.id.zoomin);
    ImageButton zoomout = (ImageButton) findViewById(R.id.zoomout);
    zoomin.setEnabled(application.getNextZoom() != 0.0);
    zoomout.setEnabled(application.getPrevZoom() != 0.0);

    LightingColorFilter disable = new LightingColorFilter(0xFFFFFFFF, 0xFF444444);

    zoomin.setColorFilter(zoomin.isEnabled() ? null : disable);
    zoomout.setColorFilter(zoomout.isEnabled() ? null : disable);
}