use of android.graphics.drawable.RippleDrawable in project material-dialogs by afollestad.
the class CircleView method update.
private void update(@ColorInt int color) {
innerPaint.setColor(color);
outerPaint.setColor(shiftColorDown(color));
Drawable selector = createSelector(color);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
int[][] states = new int[][] { new int[] { android.R.attr.state_pressed } };
int[] colors = new int[] { shiftColorUp(color) };
ColorStateList rippleColors = new ColorStateList(states, colors);
setForeground(new RippleDrawable(rippleColors, selector, null));
} else {
setForeground(selector);
}
}
use of android.graphics.drawable.RippleDrawable in project BoomMenu by Nightonke.
the class BoomButton method initCircleButtonDrawable.
@SuppressLint("NewApi")
protected void initCircleButtonDrawable() {
if (rippleEffectWorks) {
RippleDrawable rippleDrawable = new RippleDrawable(ColorStateList.valueOf(highlightedColor()), Util.getOvalDrawable(button, unable ? unableColor() : normalColor()), null);
Util.setDrawable(button, rippleDrawable);
this.rippleDrawable = rippleDrawable;
} else {
nonRippleBitmapDrawable = Util.getOvalStateListBitmapDrawable(button, buttonRadius, normalColor(), highlightedColor(), unableColor());
if (isNeededColorAnimation()) {
// Then we need to create 2 drawables to perform the color-transaction effect.
// Because gradient-drawable is able to change the color,
// but not able to perform a click-effect.
nonRippleGradientDrawable = Util.getOvalDrawable(button, unable ? unableColor() : normalColor());
}
Util.setDrawable(button, nonRippleBitmapDrawable);
}
}
use of android.graphics.drawable.RippleDrawable in project BoomMenu by Nightonke.
the class BoomButton method initHamButtonDrawable.
@SuppressLint("NewApi")
protected void initHamButtonDrawable() {
if (rippleEffectWorks) {
RippleDrawable rippleDrawable = new RippleDrawable(ColorStateList.valueOf(highlightedColor()), Util.getRectangleDrawable(button, buttonCornerRadius, unable ? unableColor() : normalColor()), null);
Util.setDrawable(button, rippleDrawable);
this.rippleDrawable = rippleDrawable;
} else {
nonRippleBitmapDrawable = Util.getRectangleStateListBitmapDrawable(button, buttonWidth, buttonHeight, buttonCornerRadius, normalColor(), highlightedColor(), unableColor());
if (isNeededColorAnimation()) {
// Then we need to create 2 drawables to perform the color-transaction effect.
// Because gradient-drawable is able to change the color,
// but not able to perform a click-effect.
nonRippleGradientDrawable = Util.getRectangleDrawable(button, buttonCornerRadius, unable ? unableColor() : normalColor());
}
Util.setDrawable(button, nonRippleBitmapDrawable);
}
}
use of android.graphics.drawable.RippleDrawable in project android_frameworks_base by ResurrectionRemix.
the class QuickStatusBarHeader method onFinishInflate.
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mEmergencyOnly = (TextView) findViewById(R.id.header_emergency_calls_only);
mEdit = findViewById(android.R.id.edit);
findViewById(android.R.id.edit).setOnClickListener(view -> mHost.startRunnableDismissingKeyguard(() -> mQsPanel.showEdit(view)));
mDateTimeAlarmGroup = (ViewGroup) findViewById(R.id.date_time_alarm_group);
mDateTimeAlarmGroup.findViewById(R.id.empty_time_view).setVisibility(View.GONE);
mDateTimeGroup = (ViewGroup) findViewById(R.id.date_time_group);
mDateTimeGroup.setPivotX(0);
mDateTimeGroup.setPivotY(0);
mDateTimeTranslation = getResources().getDimension(R.dimen.qs_date_time_translation);
mShowFullAlarm = getResources().getBoolean(R.bool.quick_settings_show_full_alarm);
mClock = (View) findViewById(R.id.clock);
mClock.setOnClickListener(this);
mDate = (View) findViewById(R.id.date);
mDate.setOnClickListener(this);
mExpandIndicator = (ExpandableIndicator) findViewById(R.id.expand_indicator);
mHeaderQsPanel = (QuickQSPanel) findViewById(R.id.quick_qs_panel);
mSettingsButton = (SettingsButton) findViewById(R.id.settings_button);
mSettingsContainer = findViewById(R.id.settings_button_container);
mSettingsButton.setOnClickListener(this);
mSettingsButton.setOnLongClickListener(this);
mWeatherClient = new OmniJawsClient(mContext);
mWeatherEnabled = mWeatherClient.isOmniJawsEnabled();
mWeatherContainer = (LinearLayout) findViewById(R.id.weather_container);
mWeatherimage = (ImageView) findViewById(R.id.weather_image);
mNoWeatherimage = (ImageView) findViewById(R.id.no_weather_image);
mWeatherLine1 = (TextView) findViewById(R.id.weather_line_1);
mWeatherLine2 = (TextView) findViewById(R.id.weather_line_2);
queryAndUpdateWeather();
mAlarmStatusCollapsed = findViewById(R.id.alarm_status_collapsed);
mAlarmStatusCollapsed.setOnClickListener(this);
mAlarmStatus = (TextView) findViewById(R.id.alarm_status);
mAlarmStatus.setOnClickListener(this);
mTaskManagerButton = (TaskManagerButton) findViewById(R.id.task_manager_button);
mTaskManagerButton.setOnClickListener(this);
mMultiUserSwitch = (MultiUserSwitch) findViewById(R.id.multi_user_switch);
mMultiUserAvatar = (ImageView) mMultiUserSwitch.findViewById(R.id.multi_user_avatar);
// RenderThread is doing more harm than good when touching the header (to expand quick
// settings), so disable it for this view
((RippleDrawable) mSettingsButton.getBackground()).setForceSoftware(true);
((RippleDrawable) mExpandIndicator.getBackground()).setForceSoftware(true);
((RippleDrawable) mTaskManagerButton.getBackground()).setForceSoftware(true);
mBackgroundImage = (ImageView) findViewById(R.id.background_image);
updateResources();
}
use of android.graphics.drawable.RippleDrawable in project android_frameworks_base by ResurrectionRemix.
the class TaskViewHeader method bindToTask.
/**
* Binds the bar view to the task.
*/
public void bindToTask(Task t, boolean touchExplorationEnabled, boolean disabledInSafeMode) {
mTask = t;
int primaryColor = disabledInSafeMode ? mDisabledTaskBarBackgroundColor : t.colorPrimary;
if (mBackground.getColor() != primaryColor) {
updateBackgroundColor(primaryColor, mDimAlpha);
}
if (!mTitleView.getText().toString().equals(t.title)) {
mTitleView.setText(t.title);
}
mTitleView.setContentDescription(t.titleDescription);
mTitleView.setTextColor(t.useLightOnPrimaryColor ? mTaskBarViewLightTextColor : mTaskBarViewDarkTextColor);
mDismissButton.setImageDrawable(t.useLightOnPrimaryColor ? mLightDismissDrawable : mDarkDismissDrawable);
mDismissButton.setContentDescription(t.dismissDescription);
mDismissButton.setOnClickListener(this);
mDismissButton.setClickable(false);
((RippleDrawable) mDismissButton.getBackground()).setForceSoftware(true);
updateLockTaskDrawable();
mLockTaskButton.setOnClickListener(this);
mLockTaskButton.setClickable(false);
((RippleDrawable) mLockTaskButton.getBackground()).setForceSoftware(true);
// current task
if (mMoveTaskButton != null) {
if (t.isFreeformTask()) {
mMoveTaskTargetStackId = FULLSCREEN_WORKSPACE_STACK_ID;
mMoveTaskButton.setImageDrawable(t.useLightOnPrimaryColor ? mLightFullscreenIcon : mDarkFullscreenIcon);
} else {
mMoveTaskTargetStackId = FREEFORM_WORKSPACE_STACK_ID;
mMoveTaskButton.setImageDrawable(t.useLightOnPrimaryColor ? mLightFreeformIcon : mDarkFreeformIcon);
}
mMoveTaskButton.setOnClickListener(this);
mMoveTaskButton.setClickable(false);
((RippleDrawable) mMoveTaskButton.getBackground()).setForceSoftware(true);
}
if (Recents.getDebugFlags().isFastToggleRecentsEnabled()) {
if (mFocusTimerIndicator == null) {
mFocusTimerIndicator = (ProgressBar) Utilities.findViewStubById(this, R.id.focus_timer_indicator_stub).inflate();
}
mFocusTimerIndicator.getProgressDrawable().setColorFilter(getSecondaryColor(t.colorPrimary, t.useLightOnPrimaryColor), PorterDuff.Mode.SRC_IN);
}
// In accessibility, a single click on the focused app info button will show it
if (touchExplorationEnabled) {
mIconView.setContentDescription(t.appInfoDescription);
mIconView.setOnClickListener(this);
mIconView.setClickable(true);
}
}
Aggregations