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 int behaviorWithAttachments;
private boolean isOnWifi;
private String targetedId;
public NotificationsListAdapter(Context context, boolean isOnWifi, int behaviorWithAttachments, List<Notification> 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() {

View File

@ -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">
<LinearLayout
android:layout_width="60dp"
android:layout_height="wrap_content"

View File

@ -133,6 +133,16 @@
<color name="secondary_text_disabled_material_dark">@color/mastodonC3</color>
<!-- 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 />