Search in sources :

Example 36 with LightingColorFilter

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));
}
Also used : LayerDrawable(android.graphics.drawable.LayerDrawable) LayerDrawable(android.graphics.drawable.LayerDrawable) Drawable(android.graphics.drawable.Drawable) LightingColorFilter(android.graphics.LightingColorFilter)

Example 37 with LightingColorFilter

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;
}
Also used : ImageButton(android.widget.ImageButton) ListView(android.widget.ListView) FastBlurTransformation(de.danoeh.antennapod.core.glide.FastBlurTransformation) LayoutInflater(android.view.LayoutInflater) LightingColorFilter(android.graphics.LightingColorFilter) TextView(android.widget.TextView) IconTextView(com.joanzapata.iconify.widget.IconTextView) Intent(android.content.Intent) ImageView(android.widget.ImageView) SearchView(android.support.v7.widget.SearchView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) IconTextView(com.joanzapata.iconify.widget.IconTextView)

Example 38 with LightingColorFilter

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();
    }
}
Also used : ArgbEvaluator(android.animation.ArgbEvaluator) Handler(android.os.Handler) AnimatorUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener) ValueAnimator(android.animation.ValueAnimator) View(android.view.View) AnimatorListener(android.animation.Animator.AnimatorListener) ColorFilter(android.graphics.ColorFilter) LightingColorFilter(android.graphics.LightingColorFilter) Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) LightingColorFilter(android.graphics.LightingColorFilter)

Example 39 with LightingColorFilter

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();
    }
}
Also used : ArgbEvaluator(android.animation.ArgbEvaluator) Handler(android.os.Handler) AnimatorUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener) ValueAnimator(android.animation.ValueAnimator) View(android.view.View) AnimatorListener(android.animation.Animator.AnimatorListener) ColorFilter(android.graphics.ColorFilter) LightingColorFilter(android.graphics.LightingColorFilter) Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) LightingColorFilter(android.graphics.LightingColorFilter)

Example 40 with LightingColorFilter

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));
    }
}
Also used : EditText(android.widget.EditText) Button(android.widget.Button) LightingColorFilter(android.graphics.LightingColorFilter) TextView(android.widget.TextView) Date(java.util.Date)

Aggregations

LightingColorFilter (android.graphics.LightingColorFilter)44 ColorFilter (android.graphics.ColorFilter)24 Drawable (android.graphics.drawable.Drawable)20 LayerDrawable (android.graphics.drawable.LayerDrawable)15 FilterableStateListDrawable (com.simplecity.amp_library.ui.views.FilterableStateListDrawable)14 View (android.view.View)10 ImageView (android.widget.ImageView)8 TextView (android.widget.TextView)8 Intent (android.content.Intent)5 Canvas (android.graphics.Canvas)5 Bitmap (android.graphics.Bitmap)4 LayoutInflater (android.view.LayoutInflater)3 Button (android.widget.Button)3 ListView (android.widget.ListView)3 Animator (android.animation.Animator)2 AnimatorListener (android.animation.Animator.AnimatorListener)2 ArgbEvaluator (android.animation.ArgbEvaluator)2 ValueAnimator (android.animation.ValueAnimator)2 AnimatorUpdateListener (android.animation.ValueAnimator.AnimatorUpdateListener)2 Context (android.content.Context)2