use of android.graphics.LightingColorFilter in project wire-android by wireapp.
the class AudioMessageRecordingView method setAccentColor.
public void setAccentColor(int color) {
Drawable drawable = recordingSeekBar.getProgressDrawable();
if (drawable == null) {
return;
}
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));
}
use of android.graphics.LightingColorFilter in project AntennaPod by AntennaPod.
the class ItemlistFragment method setupHeaderView.
private void setupHeaderView() {
if (getListView() == null || feed == null) {
Log.e(TAG, "Unable to setup listview: recyclerView = null or feed = null");
return;
}
ListView lv = getListView();
LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View header = inflater.inflate(R.layout.feeditemlist_header, lv, false);
lv.addHeaderView(header);
txtvTitle = (TextView) header.findViewById(R.id.txtvTitle);
TextView txtvAuthor = (TextView) header.findViewById(R.id.txtvAuthor);
ImageView imgvBackground = (ImageView) header.findViewById(R.id.imgvBackground);
ImageView imgvCover = (ImageView) header.findViewById(R.id.imgvCover);
ImageButton butShowInfo = (ImageButton) header.findViewById(R.id.butShowInfo);
txtvInformation = (TextView) header.findViewById(R.id.txtvInformation);
txtvFailure = (IconTextView) header.findViewById(R.id.txtvFailure);
txtvTitle.setText(feed.getTitle());
txtvAuthor.setText(feed.getAuthor());
// https://github.com/bumptech/glide/issues/529
imgvBackground.setColorFilter(new LightingColorFilter(0xff828282, 0x000000));
Glide.with(getActivity()).load(feed.getImageLocation()).placeholder(R.color.image_readability_tint).error(R.color.image_readability_tint).diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY).transform(new FastBlurTransformation(getActivity())).dontAnimate().into(imgvBackground);
Glide.with(getActivity()).load(feed.getImageLocation()).placeholder(R.color.light_gray).error(R.color.light_gray).diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY).fitCenter().dontAnimate().into(imgvCover);
butShowInfo.setOnClickListener(v -> {
if (viewsCreated && itemsLoaded) {
Intent startIntent = new Intent(getActivity(), FeedInfoActivity.class);
startIntent.putExtra(FeedInfoActivity.EXTRA_FEED_ID, feed.getId());
startActivity(startIntent);
}
});
headerCreated = true;
}
use of android.graphics.LightingColorFilter in project android_packages_apps_Dialer by LineageOS.
the class PseudoEmergencyAnimator method start.
public void start() {
if (mPseudoEmergencyColorAnimator == null) {
Integer colorFrom = Color.BLUE;
Integer colorTo = Color.RED;
mPseudoEmergencyColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
mPseudoEmergencyColorAnimator.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animator) {
try {
int color = (int) animator.getAnimatedValue();
ColorFilter colorFilter = new LightingColorFilter(Color.BLACK, color);
View floatingActionButtonContainer = getView().findViewById(R.id.floating_action_button);
if (floatingActionButtonContainer != null) {
floatingActionButtonContainer.getBackground().setColorFilter(colorFilter);
}
} catch (Exception e) {
animator.cancel();
}
}
});
mPseudoEmergencyColorAnimator.addListener(new AnimatorListener() {
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
try {
vibrate(VIBRATE_LENGTH_MILLIS);
} catch (Exception e) {
animation.cancel();
}
}
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
try {
View floatingActionButtonContainer = getView().findViewById(R.id.floating_action_button);
if (floatingActionButtonContainer != null) {
floatingActionButtonContainer.getBackground().clearColorFilter();
}
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
try {
vibrate(VIBRATE_LENGTH_MILLIS);
} catch (Exception e) {
// ignored
}
}
}, ITERATION_LENGTH_MILLIS);
} catch (Exception e) {
animation.cancel();
}
}
});
mPseudoEmergencyColorAnimator.setDuration(VIBRATE_LENGTH_MILLIS);
mPseudoEmergencyColorAnimator.setRepeatMode(ValueAnimator.REVERSE);
mPseudoEmergencyColorAnimator.setRepeatCount(ANIMATION_ITERATION_COUNT);
}
if (!mPseudoEmergencyColorAnimator.isStarted()) {
mPseudoEmergencyColorAnimator.start();
}
}
use of android.graphics.LightingColorFilter in project android_packages_apps_Dialer by MoKee.
the class PseudoEmergencyAnimator method start.
public void start() {
if (mPseudoEmergencyColorAnimator == null) {
Integer colorFrom = Color.BLUE;
Integer colorTo = Color.RED;
mPseudoEmergencyColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
mPseudoEmergencyColorAnimator.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animator) {
try {
int color = (int) animator.getAnimatedValue();
ColorFilter colorFilter = new LightingColorFilter(Color.BLACK, color);
View floatingActionButtonContainer = getView().findViewById(R.id.dialpad_floating_action_button_container);
if (floatingActionButtonContainer != null) {
floatingActionButtonContainer.getBackground().setColorFilter(colorFilter);
}
} catch (Exception e) {
animator.cancel();
}
}
});
mPseudoEmergencyColorAnimator.addListener(new AnimatorListener() {
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
try {
vibrate(VIBRATE_LENGTH_MILLIS);
} catch (Exception e) {
animation.cancel();
}
}
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
try {
View floatingActionButtonContainer = getView().findViewById(R.id.dialpad_floating_action_button_container);
if (floatingActionButtonContainer != null) {
floatingActionButtonContainer.getBackground().clearColorFilter();
}
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
try {
vibrate(VIBRATE_LENGTH_MILLIS);
} catch (Exception e) {
// ignored
}
}
}, ITERATION_LENGTH_MILLIS);
} catch (Exception e) {
animation.cancel();
}
}
});
mPseudoEmergencyColorAnimator.setDuration(VIBRATE_LENGTH_MILLIS);
mPseudoEmergencyColorAnimator.setRepeatMode(ValueAnimator.REVERSE);
mPseudoEmergencyColorAnimator.setRepeatCount(ANIMATION_ITERATION_COUNT);
}
if (!mPseudoEmergencyColorAnimator.isStarted()) {
mPseudoEmergencyColorAnimator.start();
}
}
use of android.graphics.LightingColorFilter in project Gadgetbridge by Freeyourgadget.
the class ActivitySummariesFilter method update_filter_fields.
public void update_filter_fields() {
TextView filterDateFromDataView = findViewById(R.id.textViewFromData);
TextView filterDateToDataView = findViewById(R.id.textViewToData);
Button reset_filter_button = findViewById(R.id.reset_filter_button);
TextView textViewItemsData = findViewById(R.id.textViewItemsData);
final EditText nameContainsFilterdata = findViewById(R.id.textViewNameData);
if (dateFromFilter > 0) {
filterDateFromDataView.setText(DateTimeUtils.formatDate(new Date(dateFromFilter)));
} else {
filterDateFromDataView.setText("");
}
if (dateToFilter > 0) {
filterDateToDataView.setText(DateTimeUtils.formatDate(new Date(dateToFilter)));
} else {
filterDateToDataView.setText("");
}
if (dateToFilter < dateFromFilter && dateToFilter > 0) {
filterDateFromDataView.setBackgroundColor(Color.RED);
filterDateToDataView.setBackgroundColor(Color.RED);
} else {
filterDateFromDataView.setBackgroundColor(BACKGROUND_COLOR);
filterDateToDataView.setBackgroundColor(BACKGROUND_COLOR);
}
if (itemsFilter != null) {
textViewItemsData.setText(String.format("%s", itemsFilter.size()));
} else {
textViewItemsData.setText("0");
}
if (nameContainsFilter != null && !nameContainsFilter.equals(nameContainsFilterdata.getText().toString())) {
nameContainsFilterdata.setText(nameContainsFilter);
}
if (dateToFilter != 0 || dateFromFilter != 0 || activityFilter != 0 || nameContainsFilterdata.length() > 0 || itemsFilter != null || deviceFilter != initial_deviceFilter) {
reset_filter_button.getBackground().clearColorFilter();
} else {
reset_filter_button.getBackground().setColorFilter(new LightingColorFilter(0x0, 0x00888888));
}
}
Aggregations