Merge pull request #386 from lenchan139/master

add option: always show all sensitive content without warning
This commit is contained in:
Konrad Pozniak 2017-10-17 09:44:19 +02:00 committed by GitHub
commit 1297a35e9b
4 changed files with 10 additions and 3 deletions

View File

@ -1,6 +1,7 @@
package com.keylesspalace.tusky.adapter; package com.keylesspalace.tusky.adapter;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.annotation.DrawableRes; import android.support.annotation.DrawableRes;
@ -225,8 +226,9 @@ class StatusBaseViewHolder extends RecyclerView.ViewHolder {
}); });
} }
} }
SharedPreferences pm = PreferenceManager.getDefaultSharedPreferences(context);
if (sensitive) { Boolean isAlwayShowSensitive = pm.getBoolean("alwayShowSensitiveMedia",false);
if (sensitive && (!isAlwayShowSensitive)) {
sensitiveMediaWarning.setVisibility(showingSensitive ? View.GONE : View.VISIBLE); sensitiveMediaWarning.setVisibility(showingSensitive ? View.GONE : View.VISIBLE);
sensitiveMediaWarning.setOnClickListener(new View.OnClickListener() { sensitiveMediaWarning.setOnClickListener(new View.OnClickListener() {
@Override @Override

View File

@ -270,7 +270,6 @@ public class TimelineFragment extends SFragment implements
if (status.reblog != null) { if (status.reblog != null) {
status.reblog.reblogged = reblog; status.reblog.reblogged = reblog;
} }
StatusViewData newViewData = StatusViewData newViewData =
new StatusViewData.Builder(statuses.getPairedItem(position)) new StatusViewData.Builder(statuses.getPairedItem(position))
.setReblogged(reblog) .setReblogged(reblog)

View File

@ -217,6 +217,7 @@
<string name="abbreviated_seconds_ago">%ds</string> <string name="abbreviated_seconds_ago">%ds</string>
<string name="follows_you">Follows you</string> <string name="follows_you">Follows you</string>
<string name="pref_title_alway_show_sensitive_media">Always show all nsfw content</string>
</resources> </resources>

View File

@ -19,6 +19,11 @@
android:title="@string/pref_title_show_media_preview" android:title="@string/pref_title_show_media_preview"
android:defaultValue="true" /> android:defaultValue="true" />
<CheckBoxPreference
android:key="alwayShowSensitiveMedia"
android:title="@string/pref_title_alway_show_sensitive_media"
android:defaultValue="false" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/pref_title_browser_settings"> <PreferenceCategory android:title="@string/pref_title_browser_settings">
<CheckBoxPreference <CheckBoxPreference