diff --git a/app/src/main/java/app/fedilab/android/drawers/NotificationsListAdapter.java b/app/src/main/java/app/fedilab/android/drawers/NotificationsListAdapter.java index 0536042b4..62089ebee 100644 --- a/app/src/main/java/app/fedilab/android/drawers/NotificationsListAdapter.java +++ b/app/src/main/java/app/fedilab/android/drawers/NotificationsListAdapter.java @@ -371,7 +371,6 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On else holder.status_document_container.setVisibility(View.VISIBLE); - holder.status_reply.setText(""); if( !status.isClickable()) Status.transform(context, status); if( !status.isEmojiFound()) @@ -380,6 +379,10 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On holder.status_spoiler.setText(status.getContentSpanCW(), TextView.BufferType.SPANNABLE); holder.status_spoiler.setMovementMethod(LinkMovementMethod.getInstance()); holder.notification_status_content.setMovementMethod(LinkMovementMethod.getInstance()); + if (status.getReplies_count() > 0) + holder.status_reply_count.setText(String.valueOf(status.getReplies_count())); + else + holder.status_reply_count.setText(""); if (status.getFavourites_count() > 0) holder.status_favorite_count.setText(String.valueOf(status.getFavourites_count())); else @@ -421,7 +424,6 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On holder.status_action_container.setVisibility(View.VISIBLE); - Drawable imgReply; if( !status.isFavAnimated() ) { if (status.isFavourited() || (status.getReblog() != null && status.getReblog().isFavourited())) { holder.spark_button_fav.setChecked(true); @@ -451,12 +453,11 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On if( theme == Helper.THEME_DARK) - Helper.changeDrawableColor(context, R.drawable.ic_reply,R.color.action_dark); + Helper.changeDrawableColor(context, holder.status_reply,R.color.action_dark); else if(theme == Helper.THEME_BLACK) - Helper.changeDrawableColor(context, R.drawable.ic_reply,R.color.action_black); + Helper.changeDrawableColor(context, holder.status_reply,R.color.action_black); else - Helper.changeDrawableColor(context, R.drawable.ic_reply,R.color.action_light); - imgReply = ContextCompat.getDrawable(context, R.drawable.ic_reply); + Helper.changeDrawableColor(context, holder.status_reply,R.color.action_light); if( status.getReblog() == null) { if (status.getSpoiler_text() != null && status.getSpoiler_text().trim().length() > 0 ) { @@ -495,22 +496,20 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On } } - assert imgReply != null; - imgReply.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (20 * iconSizePercent/100 * scale + 0.5f)); - holder.status_reply.setCompoundDrawables(imgReply, null, null, null); + if( theme == Helper.THEME_DARK ){ holder.status_favorite_count.setTextColor(ContextCompat.getColor(context, R.color.action_dark)); holder.status_reblog_count.setTextColor(ContextCompat.getColor(context, R.color.action_dark)); - holder.status_reply.setTextColor(ContextCompat.getColor(context, R.color.action_dark)); + holder.status_reply_count.setTextColor(ContextCompat.getColor(context, R.color.action_dark)); }else if(theme == Helper.THEME_BLACK){ holder.status_favorite_count.setTextColor(ContextCompat.getColor(context, R.color.action_black)); holder.status_reblog_count.setTextColor(ContextCompat.getColor(context, R.color.action_black)); - holder.status_reply.setTextColor(ContextCompat.getColor(context, R.color.action_black)); + holder.status_reply_count.setTextColor(ContextCompat.getColor(context, R.color.action_black)); }else { holder.status_favorite_count.setTextColor(ContextCompat.getColor(context, R.color.action_light)); holder.status_reblog_count.setTextColor(ContextCompat.getColor(context, R.color.action_light)); - holder.status_reply.setTextColor(ContextCompat.getColor(context, R.color.action_light)); + holder.status_reply_count.setTextColor(ContextCompat.getColor(context, R.color.action_light)); } if( type.equals("favourite") || type.equals("reblog")){ holder.status_document_container.setVisibility(View.GONE); @@ -1330,7 +1329,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On TextView status_favorite_count; TextView status_reblog_count; TextView status_date; - TextView status_reply; + TextView status_reply_count; LinearLayout status_document_container; ConstraintLayout status_action_container; Button status_show_more; @@ -1351,6 +1350,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On ImageView status_privacy; LinearLayout status_spoiler_mention_container; TextView status_mention_spoiler; + ImageView status_reply; SparkButton spark_button_fav, spark_button_reblog; //Poll @@ -1376,7 +1376,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On status_favorite_count = itemView.findViewById(R.id.status_favorite_count); status_reblog_count = itemView.findViewById(R.id.status_reblog_count); status_date = itemView.findViewById(R.id.status_date); - status_reply = itemView.findViewById(R.id.status_reply); + status_reply_count = itemView.findViewById(R.id.status_reply_count); status_privacy = itemView.findViewById(R.id.status_privacy); notification_delete = itemView.findViewById(R.id.notification_delete); status_show_more = itemView.findViewById(R.id.status_show_more); @@ -1398,6 +1398,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On status_spoiler_button = itemView.findViewById(R.id.status_spoiler_button); status_spoiler_mention_container = itemView.findViewById(R.id.status_spoiler_mention_container); status_mention_spoiler = itemView.findViewById(R.id.status_mention_spoiler); + status_reply = itemView.findViewById(R.id.status_reply); spark_button_fav = itemView.findViewById(R.id.spark_button_fav); spark_button_reblog = itemView.findViewById(R.id.spark_button_reblog); diff --git a/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java b/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java index 3765905eb..2a7247138 100644 --- a/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java +++ b/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java @@ -304,6 +304,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct ImageView status_account_profile; ImageView status_account_profile_boost; ImageView status_account_profile_boost_by; + TextView status_reply_count; TextView status_favorite_count; TextView status_reblog_count; TextView status_toot_date; @@ -334,7 +335,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct ImageView conversation_pp_4; LinearLayout conversation_pp; RelativeLayout status_prev4_container; - TextView status_reply; + ImageView status_reply; ImageView status_pin; ImageView status_remove; ImageView status_privacy; @@ -401,6 +402,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct status_account_profile = itemView.findViewById(R.id.status_account_profile); status_account_profile_boost = itemView.findViewById(R.id.status_account_profile_boost); status_account_profile_boost_by = itemView.findViewById(R.id.status_account_profile_boost_by); + status_reply_count = itemView.findViewById(R.id.status_reply_count); status_favorite_count = itemView.findViewById(R.id.status_favorite_count); status_reblog_count = itemView.findViewById(R.id.status_reblog_count); status_pin = itemView.findViewById(R.id.status_pin); @@ -602,7 +604,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct - holder.status_reply.setText(""); //Display a preview for accounts that have replied *if enabled and only for home timeline* if (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) { holder.rated.setVisibility(View.GONE); @@ -813,6 +814,8 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct holder.new_element.setVisibility(View.GONE); + holder.status_reply.getLayoutParams().height = (int) Helper.convertDpToPixel((20 * iconSizePercent / 100), context); + holder.status_reply.getLayoutParams().width = (int) Helper.convertDpToPixel((20 * iconSizePercent / 100), context); holder.status_more.getLayoutParams().height = (int) Helper.convertDpToPixel((20 * iconSizePercent / 100), context); holder.status_more.getLayoutParams().width = (int) Helper.convertDpToPixel((20 * iconSizePercent / 100), context); holder.status_privacy.getLayoutParams().height = (int) Helper.convertDpToPixel((20 * iconSizePercent / 100), context); @@ -861,16 +864,16 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct if (theme == Helper.THEME_BLACK) { Helper.changeDrawableColor(context, holder.cached_status, R.color.action_dark); Helper.changeDrawableColor(context, holder.status_remove, R.color.action_dark); - Helper.changeDrawableColor(context, R.drawable.ic_reply, R.color.action_black); + Helper.changeDrawableColor(context, holder.status_reply, R.color.action_black); Helper.changeDrawableColor(context, holder.status_more, R.color.action_black); Helper.changeDrawableColor(context, holder.status_privacy, R.color.action_black); Helper.changeDrawableColor(context, R.drawable.ic_repeat, R.color.action_black); Helper.changeDrawableColor(context, R.drawable.ic_conversation, R.color.action_black); Helper.changeDrawableColor(context, R.drawable.ic_plus_one, R.color.action_black); Helper.changeDrawableColor(context, R.drawable.ic_pin_drop, R.color.action_black); + holder.status_reply_count.setTextColor(ContextCompat.getColor(context, R.color.action_black)); holder.status_favorite_count.setTextColor(ContextCompat.getColor(context, R.color.action_black)); holder.status_reblog_count.setTextColor(ContextCompat.getColor(context, R.color.action_black)); - holder.status_reply.setTextColor(ContextCompat.getColor(context, R.color.action_black)); Helper.changeDrawableColor(context, R.drawable.ic_photo, R.color.dark_text); @@ -889,16 +892,16 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct } else if (theme == Helper.THEME_DARK) { Helper.changeDrawableColor(context, holder.cached_status, R.color.action_dark); Helper.changeDrawableColor(context, holder.status_remove, R.color.action_dark); - Helper.changeDrawableColor(context, R.drawable.ic_reply, R.color.action_dark); + Helper.changeDrawableColor(context, holder.status_reply, R.color.action_dark); Helper.changeDrawableColor(context, holder.status_more, R.color.action_dark); Helper.changeDrawableColor(context, R.drawable.ic_repeat, R.color.action_dark); Helper.changeDrawableColor(context, holder.status_privacy, R.color.action_dark); Helper.changeDrawableColor(context, R.drawable.ic_plus_one, R.color.action_dark); Helper.changeDrawableColor(context, R.drawable.ic_pin_drop, R.color.action_dark); Helper.changeDrawableColor(context, R.drawable.ic_conversation, R.color.action_dark); + holder.status_reply_count.setTextColor(ContextCompat.getColor(context, R.color.action_dark)); holder.status_favorite_count.setTextColor(ContextCompat.getColor(context, R.color.action_dark)); holder.status_reblog_count.setTextColor(ContextCompat.getColor(context, R.color.action_dark)); - holder.status_reply.setTextColor(ContextCompat.getColor(context, R.color.action_dark)); Helper.changeDrawableColor(context, R.drawable.ic_repeat_head_toot, R.color.dark_text_toot_header); @@ -918,7 +921,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct Helper.changeDrawableColor(context, holder.cached_status, R.color.action_light); Helper.changeDrawableColor(context, holder.status_remove, R.color.action_light); Helper.changeDrawableColor(context, R.drawable.ic_fetch_more, R.color.action_light); - Helper.changeDrawableColor(context, R.drawable.ic_reply, R.color.action_light); + Helper.changeDrawableColor(context, holder.status_reply, R.color.action_light); Helper.changeDrawableColor(context, R.drawable.ic_conversation, R.color.action_light); Helper.changeDrawableColor(context, R.drawable.ic_more_horiz, R.color.action_light); Helper.changeDrawableColor(context, holder.status_more, R.color.action_light); @@ -926,9 +929,9 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct Helper.changeDrawableColor(context, R.drawable.ic_repeat, R.color.action_light); Helper.changeDrawableColor(context, R.drawable.ic_plus_one, R.color.action_light); Helper.changeDrawableColor(context, R.drawable.ic_pin_drop, R.color.action_light); + holder.status_reply_count.setTextColor(ContextCompat.getColor(context, R.color.action_light)); holder.status_favorite_count.setTextColor(ContextCompat.getColor(context, R.color.action_light)); holder.status_reblog_count.setTextColor(ContextCompat.getColor(context, R.color.action_light)); - holder.status_reply.setTextColor(ContextCompat.getColor(context, R.color.action_light)); holder.status_cardview.setBackgroundResource(R.drawable.card_border_light); Helper.changeDrawableColor(context, R.drawable.ic_photo, R.color.mastodonC4); @@ -1540,7 +1543,25 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct holder.status_mention_spoiler.setText(Helper.makeMentionsClick(context, status.getMentions()), TextView.BufferType.SPANNABLE); holder.status_mention_spoiler.setMovementMethod(LinkMovementMethod.getInstance()); + if ((isCompactMode || isConsoleMode) && ((status.getReblog() == null && status.getReplies_count() > 1) || (status.getReblog() != null && status.getReblog().getReplies_count() > 1))) { + Drawable img = context.getResources().getDrawable(R.drawable.ic_plus_one); + holder.status_reply_count.setCompoundDrawablesWithIntrinsicBounds(null, null, img, null); + } + if (getItemViewType(viewHolder.getAdapterPosition()) != COMPACT_STATUS && getItemViewType(viewHolder.getAdapterPosition()) != CONSOLE_STATUS) { + if (status.getReblog() == null) { + if (status.getReplies_count() > 0) + holder.status_reply_count.setText(String.valueOf(status.getReplies_count())); + else + holder.status_reply_count.setText(""); + } + else { + if (status.getReblog().getReplies_count() > 0) + holder.status_reply_count.setText(String.valueOf(status.getReblog().getReplies_count())); + else + holder.status_reply_count.setText(""); + } + if (status.getReblog() == null) { if (status.getFavourites_count() > 0) holder.status_favorite_count.setText(String.valueOf(status.getFavourites_count())); @@ -1908,7 +1929,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct break; } - Drawable imgReply; if (!status.isFavAnimated()) { if (status.isFavourited() || (status.getReblog() != null && status.getReblog().isFavourited())) { @@ -1941,26 +1961,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct Helper.changeDrawableColor(context, R.drawable.ic_reply, R.color.action_black); else Helper.changeDrawableColor(context, R.drawable.ic_reply, R.color.action_light); - imgReply = ContextCompat.getDrawable(context, R.drawable.ic_reply); - - - assert imgReply != null; - imgReply.setBounds(0, 0, (int) (20 * iconSizePercent / 100 * scale + 0.5f), (int) (20 * iconSizePercent / 100 * scale + 0.5f)); - - - if ((isCompactMode || isConsoleMode) && ((status.getReblog() == null && status.getReplies_count() > 1) || (status.getReblog() != null && status.getReblog().getReplies_count() > 1))) { - Drawable img = context.getResources().getDrawable(R.drawable.ic_plus_one); - holder.status_reply.setCompoundDrawablesWithIntrinsicBounds(imgReply, null, img, null); - } else { - holder.status_reply.setCompoundDrawablesWithIntrinsicBounds(imgReply, null, null, null); - } - if ((isCompactMode || isConsoleMode) ) { - if (((status.getReblog() == null && status.getReplies_count() == 1) || (status.getReblog() != null && status.getReblog().getReplies_count() == 1))) - holder.status_reply.setText(String.valueOf(status.getReblog() != null ? status.getReblog().getReplies_count() : status.getReplies_count())); - } else { - if (status.getReplies_count() > 0 || (status.getReblog() != null && status.getReblog().getReplies_count() > 0)) - holder.status_reply.setText(String.valueOf(status.getReblog() != null ? status.getReblog().getReplies_count() : status.getReplies_count())); - } boolean isOwner = status.getAccount().getId().equals(userId); diff --git a/app/src/main/res/layout/drawer_notification.xml b/app/src/main/res/layout/drawer_notification.xml index 6cebc1c31..12ceb77ed 100644 --- a/app/src/main/res/layout/drawer_notification.xml +++ b/app/src/main/res/layout/drawer_notification.xml @@ -294,23 +294,31 @@ android:padding="@dimen/drawer_padding" android:visibility="gone"> - + + - + + @@ -889,7 +894,6 @@ android:layout_width="30dp" android:layout_height="30dp" android:layout_marginStart="15dp" - android:layout_marginLeft="15dp" android:contentDescription="@string/favourite" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/status_reblog_count" @@ -902,9 +906,6 @@ android:id="@+id/status_favorite_count" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:drawablePadding="2dp" - android:gravity="center_vertical" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/spark_button_fav" app:layout_constraintTop_toTopOf="parent" /> @@ -914,7 +915,6 @@ android:layout_width="20dp" android:layout_height="20dp" android:layout_marginStart="15dp" - android:layout_marginLeft="15dp" android:contentDescription="@string/pin_add" android:src="@drawable/ic_pin_drop" app:layout_constraintBottom_toBottomOf="parent" @@ -926,7 +926,6 @@ android:layout_width="25dp" android:layout_height="25dp" android:layout_marginEnd="15dp" - android:layout_marginRight="15dp" android:contentDescription="@string/toot_visibility_tilte" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@id/status_more" diff --git a/app/src/main/res/layout/drawer_status_compact.xml b/app/src/main/res/layout/drawer_status_compact.xml index 64d963d99..79d89b9d9 100644 --- a/app/src/main/res/layout/drawer_status_compact.xml +++ b/app/src/main/res/layout/drawer_status_compact.xml @@ -708,17 +708,24 @@ android:layout_height="wrap_content" android:layout_marginBottom="10dp"> - + + @@ -762,9 +767,7 @@ android:id="@+id/status_favorite_count" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="center_vertical" android:drawablePadding="2dp" - android:gravity="center_vertical" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/spark_button_fav" app:layout_constraintTop_toTopOf="parent" /> @@ -788,12 +791,10 @@ android:id="@+id/status_remove" android:layout_width="20dp" android:layout_height="20dp" - android:layout_gravity="center_horizontal" android:layout_marginStart="15dp" android:layout_marginLeft="15dp" android:layout_marginTop="5dp" android:contentDescription="@string/delete" - android:gravity="center" android:src="@drawable/ic_clear_toot" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" @@ -804,7 +805,6 @@ android:id="@+id/status_pin" android:layout_width="20dp" android:layout_height="20dp" - android:layout_gravity="center_vertical" android:layout_marginStart="15dp" android:layout_marginLeft="15dp" android:contentDescription="@string/pin_add" @@ -817,7 +817,6 @@ android:id="@+id/status_privacy" android:layout_width="25dp" android:layout_height="25dp" - android:layout_gravity="center_vertical" android:layout_marginEnd="15dp" android:layout_marginRight="15dp" android:contentDescription="@string/toot_visibility_tilte" diff --git a/app/src/main/res/layout/drawer_status_console.xml b/app/src/main/res/layout/drawer_status_console.xml index 9d94c33f2..850ab9036 100644 --- a/app/src/main/res/layout/drawer_status_console.xml +++ b/app/src/main/res/layout/drawer_status_console.xml @@ -716,18 +716,23 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> - + + @@ -760,7 +762,6 @@ android:layout_width="30dp" android:layout_height="30dp" android:layout_marginStart="15dp" - android:layout_marginLeft="15dp" android:contentDescription="@string/favourite" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/status_reblog_count" @@ -773,9 +774,7 @@ android:id="@+id/status_favorite_count" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="center_vertical" android:drawablePadding="2dp" - android:gravity="center_vertical" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/spark_button_fav" app:layout_constraintTop_toTopOf="parent" /> @@ -784,12 +783,9 @@ android:id="@+id/status_remove" android:layout_width="20dp" android:layout_height="20dp" - android:layout_gravity="center_horizontal" android:layout_marginStart="15dp" - android:layout_marginLeft="15dp" android:layout_marginTop="5dp" android:contentDescription="@string/delete" - android:gravity="center" android:src="@drawable/ic_clear_toot" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" @@ -800,9 +796,7 @@ android:id="@+id/status_pin" android:layout_width="20dp" android:layout_height="20dp" - android:layout_gravity="center_vertical" android:layout_marginStart="15dp" - android:layout_marginLeft="15dp" android:contentDescription="@string/pin_add" android:src="@drawable/ic_pin_drop" app:layout_constraintBottom_toBottomOf="parent" @@ -814,7 +808,6 @@ android:layout_width="25dp" android:layout_height="25dp" android:layout_marginEnd="15dp" - android:layout_marginRight="15dp" android:contentDescription="@string/toot_visibility_tilte" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@id/status_more" diff --git a/app/src/main/res/layout/drawer_status_focused.xml b/app/src/main/res/layout/drawer_status_focused.xml index 5a39426e3..525e404ef 100644 --- a/app/src/main/res/layout/drawer_status_focused.xml +++ b/app/src/main/res/layout/drawer_status_focused.xml @@ -643,15 +643,24 @@ android:layout_height="wrap_content" android:layout_marginBottom="10dp"> - + +