Permalink
Browse files

Hide visited posts option (#612)

Added behavior preference to not load/display visited posts.

In reference to issue #558
  • Loading branch information...
asoback authored and QuantumBadger committed Sep 11, 2018
1 parent eb1d4d6 commit a8d92d22bea25a22377007d240c8f47db67699b5
View
@@ -4,7 +4,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
classpath 'com.android.tools.build:gradle:3.1.4'
}
}
@@ -536,6 +536,11 @@ public static boolean pref_behaviour_nsfw(final Context context, final SharedPre
return getBoolean(R.string.pref_behaviour_nsfw_key, false, context, sharedPreferences);
}
//Show Visited Posts? False hides them. See strings.xml, prefs_behaviour.xml, PostListingFragment.java
public static boolean pref_behaviour_show_visited(final Context context, final SharedPreferences sharedPreferences) {
return getBoolean(R.string.pref_behaviour_show_read_posts_key, true, context, sharedPreferences);
}
public static boolean pref_behaviour_share_permalink(final Context context, final SharedPreferences sharedPreferences) {
return getBoolean(R.string.pref_behaviour_share_permalink_key, false, context, sharedPreferences);
}
@@ -626,6 +626,7 @@ public void run() {
final JsonBufferedArray posts = listing.getArray("children");
final boolean isNsfwAllowed = PrefsUtility.pref_behaviour_nsfw(activity, mSharedPreferences);
final boolean showVisited = PrefsUtility.pref_behaviour_show_visited(activity, mSharedPreferences);
final boolean isConnectionWifi = General.isConnectionWifi(activity);
final PrefsUtility.AppearanceThumbnailsShow thumbnailsPref = PrefsUtility.appearance_thumbnails_show(
@@ -711,6 +712,9 @@ public void run() {
showSubredditName,
downloadThisThumbnail);
// Skip adding this post (go to next iteration) if it has been clicked on AND user preference "showVisited" is false
if (preparedPost.isRead() && !showVisited) continue;
if(precacheComments) {
final CommentListingController controller = new CommentListingController(
@@ -93,6 +93,9 @@
<string name="pref_behaviour_nsfw_key" translatable="false">pref_behaviour_nsfw</string>
<string name="pref_behaviour_nsfw_title">Show NSFW content</string>
<string name="pref_behaviour_show_read_posts_key" translatable="false">pref_behaviour_read_posts</string>
<string name="pref_behaviour_show_read_posts_title">Show Visited Posts</string>
<!-- Cache Prefs -->
<string name="pref_cache_pruning">Cache Pruning</string>
@@ -164,6 +164,10 @@
android:key="@string/pref_behaviour_nsfw_key"
android:defaultValue="false"/>
<CheckBoxPreference android:title="@string/pref_behaviour_show_read_posts_title"
android:key="@string/pref_behaviour_show_read_posts_key"
android:defaultValue="true"/>
<ListPreference android:title="@string/pref_behaviour_postcount_title"
android:key="@string/pref_behaviour_postcount_key"
android:entries="@array/pref_behaviour_postcount_items"

0 comments on commit a8d92d2

Please sign in to comment.