add option: always show all sensitive content without warning

This commit is contained in:
Len Chan 2017-09-19 23:19:18 +08:00
parent 67f3ce6e4e
commit c0a5e55f47
4 changed files with 10 additions and 3 deletions

View File

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

View File

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

View File

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

View File

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