From 4687a0d4d894d1d6ca4af5ec25727ed123d6ae72 Mon Sep 17 00:00:00 2001 From: tom79 Date: Sun, 27 Aug 2017 16:36:18 +0200 Subject: [PATCH] Prepares colors --- .../drawers/NotificationsListAdapter.java | 27 ++++++++++++++++--- .../main/res/layout/drawer_notification.xml | 3 ++- app/src/main/res/values/colors.xml | 10 +++++++ 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/NotificationsListAdapter.java b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/NotificationsListAdapter.java index aa91b19b1..f1f4de097 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/NotificationsListAdapter.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/NotificationsListAdapter.java @@ -88,7 +88,7 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio private NotificationsListAdapter notificationsListAdapter; private int behaviorWithAttachments; private boolean isOnWifi; - private String targetedId; + public NotificationsListAdapter(Context context, boolean isOnWifi, int behaviorWithAttachments, List notifications){ this.context = context; @@ -170,6 +170,8 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio final float scale = context.getResources().getDisplayMetrics().density; String type = notification.getType(); String typeString = ""; + int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); + switch (type){ case "mention": holder.status_action_container.setVisibility(View.VISIBLE); @@ -177,6 +179,11 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio typeString = String.format("%s %s", Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true),context.getString(R.string.notif_mention)); else typeString = String.format("@%s %s", notification.getAccount().getAcct(),context.getString(R.string.notif_mention)); + if( theme == Helper.THEME_DARK){ + holder.card_status_container.setCardBackgroundColor(ContextCompat.getColor(context, R.color.notif_dark_1)); + }else { + holder.card_status_container.setCardBackgroundColor(ContextCompat.getColor(context, R.color.notif_light_1)); + } break; case "reblog": holder.status_action_container.setVisibility(View.GONE); @@ -184,6 +191,11 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio typeString = String.format("%s %s", Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true),context.getString(R.string.notif_reblog)); else typeString = String.format("@%s %s", notification.getAccount().getAcct(),context.getString(R.string.notif_reblog)); + if( theme == Helper.THEME_DARK){ + holder.card_status_container.setCardBackgroundColor(ContextCompat.getColor(context, R.color.notif_dark_2)); + }else { + holder.card_status_container.setCardBackgroundColor(ContextCompat.getColor(context, R.color.notif_light_2)); + } break; case "favourite": holder.status_action_container.setVisibility(View.GONE); @@ -191,6 +203,11 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio typeString = String.format("%s %s", Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true),context.getString(R.string.notif_favourite)); else typeString = String.format("@%s %s", notification.getAccount().getAcct(),context.getString(R.string.notif_favourite)); + if( theme == Helper.THEME_DARK){ + holder.card_status_container.setCardBackgroundColor(ContextCompat.getColor(context, R.color.notif_dark_3)); + }else { + holder.card_status_container.setCardBackgroundColor(ContextCompat.getColor(context, R.color.notif_light_3)); + } break; case "follow": holder.status_action_container.setVisibility(View.GONE); @@ -198,6 +215,11 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio typeString = String.format("%s %s", Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true),context.getString(R.string.notif_follow)); else typeString = String.format("@%s %s", notification.getAccount().getAcct(),context.getString(R.string.notif_follow)); + if( theme == Helper.THEME_DARK){ + holder.card_status_container.setCardBackgroundColor(ContextCompat.getColor(context, R.color.notif_dark_4)); + }else { + holder.card_status_container.setCardBackgroundColor(ContextCompat.getColor(context, R.color.notif_light_4)); + } break; } @@ -214,7 +236,6 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio //Manages theme for icon colors - int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); if( theme == Helper.THEME_DARK){ changeDrawableColor(context, R.drawable.ic_reply,R.color.dark_text); changeDrawableColor(context, R.drawable.ic_action_more,R.color.dark_text); @@ -522,7 +543,7 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio */ private void displayConfirmationNotificationDialog(final Notification notification){ final ArrayList seletedItems = new ArrayList(); - final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); + AlertDialog dialog = new AlertDialog.Builder(context) .setTitle(R.string.delete_notification_ask) .setMultiChoiceItems(new String[]{context.getString(R.string.delete_notification_ask_all)}, null, new DialogInterface.OnMultiChoiceClickListener() { diff --git a/app/src/main/res/layout/drawer_notification.xml b/app/src/main/res/layout/drawer_notification.xml index f96ee8a07..df96784c4 100644 --- a/app/src/main/res/layout/drawer_notification.xml +++ b/app/src/main/res/layout/drawer_notification.xml @@ -35,7 +35,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/main_container" - android:orientation="horizontal"> + android:orientation="horizontal" + card_view:ignore="DisableBaselineAlignment"> @color/mastodonC3 + #282c37 + #313543 + #393f4f + #595f6f + + #efefef + #ebf3fa + #d9e1e8 + #c9d1d8 +