Add a new option category: Post Filter. Marking posts as read is disabled by default. Marking posts as read after voting is now available.

This commit is contained in:
Alex Ning 2020-12-23 17:03:41 +08:00
parent c88ceb737b
commit 6a8f27f947
15 changed files with 290 additions and 20 deletions

View File

@ -98,6 +98,8 @@ dependencies {
implementation 'androidx.biometric:biometric:1.1.0-rc01'
implementation 'com.airbnb.android:lottie:3.4.4'
implementation 'com.melegy.redscreenofdeath:red-screen-of-death:0.1.2'
// debugImplementation because LeakCanary should only run in debug builds.
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.5'
def toroVersion = '3.7.0.2010003'
implementation "im.ene.toro3:toro:$toroVersion"

View File

@ -73,6 +73,7 @@ import ml.docilealligator.infinityforreddit.settings.MainPreferenceFragment;
import ml.docilealligator.infinityforreddit.settings.MiscellaneousPreferenceFragment;
import ml.docilealligator.infinityforreddit.settings.NotificationPreferenceFragment;
import ml.docilealligator.infinityforreddit.settings.NsfwAndBlurringFragment;
import ml.docilealligator.infinityforreddit.settings.PostHistoryFragment;
import ml.docilealligator.infinityforreddit.settings.SecurityPreferenceFragment;
import ml.docilealligator.infinityforreddit.settings.ThemePreferenceFragment;
import ml.docilealligator.infinityforreddit.settings.TranslationFragment;
@ -230,4 +231,6 @@ public interface AppComponent {
void inject(SubredditFilterPopularAndAllActivity subredditFilterPopularAndAllActivity);
void inject(CustomizePostFilterActivity customizePostFilterActivity);
void inject(PostHistoryFragment postHistoryFragment);
}

View File

@ -222,6 +222,12 @@ class AppModule {
return mApplication.getSharedPreferences(SharedPreferencesUtils.BOTTOM_APP_BAR_SHARED_PREFERENCES_FILE, Context.MODE_PRIVATE);
}
@Provides
@Named("post_history")
SharedPreferences providePostHistorySharedPreferences() {
return mApplication.getSharedPreferences(SharedPreferencesUtils.POST_HISTORY_SHARED_PREFERENCES_FILE, Context.MODE_PRIVATE);
}
@Provides
@Singleton
CustomThemeWrapper provideCustomThemeWrapper(@Named("light_theme") SharedPreferences lightThemeSharedPreferences,

View File

@ -35,6 +35,7 @@ import ml.docilealligator.infinityforreddit.settings.GesturesAndButtonsPreferenc
import ml.docilealligator.infinityforreddit.settings.InterfacePreferenceFragment;
import ml.docilealligator.infinityforreddit.settings.MainPreferenceFragment;
import ml.docilealligator.infinityforreddit.settings.NsfwAndBlurringFragment;
import ml.docilealligator.infinityforreddit.settings.PostHistoryFragment;
public class SettingsActivity extends BaseActivity implements
PreferenceFragmentCompat.OnPreferenceStartFragmentCallback {
@ -168,6 +169,8 @@ public class SettingsActivity extends BaseActivity implements
args.putString(NsfwAndBlurringFragment.EXTRA_ACCOUNT_NAME, mAccountName);
} else if (fragment instanceof CustomizeBottomAppBarFragment) {
args.putString(CustomizeBottomAppBarFragment.EXTRA_ACCOUNT_NAME, mAccountName);
} else if (fragment instanceof PostHistoryFragment) {
args.putString(PostHistoryFragment.EXTRA_ACCOUNT_NAME, mAccountName);
}
fragment.setArguments(args);
fragment.setTargetFragment(caller, 0);

View File

@ -194,6 +194,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
private boolean mCompactLayoutToolbarHiddenByDefault;
private boolean mDataSavingMode = false;
private boolean mDisableImagePreview = false;
private boolean mMarkPostsAsRead;
private boolean mMarkPostsAsReadAfterVoting;
private Drawable mCommentIcon;
private NetworkState networkState;
private ExoCreator mExoCreator;
@ -205,6 +207,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
CustomThemeWrapper customThemeWrapper, Locale locale, int imageViewWidth,
String accessToken, String accountName, int postType, int postLayout, boolean displaySubredditName,
SharedPreferences sharedPreferences, SharedPreferences nsfwAndSpoilerSharedPreferences,
SharedPreferences postHistorySharedPreferences,
ExoCreator exoCreator, Callback callback) {
super(DIFF_CALLBACK);
if (activity != null) {
@ -255,6 +258,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
mDisableImagePreview = sharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_IMAGE_PREVIEW, false);
mMarkPostsAsRead = postHistorySharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.MARK_POSTS_AS_READ_BASE, false);
mMarkPostsAsReadAfterVoting = postHistorySharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.MARK_POSTS_AS_READ_AFTER_VOTING_BASE, false);
mPostLayout = postLayout;
mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme();
@ -1697,6 +1703,10 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
return;
}
if (mMarkPostsAsReadAfterVoting) {
markPostRead(post);
}
if (post.isArchived()) {
Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show();
return;
@ -1783,6 +1793,10 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
return;
}
if (mMarkPostsAsReadAfterVoting) {
markPostRead(post);
}
if (post.isArchived()) {
Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show();
return;
@ -2747,6 +2761,10 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
Post post = getItem(position);
if (post != null) {
if (mMarkPostsAsReadAfterVoting) {
markPostRead(post);
}
if (post.isArchived()) {
Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show();
return;
@ -2833,6 +2851,10 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
Post post = getItem(position);
if (post != null) {
if (mMarkPostsAsReadAfterVoting) {
markPostRead(post);
}
if (post.isArchived()) {
Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show();
return;

View File

@ -58,6 +58,7 @@ import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import im.ene.toro.exoplayer.ExoCreator;
import im.ene.toro.media.PlaybackInfo;
import im.ene.toro.media.VolumeInfo;
@ -178,6 +179,9 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
@Named("nsfw_and_spoiler")
SharedPreferences mNsfwAndSpoilerSharedPreferences;
@Inject
@Named("post_history")
SharedPreferences mPostHistorySharedPreferences;
@Inject
CustomThemeWrapper customThemeWrapper;
@Inject
ExoCreator exoCreator;
@ -222,6 +226,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
private ItemTouchHelper touchHelper;
private ArrayList<SubredditFilter> subredditFilterList;
private ArrayList<ReadPost> readPosts;
private Unbinder unbinder;
public PostFragment() {
// Required empty public constructor
@ -275,7 +280,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
((Infinity) activity.getApplication()).getAppComponent().inject(this);
ButterKnife.bind(this, rootView);
unbinder = ButterKnife.bind(this, rootView);
EventBus.getDefault().register(this);
@ -469,7 +474,8 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mGfycatRetrofit,
mRedgifsRetrofit, mRedditDataRoomDatabase, customThemeWrapper, locale,
windowWidth, accessToken, accountName, postType, postLayout, true,
mSharedPreferences, mNsfwAndSpoilerSharedPreferences, exoCreator, new PostRecyclerViewAdapter.Callback() {
mSharedPreferences, mNsfwAndSpoilerSharedPreferences, mPostHistorySharedPreferences,
exoCreator, new PostRecyclerViewAdapter.Callback() {
@Override
public void retryLoadingMore() {
mPostViewModel.retryLoadingMore();
@ -513,13 +519,13 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
String sortTime = null;
sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SUBREDDIT_POST_BASE + subredditName, SortType.Type.HOT.name());
if(sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
if (sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_SUBREDDIT_POST_BASE + subredditName, SortType.Time.ALL.name());
}
boolean displaySubredditName = subredditName != null && (subredditName.equals("popular") || subredditName.equals("all"));
postLayout = mPostLayoutSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_SUBREDDIT_POST_BASE + subredditName, defaultPostLayout);
if(sortTime != null) {
if (sortTime != null) {
sortType = new SortType(SortType.Type.valueOf(sort), SortType.Time.valueOf(sortTime));
} else {
sortType = new SortType(SortType.Type.valueOf(sort));
@ -528,7 +534,8 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mGfycatRetrofit,
mRedgifsRetrofit, mRedditDataRoomDatabase, customThemeWrapper, locale,
windowWidth, accessToken, accountName, postType, postLayout, displaySubredditName,
mSharedPreferences, mNsfwAndSpoilerSharedPreferences, exoCreator, new PostRecyclerViewAdapter.Callback() {
mSharedPreferences, mNsfwAndSpoilerSharedPreferences, mPostHistorySharedPreferences,
exoCreator, new PostRecyclerViewAdapter.Callback() {
@Override
public void retryLoadingMore() {
mPostViewModel.retryLoadingMore();
@ -564,21 +571,21 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
TransitionManager.beginDelayedTransition(mPostRecyclerView, new AutoTransition());
}
});
} else if(postType == PostDataSource.TYPE_MULTI_REDDIT) {
} else if (postType == PostDataSource.TYPE_MULTI_REDDIT) {
multiRedditPath = getArguments().getString(EXTRA_NAME);
String sort;
String sortTime = null;
sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_MULTI_REDDIT_POST_BASE + multiRedditPath,
SortType.Type.HOT.name());
if(sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
if (sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_MULTI_REDDIT_POST_BASE + multiRedditPath,
SortType.Time.ALL.name());
}
postLayout = mPostLayoutSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_MULTI_REDDIT_POST_BASE + multiRedditPath,
defaultPostLayout);
if(sortTime != null) {
if (sortTime != null) {
sortType = new SortType(SortType.Type.valueOf(sort), SortType.Time.valueOf(sortTime));
} else {
sortType = new SortType(SortType.Type.valueOf(sort));
@ -587,7 +594,8 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mGfycatRetrofit,
mRedgifsRetrofit, mRedditDataRoomDatabase, customThemeWrapper, locale,
windowWidth, accessToken, accountName, postType, postLayout, true,
mSharedPreferences, mNsfwAndSpoilerSharedPreferences, exoCreator, new PostRecyclerViewAdapter.Callback() {
mSharedPreferences, mNsfwAndSpoilerSharedPreferences, mPostHistorySharedPreferences,
exoCreator, new PostRecyclerViewAdapter.Callback() {
@Override
public void retryLoadingMore() {
mPostViewModel.retryLoadingMore();
@ -633,7 +641,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
}
String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_USER_POST_BASE + username, SortType.Type.NEW.name());
if(sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
if (sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
String sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_USER_POST_BASE + username, SortType.Time.ALL.name());
sortType = new SortType(SortType.Type.valueOf(sort), SortType.Time.valueOf(sortTime));
} else {
@ -644,7 +652,8 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mGfycatRetrofit,
mRedgifsRetrofit, mRedditDataRoomDatabase, customThemeWrapper, locale,
windowWidth, accessToken, accountName, postType, postLayout, true,
mSharedPreferences, mNsfwAndSpoilerSharedPreferences, exoCreator, new PostRecyclerViewAdapter.Callback() {
mSharedPreferences, mNsfwAndSpoilerSharedPreferences, mPostHistorySharedPreferences,
exoCreator, new PostRecyclerViewAdapter.Callback() {
@Override
public void retryLoadingMore() {
mPostViewModel.retryLoadingMore();
@ -684,7 +693,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
});
} else {
String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_BEST_POST, SortType.Type.BEST.name());
if(sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
if (sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
String sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_BEST_POST, SortType.Time.ALL.name());
sortType = new SortType(SortType.Type.valueOf(sort), SortType.Time.valueOf(sortTime));
} else {
@ -695,7 +704,8 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mGfycatRetrofit,
mRedgifsRetrofit, mRedditDataRoomDatabase, customThemeWrapper, locale,
windowWidth, accessToken, accountName, postType, postLayout, true,
mSharedPreferences, mNsfwAndSpoilerSharedPreferences, exoCreator, new PostRecyclerViewAdapter.Callback() {
mSharedPreferences, mNsfwAndSpoilerSharedPreferences, mPostHistorySharedPreferences,
exoCreator, new PostRecyclerViewAdapter.Callback() {
@Override
public void retryLoadingMore() {
mPostViewModel.retryLoadingMore();
@ -740,7 +750,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
}
if (accountName != null && !accountName.equals("")) {
if (readPosts == null) {
if (mPostHistorySharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.MARK_POSTS_AS_READ_BASE, false) && readPosts == null) {
if (getArguments().getBoolean(EXTRA_DISABLE_READ_POSTS, false)) {
initializeAndBindPostViewModel(accessToken);
} else {
@ -1011,13 +1021,13 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
break;
case PostDataSource.TYPE_USER:
mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_USER_POST_BASE + username, sortType.getType().name()).apply();
if(sortType.getTime() != null) {
if (sortType.getTime() != null) {
mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TIME_USER_POST_BASE + username, sortType.getTime().name()).apply();
}
break;
case PostDataSource.TYPE_SEARCH:
mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_SEARCH_POST, sortType.getType().name()).apply();
if(sortType.getTime() != null) {
if (sortType.getTime() != null) {
mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TIME_SEARCH_POST, sortType.getTime().name()).apply();
}
break;
@ -1279,7 +1289,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
intent.putExtra(FilteredPostsActivity.EXTRA_NAME, subredditName);
intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, postType);
startActivity(intent);
} else if(postType == PostDataSource.TYPE_MULTI_REDDIT) {
} else if (postType == PostDataSource.TYPE_MULTI_REDDIT) {
Intent intent = new Intent(activity, FilteredPostsActivity.class);
intent.putExtra(FilteredPostsActivity.EXTRA_NAME, multiRedditPath);
intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, postType);
@ -1616,6 +1626,12 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
}
}
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
}
@Override
public void onDestroy() {
EventBus.getDefault().unregister(this);

View File

@ -27,7 +27,9 @@ public class InsertReadPost {
if (readPostDao.getReadPostsCount() > 500) {
readPostDao.deleteOldestReadPosts(username);
}
readPostDao.insert(new ReadPost(username, postId));
if (username != null && !username.equals("")) {
readPostDao.insert(new ReadPost(username, postId));
}
return null;
}
}

View File

@ -0,0 +1,98 @@
package ml.docilealligator.infinityforreddit.settings;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import com.google.android.material.switchmaterial.SwitchMaterial;
import javax.inject.Inject;
import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
public class PostHistoryFragment extends Fragment {
public static final String EXTRA_ACCOUNT_NAME = "EAN";
@BindView(R.id.info_text_view_post_history_fragment)
TextView infoTextView;
@BindView(R.id.mark_posts_as_read_linear_layout_post_history_fragment)
LinearLayout markPostsAsReadLinearLayout;
@BindView(R.id.mark_posts_as_read_switch_post_history_fragment)
SwitchMaterial markPostsAsReadSwitch;
@BindView(R.id.mark_posts_as_read_after_voting_linear_layout_post_history_fragment)
LinearLayout markPostsAsReadAfterVotingLinearLayout;
@BindView(R.id.mark_posts_as_read_after_voting_switch_post_history_fragment)
SwitchMaterial markPostsAsReadAfterVotingSwitch;
@Inject
@Named("post_history")
SharedPreferences postHistorySharedPreferences;
private Activity activity;
public PostHistoryFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View rootView = inflater.inflate(R.layout.fragment_post_history, container, false);
((Infinity) activity.getApplication()).getAppComponent().inject(this);
ButterKnife.bind(this, rootView);
String accountName = getArguments().getString(EXTRA_ACCOUNT_NAME);
if (accountName == null) {
infoTextView.setText(R.string.only_for_logged_in_user);
markPostsAsReadLinearLayout.setVisibility(View.GONE);
markPostsAsReadAfterVotingLinearLayout.setVisibility(View.GONE);
return rootView;
}
markPostsAsReadSwitch.setChecked(postHistorySharedPreferences.getBoolean(
(accountName == null ? "" : accountName) + SharedPreferencesUtils.MARK_POSTS_AS_READ_BASE, false));
markPostsAsReadAfterVotingSwitch.setChecked(postHistorySharedPreferences.getBoolean(
(accountName == null ? "" : accountName) + SharedPreferencesUtils.MARK_POSTS_AS_READ_AFTER_VOTING_BASE, false));
markPostsAsReadLinearLayout.setOnClickListener(view -> {
markPostsAsReadSwitch.performClick();
});
markPostsAsReadSwitch.setOnCheckedChangeListener((compoundButton, b) ->
postHistorySharedPreferences.edit().putBoolean((accountName == null ? "" : accountName)
+ SharedPreferencesUtils.MARK_POSTS_AS_READ_BASE, b).apply());
markPostsAsReadAfterVotingLinearLayout.setOnClickListener(view -> {
markPostsAsReadAfterVotingSwitch.performClick();
});
markPostsAsReadAfterVotingSwitch.setOnCheckedChangeListener((compoundButton, b) ->
postHistorySharedPreferences.edit().putBoolean((accountName == null ? "" : accountName)
+ SharedPreferencesUtils.MARK_POSTS_AS_READ_AFTER_VOTING_BASE, b).apply());
return rootView;
}
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
this.activity = (AppCompatActivity) context;
}
}

View File

@ -218,6 +218,10 @@ public class SharedPreferencesUtils {
public static final String BLUR_NSFW_BASE = "_blur_nsfw";
public static final String BLUR_SPOILER_BASE = "_blur_spoiler";
public static final String POST_HISTORY_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.post_history";
public static final String MARK_POSTS_AS_READ_BASE = "_mark_posts_as_read";
public static final String MARK_POSTS_AS_READ_AFTER_VOTING_BASE = "_mark_posts_as_read_after_voting";
//Legacy Settings
public static final String MAIN_PAGE_TAB_1_TITLE_LEGACY = "main_page_tab_1_title";
public static final String MAIN_PAGE_TAB_2_TITLE_LEGACY = "main_page_tab_2_title";

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"
android:fillColor="#FFFFFF"/>
</vector>

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
tools:context=".settings.NsfwAndBlurringFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/info_text_view_post_history_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:drawablePadding="32dp"
android:text="@string/restart_app_see_changes"
android:textColor="@color/settingsSubtitleColor"
android:gravity="center_vertical"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
app:drawableStartCompat="@drawable/ic_info_preference_24dp" />
<LinearLayout
android:id="@+id/mark_posts_as_read_linear_layout_post_history_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:paddingStart="72dp"
android:paddingEnd="16dp"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="16dp"
android:layout_gravity="center_vertical"
android:drawablePadding="32dp"
android:text="@string/settings_mark_posts_as_read_title"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_16"
android:fontFamily="?attr/font_family" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/mark_posts_as_read_switch_post_history_fragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />
</LinearLayout>
<LinearLayout
android:id="@+id/mark_posts_as_read_after_voting_linear_layout_post_history_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:paddingStart="72dp"
android:paddingEnd="16dp"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="16dp"
android:layout_gravity="center_vertical"
android:text="@string/settings_mark_posts_as_read_after_voting_title"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_16"
android:fontFamily="?attr/font_family" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/mark_posts_as_read_after_voting_switch_post_history_fragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

@ -513,7 +513,10 @@
<string name="settings_swipe_action_swipe_right_title">Swipe Right</string>
<string name="settings_swipe_action_info_summary">Not applicable to post feed with more than 1 column or post detail.</string>
<string name="settings_language_title">Language</string>
<string name="settings_enable_search_history">Enable Search History</string>
<string name="settings_enable_search_history_title">Enable Search History</string>
<string name="settings_post_history_title">Post History</string>
<string name="settings_mark_posts_as_read_title">Mark Posts As Read</string>
<string name="settings_mark_posts_as_read_after_voting_title">Mark Posts As Read After Voting</string>
<string name="no_link_available">Cannot get the link</string>

View File

@ -57,6 +57,11 @@
app:title="@string/settings_nsfw_and_spoiler_title"
app:fragment="ml.docilealligator.infinityforreddit.settings.NsfwAndBlurringFragment"/>
<Preference
app:icon="@drawable/ic_history_24dp"
android:title="@string/settings_post_history_title"
app:fragment="ml.docilealligator.infinityforreddit.settings.PostHistoryFragment" />
<Preference
app:icon="@drawable/ic_filter_24dp"
app:title="@string/settings_filter_title"

View File

@ -28,7 +28,7 @@
<SwitchPreference
app:defaultValue="true"
app:key="enable_search_history"
app:title="@string/settings_enable_search_history"
app:title="@string/settings_enable_search_history_title"
app:summary="@string/only_for_logged_in_user" />
<ListPreference

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
</PreferenceScreen>