From c0a5e55f47e6c366d9ca4faf94f3e1fb7f0bffff Mon Sep 17 00:00:00 2001 From: Len Chan Date: Tue, 19 Sep 2017 23:19:18 +0800 Subject: [PATCH] add option: always show all sensitive content without warning --- .../keylesspalace/tusky/adapter/StatusBaseViewHolder.java | 6 ++++-- .../com/keylesspalace/tusky/fragment/TimelineFragment.java | 1 - app/src/main/res/values/strings.xml | 1 + app/src/main/res/xml/preferences.xml | 5 +++++ 4 files changed, 10 insertions(+), 3 deletions(-) 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 279773a40..cc5160ff4 100644 --- a/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java +++ b/app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java @@ -1,6 +1,7 @@ package com.keylesspalace.tusky.adapter; import android.content.Context; +import android.content.SharedPreferences; import android.graphics.drawable.Drawable; import android.preference.PreferenceManager; import android.support.annotation.DrawableRes; @@ -226,8 +227,9 @@ class StatusBaseViewHolder extends RecyclerView.ViewHolder { }); } } - - if (sensitive) { + SharedPreferences pm = PreferenceManager.getDefaultSharedPreferences(context); + Boolean isAlwayShowSensitive = pm.getBoolean("alwayShowSensitiveMedia",false); + if (sensitive && (!isAlwayShowSensitive)) { sensitiveMediaWarning.setVisibility(showingSensitive ? View.GONE : View.VISIBLE); sensitiveMediaWarning.setOnClickListener(new View.OnClickListener() { @Override diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java b/app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java index 103f7e81d..723fa0ef8 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java @@ -270,7 +270,6 @@ public class TimelineFragment extends SFragment implements if (status.reblog != null) { status.reblog.reblogged = reblog; } - StatusViewData newViewData = new StatusViewData.Builder(statuses.getPairedItem(position)) .setReblogged(reblog) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7a8251a61..57453fedb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -213,6 +213,7 @@ %ds Follows you + Always show all nsfw content diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 4d618c617..ab655157f 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -19,6 +19,11 @@ android:title="@string/pref_title_show_media_preview" android:defaultValue="true" /> + +