From 0e830b99f4f2add1dda6ef132e0a3c76330af3a4 Mon Sep 17 00:00:00 2001 From: tom79 Date: Sun, 12 May 2019 18:06:33 +0200 Subject: [PATCH] Add a bot icon --- .../mastodon/drawers/StatusListAdapter.java | 17 ++++++++- app/src/main/res/drawable/ic_bot.xml | 37 +++++++++++++++++++ app/src/main/res/layout/drawer_status.xml | 10 +++++ .../main/res/layout/drawer_status_compact.xml | 10 +++++ .../main/res/layout/drawer_status_console.xml | 10 +++++ .../main/res/layout/drawer_status_focused.xml | 10 +++++ 6 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/drawable/ic_bot.xml diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java index aaaa578e6..facaec09a 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java @@ -366,7 +366,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct LinearLayout status_peertube_container; TextView status_peertube_reply, status_peertube_delete, show_more_content; - ImageView cached_status; + ImageView cached_status, status_account_bot; //Poll LinearLayout poll_container, single_choice, multiple_choice, rated; @@ -474,6 +474,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct submit_vote = itemView.findViewById(R.id.submit_vote); refresh_poll = itemView.findViewById(R.id.refresh_poll); cached_status = itemView.findViewById(R.id.cached_status); + status_account_bot = itemView.findViewById(R.id.status_account_bot); } } @@ -539,6 +540,20 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct } status.setItemViewType(viewHolder.getItemViewType()); + if( status.getReblog() == null){ + if( status.getAccount().isBot()){ + holder.status_account_bot.setVisibility(View.VISIBLE); + }else { + holder.status_account_bot.setVisibility(View.GONE); + } + }else{ + if( status.getReblog().getAccount().isBot()){ + holder.status_account_bot.setVisibility(View.VISIBLE); + }else { + holder.status_account_bot.setVisibility(View.GONE); + } + } + boolean displayBookmarkButton = sharedpreferences.getBoolean(Helper.SET_SHOW_BOOKMARK, false); boolean fullAttachement = sharedpreferences.getBoolean(Helper.SET_FULL_PREVIEW, false); boolean isCompactMode = sharedpreferences.getBoolean(Helper.SET_COMPACT_MODE, false); diff --git a/app/src/main/res/drawable/ic_bot.xml b/app/src/main/res/drawable/ic_bot.xml new file mode 100644 index 000000000..16419d19d --- /dev/null +++ b/app/src/main/res/drawable/ic_bot.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/drawer_status.xml b/app/src/main/res/layout/drawer_status.xml index 312f11ad6..0a78a86e4 100644 --- a/app/src/main/res/layout/drawer_status.xml +++ b/app/src/main/res/layout/drawer_status.xml @@ -38,6 +38,16 @@ android:layout_height="wrap_content" android:layout_width="match_parent" > + + + +