Fade out swipe indicators

pull/204/head
M66B 3 years ago
parent 3755dc4d3b
commit c29c0ef96c

@ -2142,9 +2142,13 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
Drawable d = context.getDrawable(icon).mutate(); Drawable d = context.getDrawable(icon).mutate();
d.setTint(Helper.resolveColor(context, android.R.attr.textColorSecondary)); d.setTint(Helper.resolveColor(context, android.R.attr.textColorSecondary));
int half = rect.width() / 2;
if (dX > 0) { if (dX > 0) {
// Right swipe // Right swipe
if (dX < half)
d.setAlpha(Math.round(255 * Math.min(dX / (2 * margin + size), 1.0f))); d.setAlpha(Math.round(255 * Math.min(dX / (2 * margin + size), 1.0f)));
else
d.setAlpha(Math.round(255 * (1.0f - (dX - half) / half)));
if (swipes.right_color == null) { if (swipes.right_color == null) {
Integer color = EntityFolder.getDefaultColor(swipes.swipe_right, swipes.right_type, context); Integer color = EntityFolder.getDefaultColor(swipes.swipe_right, swipes.right_type, context);
if (color != null) if (color != null)
@ -2160,7 +2164,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
d.draw(canvas); d.draw(canvas);
} else if (dX < 0) { } else if (dX < 0) {
// Left swipe // Left swipe
if (-dX < half)
d.setAlpha(Math.round(255 * Math.min(-dX / (2 * margin + size), 1.0f))); d.setAlpha(Math.round(255 * Math.min(-dX / (2 * margin + size), 1.0f)));
else
d.setAlpha(Math.round(255 * (1.0f - (-dX - half) / half)));
if (swipes.left_color == null) { if (swipes.left_color == null) {
Integer color = EntityFolder.getDefaultColor(swipes.swipe_left, swipes.left_type, context); Integer color = EntityFolder.getDefaultColor(swipes.swipe_left, swipes.left_type, context);
if (color != null) if (color != null)

Loading…
Cancel
Save