mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-05 00:23:09 +02:00
Default swipe icon colors
This commit is contained in:
@@ -20,6 +20,7 @@ package eu.faircode.email;
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -325,6 +326,12 @@ public class EntityFolder extends EntityOrder implements Serializable {
|
||||
return R.drawable.twotone_folder_24;
|
||||
}
|
||||
|
||||
static Integer getDefaultColor(String type) {
|
||||
if (EntityFolder.TRASH.equals(type) || EntityFolder.JUNK.equals(type))
|
||||
return Color.RED;
|
||||
return null;
|
||||
}
|
||||
|
||||
String getDisplayName(Context context) {
|
||||
return (display == null ? localizeName(context, name) : display);
|
||||
}
|
||||
|
||||
@@ -1974,7 +1974,11 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||
if (dX > 0) {
|
||||
// Right swipe
|
||||
d.setAlpha(Math.round(255 * Math.min(dX / (2 * margin + size), 1.0f)));
|
||||
if (swipes.right_color != null)
|
||||
if (swipes.right_color == null) {
|
||||
Integer color = EntityFolder.getDefaultColor(swipes.right_type);
|
||||
if (color != null)
|
||||
d.setTint(color);
|
||||
} else
|
||||
d.setTint(swipes.right_color);
|
||||
int padding = (rect.height() - size);
|
||||
d.setBounds(
|
||||
@@ -1986,7 +1990,11 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||
} else if (dX < 0) {
|
||||
// Left swipe
|
||||
d.setAlpha(Math.round(255 * Math.min(-dX / (2 * margin + size), 1.0f)));
|
||||
if (swipes.left_color != null)
|
||||
if (swipes.left_color == null) {
|
||||
Integer color = EntityFolder.getDefaultColor(swipes.left_type);
|
||||
if (color != null)
|
||||
d.setTint(color);
|
||||
} else
|
||||
d.setTint(swipes.left_color);
|
||||
int padding = (rect.height() - size);
|
||||
d.setBounds(
|
||||
|
||||
Reference in New Issue
Block a user