add option: always show all sensitive content without warning

main
Len Chan 7 years ago
parent d3e7126ff0
commit f48f6230a2
  1. 6
      app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java
  2. 1
      app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java
  3. 1
      app/src/main/res/values/strings.xml
  4. 5
      app/src/main/res/xml/preferences.xml

@ -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;
@ -226,8 +227,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

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

@ -213,6 +213,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>

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

Loading…
Cancel
Save