From 87de285fe8ab4a1fe167ebc4d06ef86e60214f65 Mon Sep 17 00:00:00 2001 From: torrentcome Date: Wed, 30 Aug 2017 14:22:12 +0200 Subject: [PATCH] (#377) hide sensitive images after showing them -The web client overlays a small eye button over sensitive images after they've been shown that re-hides them --- .../tusky/adapter/StatusBaseViewHolder.java | 13 ++++++++++++- .../res/drawable/ic_remove_red_eye_black_24dp.xml | 9 +++++++++ app/src/main/res/layout/item_status.xml | 10 ++++++++++ app/src/main/res/layout/item_status_detailed.xml | 10 ++++++++++ app/src/main/res/values/dimens.xml | 1 + 5 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/drawable/ic_remove_red_eye_black_24dp.xml diff --git a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java index 279773a4..e40a77ed 100644 --- a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java +++ b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java @@ -46,6 +46,7 @@ class StatusBaseViewHolder extends RecyclerView.ViewHolder { private ImageView mediaPreview2; private ImageView mediaPreview3; private View sensitiveMediaWarning; + private View sensitiveMediaShow; private View videoIndicator; private TextView mediaLabel; private View contentWarningBar; @@ -74,6 +75,7 @@ class StatusBaseViewHolder extends RecyclerView.ViewHolder { mediaPreview2 = (ImageView) itemView.findViewById(R.id.status_media_preview_2); mediaPreview3 = (ImageView) itemView.findViewById(R.id.status_media_preview_3); sensitiveMediaWarning = itemView.findViewById(R.id.status_sensitive_media_warning); + sensitiveMediaShow = itemView.findViewById(R.id.status_sensitive_media_button); videoIndicator = itemView.findViewById(R.id.status_video_indicator); mediaLabel = (TextView) itemView.findViewById(R.id.status_media_label); contentWarningBar = itemView.findViewById(R.id.status_content_warning_bar); @@ -229,6 +231,14 @@ class StatusBaseViewHolder extends RecyclerView.ViewHolder { if (sensitive) { sensitiveMediaWarning.setVisibility(showingSensitive ? View.GONE : View.VISIBLE); + sensitiveMediaShow.setVisibility(showingSensitive ? View.VISIBLE : View.GONE); + sensitiveMediaShow.setOnClickListener(new View.OnClickListener(){ + @Override + public void onClick(View v) { + v.setVisibility(View.GONE); + sensitiveMediaWarning.setVisibility(View.VISIBLE); + } + }); sensitiveMediaWarning.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -236,7 +246,7 @@ class StatusBaseViewHolder extends RecyclerView.ViewHolder { listener.onContentHiddenChange(true, getAdapterPosition()); } v.setVisibility(View.GONE); - v.setOnClickListener(null); + sensitiveMediaShow.setVisibility(View.VISIBLE); } }); } @@ -311,6 +321,7 @@ class StatusBaseViewHolder extends RecyclerView.ViewHolder { private void hideSensitiveMediaWarning() { sensitiveMediaWarning.setVisibility(View.GONE); + sensitiveMediaShow.setVisibility(View.GONE); } private void setSpoilerText(String spoilerText, final boolean expanded, diff --git a/app/src/main/res/drawable/ic_remove_red_eye_black_24dp.xml b/app/src/main/res/drawable/ic_remove_red_eye_black_24dp.xml new file mode 100644 index 00000000..e58240d2 --- /dev/null +++ b/app/src/main/res/drawable/ic_remove_red_eye_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/item_status.xml b/app/src/main/res/layout/item_status.xml index ad8c21f7..0022cb11 100644 --- a/app/src/main/res/layout/item_status.xml +++ b/app/src/main/res/layout/item_status.xml @@ -250,6 +250,16 @@ android:contentDescription="@null" android:visibility="gone" /> + + 8dp 38dp 16dp + 5dp