(#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
This commit is contained in:
torrentcome 2017-08-30 14:22:12 +02:00
parent 67f3ce6e4e
commit 87de285fe8
5 changed files with 42 additions and 1 deletions

View File

@ -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,

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFF"
android:pathData="M12,4.5C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5zM12,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z"/>
</vector>

View File

@ -250,6 +250,16 @@
android:contentDescription="@null"
android:visibility="gone" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/status_sensitive_media_button"
app:srcCompat="@drawable/ic_remove_red_eye_black_24dp"
android:alpha="0.7"
android:layout_alignParentTop="true"
android:contentDescription="@null"
android:padding="@dimen/status_sensitive_media_button_padding"
android:visibility="gone" />
</RelativeLayout>
<LinearLayout

View File

@ -189,6 +189,16 @@
android:contentDescription="@null"
android:visibility="gone" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/status_sensitive_media_button"
app:srcCompat="@drawable/ic_remove_red_eye_black_24dp"
android:alpha="0.7"
android:layout_alignParentTop="true"
android:contentDescription="@null"
android:padding="@dimen/status_sensitive_media_button_padding"
android:visibility="gone" />
</RelativeLayout>
<LinearLayout

View File

@ -20,4 +20,5 @@
<dimen name="tab_page_margin">8dp</dimen>
<dimen name="status_left_line_margin">38dp</dimen>
<dimen name="text_content_margin">16dp</dimen>
<dimen name="status_sensitive_media_button_padding">5dp</dimen>
</resources>