Prepares colors

This commit is contained in:
tom79 2017-08-27 16:36:18 +02:00
parent 3a3f612154
commit 4687a0d4d8
3 changed files with 36 additions and 4 deletions

View File

@ -88,7 +88,7 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio
private NotificationsListAdapter notificationsListAdapter; private NotificationsListAdapter notificationsListAdapter;
private int behaviorWithAttachments; private int behaviorWithAttachments;
private boolean isOnWifi; private boolean isOnWifi;
private String targetedId;
public NotificationsListAdapter(Context context, boolean isOnWifi, int behaviorWithAttachments, List<Notification> notifications){ public NotificationsListAdapter(Context context, boolean isOnWifi, int behaviorWithAttachments, List<Notification> notifications){
this.context = context; this.context = context;
@ -170,6 +170,8 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio
final float scale = context.getResources().getDisplayMetrics().density; final float scale = context.getResources().getDisplayMetrics().density;
String type = notification.getType(); String type = notification.getType();
String typeString = ""; String typeString = "";
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
switch (type){ switch (type){
case "mention": case "mention":
holder.status_action_container.setVisibility(View.VISIBLE); 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)); typeString = String.format("%s %s", Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true),context.getString(R.string.notif_mention));
else else
typeString = String.format("@%s %s", notification.getAccount().getAcct(),context.getString(R.string.notif_mention)); 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; break;
case "reblog": case "reblog":
holder.status_action_container.setVisibility(View.GONE); 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)); typeString = String.format("%s %s", Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true),context.getString(R.string.notif_reblog));
else else
typeString = String.format("@%s %s", notification.getAccount().getAcct(),context.getString(R.string.notif_reblog)); 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; break;
case "favourite": case "favourite":
holder.status_action_container.setVisibility(View.GONE); 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)); typeString = String.format("%s %s", Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true),context.getString(R.string.notif_favourite));
else else
typeString = String.format("@%s %s", notification.getAccount().getAcct(),context.getString(R.string.notif_favourite)); 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; break;
case "follow": case "follow":
holder.status_action_container.setVisibility(View.GONE); 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)); typeString = String.format("%s %s", Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true),context.getString(R.string.notif_follow));
else else
typeString = String.format("@%s %s", notification.getAccount().getAcct(),context.getString(R.string.notif_follow)); 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; break;
} }
@ -214,7 +236,6 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio
//Manages theme for icon colors //Manages theme for icon colors
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
if( theme == Helper.THEME_DARK){ if( theme == Helper.THEME_DARK){
changeDrawableColor(context, R.drawable.ic_reply,R.color.dark_text); changeDrawableColor(context, R.drawable.ic_reply,R.color.dark_text);
changeDrawableColor(context, R.drawable.ic_action_more,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){ private void displayConfirmationNotificationDialog(final Notification notification){
final ArrayList seletedItems = new ArrayList(); final ArrayList seletedItems = new ArrayList();
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
AlertDialog dialog = new AlertDialog.Builder(context) AlertDialog dialog = new AlertDialog.Builder(context)
.setTitle(R.string.delete_notification_ask) .setTitle(R.string.delete_notification_ask)
.setMultiChoiceItems(new String[]{context.getString(R.string.delete_notification_ask_all)}, null, new DialogInterface.OnMultiChoiceClickListener() { .setMultiChoiceItems(new String[]{context.getString(R.string.delete_notification_ask_all)}, null, new DialogInterface.OnMultiChoiceClickListener() {

View File

@ -35,7 +35,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/main_container" android:id="@+id/main_container"
android:orientation="horizontal"> android:orientation="horizontal"
card_view:ignore="DisableBaselineAlignment">
<LinearLayout <LinearLayout
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -133,6 +133,16 @@
<color name="secondary_text_disabled_material_dark">@color/mastodonC3</color> <color name="secondary_text_disabled_material_dark">@color/mastodonC3</color>
<!-- Primary & accent colors --> <!-- Primary & accent colors -->
<color name="notif_dark_1">#282c37</color>
<color name="notif_dark_2">#313543</color>
<color name="notif_dark_3">#393f4f</color>
<color name="notif_dark_4">#595f6f</color>
<color name="notif_light_1">#efefef</color>
<color name="notif_light_2">#ebf3fa</color>
<color name="notif_light_3">#d9e1e8</color>
<color name="notif_light_4">#c9d1d8</color>
<eat-comment /> <eat-comment />