mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-29 04:17:12 +01:00
Hiding post fliar in PostFragment is now available.
This commit is contained in:
parent
b9a2a1adea
commit
49ffafdfd4
@ -79,16 +79,16 @@ dependencies {
|
|||||||
|
|
||||||
// Reactive stuff for event and async related
|
// Reactive stuff for event and async related
|
||||||
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
||||||
implementation 'io.reactivex.rxjava2:rxjava:2.2.20'
|
implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
|
||||||
|
|
||||||
// HTTP clients
|
// HTTP clients
|
||||||
def retrofitVersion = "2.9.0"
|
def retrofitVersion = "2.9.0"
|
||||||
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
|
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
|
||||||
implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"
|
implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"
|
||||||
implementation 'com.squareup.okhttp3:okhttp:4.2.2'
|
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
|
||||||
|
|
||||||
// Dependency injection
|
// Dependency injection
|
||||||
def daggerVersion = "2.30.1"
|
def daggerVersion = "2.34"
|
||||||
implementation "com.google.dagger:dagger:$daggerVersion"
|
implementation "com.google.dagger:dagger:$daggerVersion"
|
||||||
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
|
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ dependencies {
|
|||||||
/**** User Interface (frontend) ****/
|
/**** User Interface (frontend) ****/
|
||||||
|
|
||||||
//Image loading
|
//Image loading
|
||||||
def glideVersion = "4.11.0"
|
def glideVersion = "4.12.0"
|
||||||
implementation "com.github.bumptech.glide:glide:$glideVersion"
|
implementation "com.github.bumptech.glide:glide:$glideVersion"
|
||||||
annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion"
|
annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion"
|
||||||
implementation 'jp.wasabeef:glide-transformations:4.3.0'
|
implementation 'jp.wasabeef:glide-transformations:4.3.0'
|
||||||
|
@ -210,6 +210,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
private boolean mMarkPostsAsReadOnScroll;
|
private boolean mMarkPostsAsReadOnScroll;
|
||||||
private boolean mHideReadPostsAutomatically;
|
private boolean mHideReadPostsAutomatically;
|
||||||
private boolean mHidePostType;
|
private boolean mHidePostType;
|
||||||
|
private boolean mHidePostFlair;
|
||||||
private boolean mHideTheNumberOfAwards;
|
private boolean mHideTheNumberOfAwards;
|
||||||
private boolean mHideSubredditAndUserPrefix;
|
private boolean mHideSubredditAndUserPrefix;
|
||||||
private boolean mHideTheNumberOfVotes;
|
private boolean mHideTheNumberOfVotes;
|
||||||
@ -287,6 +288,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
mHideReadPostsAutomatically = postHistorySharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.HIDE_READ_POSTS_AUTOMATICALLY_BASE, false);
|
mHideReadPostsAutomatically = postHistorySharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.HIDE_READ_POSTS_AUTOMATICALLY_BASE, false);
|
||||||
|
|
||||||
mHidePostType = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_POST_TYPE, false);
|
mHidePostType = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_POST_TYPE, false);
|
||||||
|
mHidePostFlair = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_POST_FLAIR, false);
|
||||||
mHideTheNumberOfAwards = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS, false);
|
mHideTheNumberOfAwards = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS, false);
|
||||||
mHideSubredditAndUserPrefix = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX, false);
|
mHideSubredditAndUserPrefix = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX, false);
|
||||||
mHideTheNumberOfVotes = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES, false);
|
mHideTheNumberOfVotes = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES, false);
|
||||||
@ -622,8 +624,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flair != null && !flair.equals("")) {
|
if (flair != null && !flair.equals("")) {
|
||||||
((PostBaseViewHolder) holder).flairTextView.setVisibility(View.VISIBLE);
|
if (mHidePostFlair) {
|
||||||
Utils.setHTMLWithImageToTextView(((PostBaseViewHolder) holder).flairTextView, flair, false);
|
((PostBaseViewHolder) holder).flairTextView.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
((PostBaseViewHolder) holder).flairTextView.setVisibility(View.VISIBLE);
|
||||||
|
Utils.setHTMLWithImageToTextView(((PostBaseViewHolder) holder).flairTextView, flair, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nAwards > 0 && !mHideTheNumberOfAwards) {
|
if (nAwards > 0 && !mHideTheNumberOfAwards) {
|
||||||
@ -1123,8 +1129,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flair != null && !flair.equals("")) {
|
if (flair != null && !flair.equals("")) {
|
||||||
((PostCompactBaseViewHolder) holder).flairTextView.setVisibility(View.VISIBLE);
|
if (mHidePostFlair) {
|
||||||
Utils.setHTMLWithImageToTextView(((PostCompactBaseViewHolder) holder).flairTextView, flair, false);
|
((PostCompactBaseViewHolder) holder).flairTextView.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
((PostCompactBaseViewHolder) holder).flairTextView.setVisibility(View.VISIBLE);
|
||||||
|
Utils.setHTMLWithImageToTextView(((PostCompactBaseViewHolder) holder).flairTextView, flair, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nAwards > 0 && !mHideTheNumberOfAwards) {
|
if (nAwards > 0 && !mHideTheNumberOfAwards) {
|
||||||
@ -1801,6 +1811,10 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
mHidePostType = hidePostType;
|
mHidePostType = hidePostType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setHidePostFlair(boolean hidePostFlair) {
|
||||||
|
mHidePostFlair = hidePostFlair;
|
||||||
|
}
|
||||||
|
|
||||||
public void setHideTheNumberOfAwards(boolean hideTheNumberOfAwards) {
|
public void setHideTheNumberOfAwards(boolean hideTheNumberOfAwards) {
|
||||||
mHideTheNumberOfAwards = hideTheNumberOfAwards;
|
mHideTheNumberOfAwards = hideTheNumberOfAwards;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
package ml.docilealligator.infinityforreddit.events;
|
||||||
|
|
||||||
|
public class ChangeHidePostFlairEvent {
|
||||||
|
public boolean hidePostFlair;
|
||||||
|
|
||||||
|
public ChangeHidePostFlairEvent(boolean hidePostFlair) {
|
||||||
|
this.hidePostFlair = hidePostFlair;
|
||||||
|
}
|
||||||
|
}
|
@ -85,6 +85,7 @@ import ml.docilealligator.infinityforreddit.events.ChangeDataSavingModeEvent;
|
|||||||
import ml.docilealligator.infinityforreddit.events.ChangeDefaultPostLayoutEvent;
|
import ml.docilealligator.infinityforreddit.events.ChangeDefaultPostLayoutEvent;
|
||||||
import ml.docilealligator.infinityforreddit.events.ChangeDisableImagePreviewEvent;
|
import ml.docilealligator.infinityforreddit.events.ChangeDisableImagePreviewEvent;
|
||||||
import ml.docilealligator.infinityforreddit.events.ChangeEnableSwipeActionSwitchEvent;
|
import ml.docilealligator.infinityforreddit.events.ChangeEnableSwipeActionSwitchEvent;
|
||||||
|
import ml.docilealligator.infinityforreddit.events.ChangeHidePostFlairEvent;
|
||||||
import ml.docilealligator.infinityforreddit.events.ChangeHidePostTypeEvent;
|
import ml.docilealligator.infinityforreddit.events.ChangeHidePostTypeEvent;
|
||||||
import ml.docilealligator.infinityforreddit.events.ChangeHideSubredditAndUserPrefixEvent;
|
import ml.docilealligator.infinityforreddit.events.ChangeHideSubredditAndUserPrefixEvent;
|
||||||
import ml.docilealligator.infinityforreddit.events.ChangeHideTheNumberOfAwardsEvent;
|
import ml.docilealligator.infinityforreddit.events.ChangeHideTheNumberOfAwardsEvent;
|
||||||
@ -1825,6 +1826,14 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onChangeHidePostFlairEvent(ChangeHidePostFlairEvent event) {
|
||||||
|
if (mAdapter != null) {
|
||||||
|
mAdapter.setHidePostFlair(event.hidePostFlair);
|
||||||
|
refreshAdapter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onChangeHideTheNumberOfAwardsEvent(ChangeHideTheNumberOfAwardsEvent event) {
|
public void onChangeHideTheNumberOfAwardsEvent(ChangeHideTheNumberOfAwardsEvent event) {
|
||||||
if (mAdapter != null) {
|
if (mAdapter != null) {
|
||||||
|
@ -12,6 +12,7 @@ import org.greenrobot.eventbus.EventBus;
|
|||||||
import ml.docilealligator.infinityforreddit.R;
|
import ml.docilealligator.infinityforreddit.R;
|
||||||
import ml.docilealligator.infinityforreddit.events.ChangeCompactLayoutToolbarHiddenByDefaultEvent;
|
import ml.docilealligator.infinityforreddit.events.ChangeCompactLayoutToolbarHiddenByDefaultEvent;
|
||||||
import ml.docilealligator.infinityforreddit.events.ChangeDefaultPostLayoutEvent;
|
import ml.docilealligator.infinityforreddit.events.ChangeDefaultPostLayoutEvent;
|
||||||
|
import ml.docilealligator.infinityforreddit.events.ChangeHidePostFlairEvent;
|
||||||
import ml.docilealligator.infinityforreddit.events.ChangeHidePostTypeEvent;
|
import ml.docilealligator.infinityforreddit.events.ChangeHidePostTypeEvent;
|
||||||
import ml.docilealligator.infinityforreddit.events.ChangeHideSubredditAndUserPrefixEvent;
|
import ml.docilealligator.infinityforreddit.events.ChangeHideSubredditAndUserPrefixEvent;
|
||||||
import ml.docilealligator.infinityforreddit.events.ChangeHideTheNumberOfAwardsEvent;
|
import ml.docilealligator.infinityforreddit.events.ChangeHideTheNumberOfAwardsEvent;
|
||||||
@ -36,6 +37,7 @@ public class PostPreferenceFragment extends PreferenceFragmentCompat {
|
|||||||
SwitchPreference longPressToHideToolbarInCompactLayoutSwitch = findPreference(SharedPreferencesUtils.LONG_PRESS_TO_HIDE_TOOLBAR_IN_COMPACT_LAYOUT);
|
SwitchPreference longPressToHideToolbarInCompactLayoutSwitch = findPreference(SharedPreferencesUtils.LONG_PRESS_TO_HIDE_TOOLBAR_IN_COMPACT_LAYOUT);
|
||||||
SwitchPreference postCompactLayoutToolbarHiddenByDefaultSwitch = findPreference(SharedPreferencesUtils.POST_COMPACT_LAYOUT_TOOLBAR_HIDDEN_BY_DEFAULT);
|
SwitchPreference postCompactLayoutToolbarHiddenByDefaultSwitch = findPreference(SharedPreferencesUtils.POST_COMPACT_LAYOUT_TOOLBAR_HIDDEN_BY_DEFAULT);
|
||||||
SwitchPreference hidePostTypeSwitch = findPreference(SharedPreferencesUtils.HIDE_POST_TYPE);
|
SwitchPreference hidePostTypeSwitch = findPreference(SharedPreferencesUtils.HIDE_POST_TYPE);
|
||||||
|
SwitchPreference hidePostFlairSwitch = findPreference(SharedPreferencesUtils.HIDE_POST_FLAIR);
|
||||||
SwitchPreference hideTheNumberOfAwardsSwitch = findPreference(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS);
|
SwitchPreference hideTheNumberOfAwardsSwitch = findPreference(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS);
|
||||||
SwitchPreference hideSubredditAndUserPrefixSwitch = findPreference(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX);
|
SwitchPreference hideSubredditAndUserPrefixSwitch = findPreference(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX);
|
||||||
SwitchPreference hideTheNumberOfVotesSwitch = findPreference(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES);
|
SwitchPreference hideTheNumberOfVotesSwitch = findPreference(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES);
|
||||||
@ -90,6 +92,13 @@ public class PostPreferenceFragment extends PreferenceFragmentCompat {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hidePostFlairSwitch != null) {
|
||||||
|
hidePostFlairSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
|
EventBus.getDefault().post(new ChangeHidePostFlairEvent((Boolean) newValue));
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (hideTheNumberOfAwardsSwitch != null) {
|
if (hideTheNumberOfAwardsSwitch != null) {
|
||||||
hideTheNumberOfAwardsSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
hideTheNumberOfAwardsSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
EventBus.getDefault().post(new ChangeHideTheNumberOfAwardsEvent((Boolean) newValue));
|
EventBus.getDefault().post(new ChangeHideTheNumberOfAwardsEvent((Boolean) newValue));
|
||||||
|
@ -165,6 +165,7 @@ public class SharedPreferencesUtils {
|
|||||||
public static final String USER_DEFAULT_SORT_TIME = "user_default_sort_time";
|
public static final String USER_DEFAULT_SORT_TIME = "user_default_sort_time";
|
||||||
public static final String CLICK_TO_SHOW_MEDIA_IN_GALLERY_LAYOUT = "click_to_show_media_in_gallery_layout";
|
public static final String CLICK_TO_SHOW_MEDIA_IN_GALLERY_LAYOUT = "click_to_show_media_in_gallery_layout";
|
||||||
public static final String HIDE_POST_TYPE = "hide_post_type";
|
public static final String HIDE_POST_TYPE = "hide_post_type";
|
||||||
|
public static final String HIDE_POST_FLAIR = "hide_post_flair";
|
||||||
public static final String HIDE_THE_NUMBER_OF_AWARDS = "hide_the_number_of_awards";
|
public static final String HIDE_THE_NUMBER_OF_AWARDS = "hide_the_number_of_awards";
|
||||||
public static final String HIDE_SUBREDDIT_AND_USER_PREFIX = "hide_subreddit_and_user_prefix";
|
public static final String HIDE_SUBREDDIT_AND_USER_PREFIX = "hide_subreddit_and_user_prefix";
|
||||||
public static final String HIDE_THE_NUMBER_OF_VOTES = "hide_the_number_of_votes";
|
public static final String HIDE_THE_NUMBER_OF_VOTES = "hide_the_number_of_votes";
|
||||||
|
@ -541,6 +541,7 @@
|
|||||||
<string name="settings_user_default_sort_time_title">User Default Sort Time</string>
|
<string name="settings_user_default_sort_time_title">User Default Sort Time</string>
|
||||||
<string name="settings_click_to_show_media_in_gallery_layout">Click to Show Media in Gallery Layout</string>
|
<string name="settings_click_to_show_media_in_gallery_layout">Click to Show Media in Gallery Layout</string>
|
||||||
<string name="settings_hide_post_type">Hide Post Type</string>
|
<string name="settings_hide_post_type">Hide Post Type</string>
|
||||||
|
<string name="settings_hide_post_flair">Hide Post Flair</string>
|
||||||
<string name="settings_hide_the_number_of_awards">Hide the Number of Awards</string>
|
<string name="settings_hide_the_number_of_awards">Hide the Number of Awards</string>
|
||||||
<string name="settings_hide_subreddit_and_user_prefix">Hide Subreddit and User Prefix</string>
|
<string name="settings_hide_subreddit_and_user_prefix">Hide Subreddit and User Prefix</string>
|
||||||
<string name="settings_hide_the_number_of_votes">Hide the Number of Votes</string>
|
<string name="settings_hide_the_number_of_votes">Hide the Number of Votes</string>
|
||||||
|
@ -19,6 +19,11 @@
|
|||||||
app:key="hide_post_type"
|
app:key="hide_post_type"
|
||||||
app:title="@string/settings_hide_post_type" />
|
app:title="@string/settings_hide_post_type" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
app:defaultValue="false"
|
||||||
|
app:key="hide_post_flair"
|
||||||
|
app:title="@string/settings_hide_post_flair" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
app:defaultValue="false"
|
app:defaultValue="false"
|
||||||
app:key="hide_the_number_of_awards"
|
app:key="hide_the_number_of_awards"
|
||||||
|
Loading…
Reference in New Issue
Block a user