mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-30 12:57:12 +01:00
New options: hide post type and hide the number of awards. Tweak settings.
This commit is contained in:
parent
73ddafdfcc
commit
07e2e1e746
@ -132,7 +132,7 @@ dependencies {
|
|||||||
implementation "com.github.Piasy.BigImageViewer:GlideImageViewFactory:$bivVersion"
|
implementation "com.github.Piasy.BigImageViewer:GlideImageViewFactory:$bivVersion"
|
||||||
|
|
||||||
// Markdown
|
// Markdown
|
||||||
def markwonVersion = "4.6.0"
|
def markwonVersion = "4.6.2"
|
||||||
implementation "io.noties.markwon:core:$markwonVersion"
|
implementation "io.noties.markwon:core:$markwonVersion"
|
||||||
implementation "io.noties.markwon:ext-strikethrough:$markwonVersion"
|
implementation "io.noties.markwon:ext-strikethrough:$markwonVersion"
|
||||||
implementation "io.noties.markwon:linkify:$markwonVersion"
|
implementation "io.noties.markwon:linkify:$markwonVersion"
|
||||||
|
@ -208,6 +208,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
private boolean mMarkPostsAsReadAfterVoting;
|
private boolean mMarkPostsAsReadAfterVoting;
|
||||||
private boolean mMarkPostsAsReadOnScroll;
|
private boolean mMarkPostsAsReadOnScroll;
|
||||||
private boolean mHideReadPostsAutomatically;
|
private boolean mHideReadPostsAutomatically;
|
||||||
|
private boolean mHidePostType;
|
||||||
|
private boolean mHideTheNumberOfAwards;
|
||||||
private Drawable mCommentIcon;
|
private Drawable mCommentIcon;
|
||||||
private NetworkState networkState;
|
private NetworkState networkState;
|
||||||
private ExoCreator mExoCreator;
|
private ExoCreator mExoCreator;
|
||||||
@ -279,6 +281,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
mMarkPostsAsReadOnScroll = postHistorySharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.MARK_POSTS_AS_READ_ON_SCROLL_BASE, false);
|
mMarkPostsAsReadOnScroll = postHistorySharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.MARK_POSTS_AS_READ_ON_SCROLL_BASE, false);
|
||||||
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);
|
||||||
|
mHideTheNumberOfAwards = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS, false);
|
||||||
|
|
||||||
mPostLayout = postLayout;
|
mPostLayout = postLayout;
|
||||||
|
|
||||||
mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme();
|
mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme();
|
||||||
@ -604,7 +609,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
Utils.setHTMLWithImageToTextView(((PostBaseViewHolder) holder).flairTextView, flair, false);
|
Utils.setHTMLWithImageToTextView(((PostBaseViewHolder) holder).flairTextView, flair, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nAwards > 0) {
|
if (nAwards > 0 && !mHideTheNumberOfAwards) {
|
||||||
((PostBaseViewHolder) holder).awardsTextView.setVisibility(View.VISIBLE);
|
((PostBaseViewHolder) holder).awardsTextView.setVisibility(View.VISIBLE);
|
||||||
if (nAwards == 1) {
|
if (nAwards == 1) {
|
||||||
((PostBaseViewHolder) holder).awardsTextView.setText(mActivity.getString(R.string.one_award));
|
((PostBaseViewHolder) holder).awardsTextView.setText(mActivity.getString(R.string.one_award));
|
||||||
@ -652,6 +657,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
((PostBaseViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
|
((PostBaseViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mHidePostType) {
|
||||||
|
((PostBaseViewHolder) holder).typeTextView.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
((PostBaseViewHolder) holder).typeTextView.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
if (holder instanceof PostVideoAutoplayViewHolder) {
|
if (holder instanceof PostVideoAutoplayViewHolder) {
|
||||||
((PostVideoAutoplayViewHolder) holder).previewImageView.setVisibility(View.VISIBLE);
|
((PostVideoAutoplayViewHolder) holder).previewImageView.setVisibility(View.VISIBLE);
|
||||||
Post.Preview preview = getSuitablePreview(post.getPreviews());
|
Post.Preview preview = getSuitablePreview(post.getPreviews());
|
||||||
@ -1082,7 +1093,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
Utils.setHTMLWithImageToTextView(((PostCompactBaseViewHolder) holder).flairTextView, flair, false);
|
Utils.setHTMLWithImageToTextView(((PostCompactBaseViewHolder) holder).flairTextView, flair, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nAwards > 0) {
|
if (nAwards > 0 && !mHideTheNumberOfAwards) {
|
||||||
((PostCompactBaseViewHolder) holder).awardsTextView.setVisibility(View.VISIBLE);
|
((PostCompactBaseViewHolder) holder).awardsTextView.setVisibility(View.VISIBLE);
|
||||||
if (nAwards == 1) {
|
if (nAwards == 1) {
|
||||||
((PostCompactBaseViewHolder) holder).awardsTextView.setText(mActivity.getString(R.string.one_award));
|
((PostCompactBaseViewHolder) holder).awardsTextView.setText(mActivity.getString(R.string.one_award));
|
||||||
@ -1138,6 +1149,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
((PostCompactBaseViewHolder) holder).crosspostImageView.setVisibility(View.VISIBLE);
|
((PostCompactBaseViewHolder) holder).crosspostImageView.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mHidePostType) {
|
||||||
|
((PostCompactBaseViewHolder) holder).typeTextView.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
((PostCompactBaseViewHolder) holder).typeTextView.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
switch (post.getPostType()) {
|
switch (post.getPostType()) {
|
||||||
case Post.IMAGE_TYPE:
|
case Post.IMAGE_TYPE:
|
||||||
((PostCompactBaseViewHolder) holder).typeTextView.setText(R.string.image);
|
((PostCompactBaseViewHolder) holder).typeTextView.setText(R.string.image);
|
||||||
@ -1740,6 +1757,14 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
mOnlyDisablePreviewInVideoAndGifPosts = onlyDisablePreviewInVideoAndGifPosts;
|
mOnlyDisablePreviewInVideoAndGifPosts = onlyDisablePreviewInVideoAndGifPosts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setHidePostType(boolean hidePostType) {
|
||||||
|
mHidePostType = hidePostType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHideTheNumberOfAwards(boolean hideTheNumberOfAwards) {
|
||||||
|
mHideTheNumberOfAwards = hideTheNumberOfAwards;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
|
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
|
||||||
super.onViewRecycled(holder);
|
super.onViewRecycled(holder);
|
||||||
@ -1754,11 +1779,14 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
((PostBaseViewHolder) holder).itemView.setVisibility(View.VISIBLE);
|
((PostBaseViewHolder) holder).itemView.setVisibility(View.VISIBLE);
|
||||||
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) holder.itemView.getLayoutParams();
|
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) holder.itemView.getLayoutParams();
|
||||||
params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
|
params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||||
int marginPixel = (int) Utils.convertDpToPixel(8, mActivity);
|
if (holder instanceof PostCard2VideoAutoplayViewHolder || holder instanceof PostCard2WithPreviewViewHolder) {
|
||||||
if (holder instanceof PostCard2VideoAutoplayViewHolder || holder instanceof PostCard2WithPreviewViewHolder
|
int paddingPixel = (int) Utils.convertDpToPixel(16, mActivity);
|
||||||
|| holder instanceof PostCard2TextTypeViewHolder) {
|
((PostBaseViewHolder) holder).itemView.setPadding(0, paddingPixel, 0, 0);
|
||||||
((PostBaseViewHolder) holder).itemView.setPadding(0, marginPixel, 0, 0);
|
} else if (holder instanceof PostCard2TextTypeViewHolder) {
|
||||||
|
int paddingPixel = (int) Utils.convertDpToPixel(12, mActivity);
|
||||||
|
((PostBaseViewHolder) holder).itemView.setPadding(0, paddingPixel, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
|
int marginPixel = (int) Utils.convertDpToPixel(8, mActivity);
|
||||||
params.topMargin = marginPixel;
|
params.topMargin = marginPixel;
|
||||||
params.bottomMargin = marginPixel;
|
params.bottomMargin = marginPixel;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
package ml.docilealligator.infinityforreddit.events;
|
||||||
|
|
||||||
|
public class ChangeHidePostTypeEvent {
|
||||||
|
public boolean hidePostType;
|
||||||
|
|
||||||
|
public ChangeHidePostTypeEvent(boolean hidePostType) {
|
||||||
|
this.hidePostType = hidePostType;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package ml.docilealligator.infinityforreddit.events;
|
||||||
|
|
||||||
|
public class ChangeHideTheNumberOfAwardsEvent {
|
||||||
|
public boolean hideTheNumberOfAwards;
|
||||||
|
|
||||||
|
public ChangeHideTheNumberOfAwardsEvent(boolean hideTheNumberOfAwards) {
|
||||||
|
this.hideTheNumberOfAwards = hideTheNumberOfAwards;
|
||||||
|
}
|
||||||
|
}
|
@ -84,6 +84,8 @@ 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.ChangeHidePostTypeEvent;
|
||||||
|
import ml.docilealligator.infinityforreddit.events.ChangeHideTheNumberOfAwardsEvent;
|
||||||
import ml.docilealligator.infinityforreddit.events.ChangeLongPressToHideToolbarInCompactLayoutEvent;
|
import ml.docilealligator.infinityforreddit.events.ChangeLongPressToHideToolbarInCompactLayoutEvent;
|
||||||
import ml.docilealligator.infinityforreddit.events.ChangeMuteAutoplayingVideosEvent;
|
import ml.docilealligator.infinityforreddit.events.ChangeMuteAutoplayingVideosEvent;
|
||||||
import ml.docilealligator.infinityforreddit.events.ChangeMuteNSFWVideoEvent;
|
import ml.docilealligator.infinityforreddit.events.ChangeMuteNSFWVideoEvent;
|
||||||
@ -1639,6 +1641,22 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onChangeHidePostTypeEvent(ChangeHidePostTypeEvent event) {
|
||||||
|
if (mAdapter != null) {
|
||||||
|
mAdapter.setHidePostType(event.hidePostType);
|
||||||
|
refreshAdapter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onChangeHideTheNumberOfAwardsEvent(ChangeHideTheNumberOfAwardsEvent event) {
|
||||||
|
if (mAdapter != null) {
|
||||||
|
mAdapter.setHideTheNumberOfAwards(event.hideTheNumberOfAwards);
|
||||||
|
refreshAdapter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void refreshAdapter() {
|
private void refreshAdapter() {
|
||||||
int previousPosition = -1;
|
int previousPosition = -1;
|
||||||
if (mLinearLayoutManager != null) {
|
if (mLinearLayoutManager != null) {
|
||||||
|
@ -11,6 +11,8 @@ 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.ChangeHidePostTypeEvent;
|
||||||
|
import ml.docilealligator.infinityforreddit.events.ChangeHideTheNumberOfAwardsEvent;
|
||||||
import ml.docilealligator.infinityforreddit.events.ChangeLongPressToHideToolbarInCompactLayoutEvent;
|
import ml.docilealligator.infinityforreddit.events.ChangeLongPressToHideToolbarInCompactLayoutEvent;
|
||||||
import ml.docilealligator.infinityforreddit.events.ChangeShowAbsoluteNumberOfVotesEvent;
|
import ml.docilealligator.infinityforreddit.events.ChangeShowAbsoluteNumberOfVotesEvent;
|
||||||
import ml.docilealligator.infinityforreddit.events.ShowDividerInCompactLayoutPreferenceEvent;
|
import ml.docilealligator.infinityforreddit.events.ShowDividerInCompactLayoutPreferenceEvent;
|
||||||
@ -23,36 +25,38 @@ public class PostPreferenceFragment extends PreferenceFragmentCompat {
|
|||||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||||
setPreferencesFromResource(R.xml.post_preferences, rootKey);
|
setPreferencesFromResource(R.xml.post_preferences, rootKey);
|
||||||
|
|
||||||
ListPreference defaultPostLayoutSwitch = findPreference(SharedPreferencesUtils.DEFAULT_POST_LAYOUT_KEY);
|
ListPreference defaultPostLayoutList = findPreference(SharedPreferencesUtils.DEFAULT_POST_LAYOUT_KEY);
|
||||||
SwitchPreference showDividerInCompactLayout = findPreference(SharedPreferencesUtils.SHOW_DIVIDER_IN_COMPACT_LAYOUT);
|
SwitchPreference showDividerInCompactLayoutSwitch = findPreference(SharedPreferencesUtils.SHOW_DIVIDER_IN_COMPACT_LAYOUT);
|
||||||
SwitchPreference showThumbnailOnTheRightInCompactLayout = findPreference(SharedPreferencesUtils.SHOW_THUMBNAIL_ON_THE_LEFT_IN_COMPACT_LAYOUT);
|
SwitchPreference showThumbnailOnTheRightInCompactLayoutSwitch = findPreference(SharedPreferencesUtils.SHOW_THUMBNAIL_ON_THE_LEFT_IN_COMPACT_LAYOUT);
|
||||||
SwitchPreference showAbsoluteNumberOfVotes = findPreference(SharedPreferencesUtils.SHOW_ABSOLUTE_NUMBER_OF_VOTES);
|
SwitchPreference showAbsoluteNumberOfVotesSwitch = findPreference(SharedPreferencesUtils.SHOW_ABSOLUTE_NUMBER_OF_VOTES);
|
||||||
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 hideTheNumberOfAwardsSwitch = findPreference(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS);
|
||||||
|
|
||||||
if (defaultPostLayoutSwitch != null) {
|
if (defaultPostLayoutList != null) {
|
||||||
defaultPostLayoutSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
defaultPostLayoutList.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
EventBus.getDefault().post(new ChangeDefaultPostLayoutEvent(Integer.parseInt((String) newValue)));
|
EventBus.getDefault().post(new ChangeDefaultPostLayoutEvent(Integer.parseInt((String) newValue)));
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showDividerInCompactLayout != null) {
|
if (showDividerInCompactLayoutSwitch != null) {
|
||||||
showDividerInCompactLayout.setOnPreferenceChangeListener((preference, newValue) -> {
|
showDividerInCompactLayoutSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
EventBus.getDefault().post(new ShowDividerInCompactLayoutPreferenceEvent((Boolean) newValue));
|
EventBus.getDefault().post(new ShowDividerInCompactLayoutPreferenceEvent((Boolean) newValue));
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showThumbnailOnTheRightInCompactLayout != null) {
|
if (showThumbnailOnTheRightInCompactLayoutSwitch != null) {
|
||||||
showThumbnailOnTheRightInCompactLayout.setOnPreferenceChangeListener((preference, newValue) -> {
|
showThumbnailOnTheRightInCompactLayoutSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
EventBus.getDefault().post(new ShowThumbnailOnTheRightInCompactLayoutEvent((Boolean) newValue));
|
EventBus.getDefault().post(new ShowThumbnailOnTheRightInCompactLayoutEvent((Boolean) newValue));
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showAbsoluteNumberOfVotes != null) {
|
if (showAbsoluteNumberOfVotesSwitch != null) {
|
||||||
showAbsoluteNumberOfVotes.setOnPreferenceChangeListener((preference, newValue) -> {
|
showAbsoluteNumberOfVotesSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
EventBus.getDefault().post(new ChangeShowAbsoluteNumberOfVotesEvent((Boolean) newValue));
|
EventBus.getDefault().post(new ChangeShowAbsoluteNumberOfVotesEvent((Boolean) newValue));
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
@ -71,5 +75,19 @@ public class PostPreferenceFragment extends PreferenceFragmentCompat {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hidePostTypeSwitch != null) {
|
||||||
|
hidePostTypeSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
|
EventBus.getDefault().post(new ChangeHidePostTypeEvent((Boolean) newValue));
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hideTheNumberOfAwardsSwitch != null) {
|
||||||
|
hideTheNumberOfAwardsSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
|
EventBus.getDefault().post(new ChangeHideTheNumberOfAwardsEvent((Boolean) newValue));
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -163,6 +163,8 @@ public class SharedPreferencesUtils {
|
|||||||
public static final String USER_DEFAULT_SORT_TYPE = "user_default_sort_type";
|
public static final String USER_DEFAULT_SORT_TYPE = "user_default_sort_type";
|
||||||
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_THE_NUMBER_OF_AWARDS = "hide_the_number_of_awards";
|
||||||
|
|
||||||
public static final String MAIN_PAGE_TABS_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.main_page_tabs";
|
public static final String MAIN_PAGE_TABS_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.main_page_tabs";
|
||||||
public static final String MAIN_PAGE_TAB_COUNT = "_main_page_tab_count";
|
public static final String MAIN_PAGE_TAB_COUNT = "_main_page_tab_count";
|
||||||
|
@ -15,6 +15,7 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.graphics.drawable.DrawableCompat;
|
import androidx.core.graphics.drawable.DrawableCompat;
|
||||||
import androidx.core.text.HtmlCompat;
|
import androidx.core.text.HtmlCompat;
|
||||||
|
|
||||||
@ -49,30 +50,6 @@ public class Utils {
|
|||||||
.replaceAll("(^|^ *|\\n *)######(?!($|\\s|#))", "$0 "));
|
.replaceAll("(^|^ *|\\n *)######(?!($|\\s|#))", "$0 "));
|
||||||
|
|
||||||
return fixSuperScript(regexed);
|
return fixSuperScript(regexed);
|
||||||
//Fix superscript
|
|
||||||
/*int startIndex = regexed.indexOf("^");
|
|
||||||
while (startIndex >= 0 && startIndex + 1 < regexed.length()) {
|
|
||||||
char currentChar = regexed.charAt(startIndex + 1);
|
|
||||||
if (currentChar == '^') {
|
|
||||||
regexed.insert(startIndex, '^');
|
|
||||||
startIndex = regexed.indexOf("^", startIndex + 1);
|
|
||||||
} else if (currentChar == ' ' || currentChar == '\n') {
|
|
||||||
regexed.insert(startIndex + 1, '^');
|
|
||||||
startIndex = regexed.indexOf("^", startIndex + 2);
|
|
||||||
} else if (currentChar == '(') {
|
|
||||||
int closeBracketIndex = regexed.indexOf(")", startIndex + 2);
|
|
||||||
if (closeBracketIndex > 0) {
|
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (startIndex + 1 == regexed.length() - 1) {
|
|
||||||
regexed.append('^');
|
|
||||||
startIndex++;
|
|
||||||
}
|
|
||||||
startIndex++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return regexed.toString();*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String fixSuperScript(StringBuilder regexed) {
|
public static String fixSuperScript(StringBuilder regexed) {
|
||||||
@ -309,7 +286,7 @@ public class Utils {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static Drawable getTintedDrawable(Context context, int drawableId, int color) {
|
public static Drawable getTintedDrawable(Context context, int drawableId, int color) {
|
||||||
Drawable drawable = context.getDrawable(drawableId);
|
Drawable drawable = ContextCompat.getDrawable(context, drawableId);
|
||||||
if (drawable != null) {
|
if (drawable != null) {
|
||||||
Drawable wrappedDrawable = DrawableCompat.wrap(drawable).mutate();
|
Drawable wrappedDrawable = DrawableCompat.wrap(drawable).mutate();
|
||||||
DrawableCompat.setTint(wrappedDrawable, color);
|
DrawableCompat.setTint(wrappedDrawable, color);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="12dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:background="?attr/selectableItemBackground"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="16dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:background="?attr/selectableItemBackground"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="16dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:background="?attr/selectableItemBackground"
|
||||||
|
@ -43,12 +43,14 @@
|
|||||||
|
|
||||||
<string-array name="settings_default_post_layout">
|
<string-array name="settings_default_post_layout">
|
||||||
<item>Card Layout</item>
|
<item>Card Layout</item>
|
||||||
|
<item>Card Layout 2</item>
|
||||||
<item>Compact Layout</item>
|
<item>Compact Layout</item>
|
||||||
<item>Gallery Layout</item>
|
<item>Gallery Layout</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="settings_default_post_layout_values">
|
<string-array name="settings_default_post_layout_values">
|
||||||
<item>0</item>
|
<item>0</item>
|
||||||
|
<item>3</item>
|
||||||
<item>1</item>
|
<item>1</item>
|
||||||
<item>2</item>
|
<item>2</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
@ -385,8 +385,8 @@
|
|||||||
<string name="settings_time_format_title">Time Format</string>
|
<string name="settings_time_format_title">Time Format</string>
|
||||||
<string name="settings_category_post_title">Post</string>
|
<string name="settings_category_post_title">Post</string>
|
||||||
<string name="settings_default_post_layout">Default Post Layout</string>
|
<string name="settings_default_post_layout">Default Post Layout</string>
|
||||||
<string name="settings_show_divider_in_compact_layout">Show Divider in Compact Layout</string>
|
<string name="settings_show_divider_in_compact_layout">Show Divider</string>
|
||||||
<string name="settings_show_thumbnail_on_the_left_in_compact_layout">Show Thumbnail on the Left in Compact Layout</string>
|
<string name="settings_show_thumbnail_on_the_left_in_compact_layout">Show Thumbnail on the Left</string>
|
||||||
<string name="settings_number_of_columns_in_post_feed_title">The Number of Columns in Post Feed</string>
|
<string name="settings_number_of_columns_in_post_feed_title">The Number of Columns in Post Feed</string>
|
||||||
<string name="settings_number_of_columns_in_post_feed_portrait_title">Portrait</string>
|
<string name="settings_number_of_columns_in_post_feed_portrait_title">Portrait</string>
|
||||||
<string name="settings_number_of_columns_in_post_feed_landscape_title">Landscape</string>
|
<string name="settings_number_of_columns_in_post_feed_landscape_title">Landscape</string>
|
||||||
@ -491,8 +491,8 @@
|
|||||||
<string name="settings_pull_to_refresh_title">Pull to Refresh</string>
|
<string name="settings_pull_to_refresh_title">Pull to Refresh</string>
|
||||||
<string name="settings_security_title">Security</string>
|
<string name="settings_security_title">Security</string>
|
||||||
<string name="settings_require_authentication_to_go_to_account_section_in_navigation_drawer_title">Require Authentication to Go to Account Section in Navigation Drawer</string>
|
<string name="settings_require_authentication_to_go_to_account_section_in_navigation_drawer_title">Require Authentication to Go to Account Section in Navigation Drawer</string>
|
||||||
<string name="settings_long_press_to_hide_toolbar_in_compact_layout_title">Long Press to Hide Toolbar in Compact Layout</string>
|
<string name="settings_long_press_to_hide_toolbar_in_compact_layout_title">Long Press to Hide Toolbar</string>
|
||||||
<string name="settings_post_compact_layout_toolbar_hidden_by_default_title">Toolbar in Compact Layout Hidden by Default</string>
|
<string name="settings_post_compact_layout_toolbar_hidden_by_default_title">Hide Toolbar by Default</string>
|
||||||
<string name="settings_customize_bottom_app_bar_title">Customize Bottom Navigation Bar</string>
|
<string name="settings_customize_bottom_app_bar_title">Customize Bottom Navigation Bar</string>
|
||||||
<string name="settings_main_activity_bottom_app_bar_group_summary">Main Page</string>
|
<string name="settings_main_activity_bottom_app_bar_group_summary">Main Page</string>
|
||||||
<string name="settings_other_activities_bottom_app_bar_group_summary">Other Pages</string>
|
<string name="settings_other_activities_bottom_app_bar_group_summary">Other Pages</string>
|
||||||
@ -535,6 +535,8 @@
|
|||||||
<string name="settings_user_default_sort_type_title">User Default Sort Type</string>
|
<string name="settings_user_default_sort_type_title">User Default Sort Type</string>
|
||||||
<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_the_number_of_awards">Hide the Number of Awards</string>
|
||||||
|
|
||||||
<string name="no_link_available">Cannot get the link</string>
|
<string name="no_link_available">Cannot get the link</string>
|
||||||
|
|
||||||
|
@ -10,6 +10,23 @@
|
|||||||
app:title="@string/settings_default_post_layout"
|
app:title="@string/settings_default_post_layout"
|
||||||
app:useSimpleSummaryProvider="true" />
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
app:title="@string/settings_number_of_columns_in_post_feed_title"
|
||||||
|
app:fragment="ml.docilealligator.infinityforreddit.settings.NumberOfColumnsInPostFeedPreferenceFragment" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
app:defaultValue="false"
|
||||||
|
app:key="hide_post_type"
|
||||||
|
app:title="@string/settings_hide_post_type" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
app:defaultValue="false"
|
||||||
|
app:key="hide_the_number_of_awards"
|
||||||
|
app:title="@string/settings_hide_the_number_of_awards" />
|
||||||
|
|
||||||
|
<PreferenceCategory
|
||||||
|
app:title="@string/post_layout_compact" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
app:defaultValue="true"
|
app:defaultValue="true"
|
||||||
app:key="show_divider_in_compact_layout"
|
app:key="show_divider_in_compact_layout"
|
||||||
@ -30,10 +47,6 @@
|
|||||||
app:key="post_compact_layout_toolbar_hidden_by_default"
|
app:key="post_compact_layout_toolbar_hidden_by_default"
|
||||||
app:title="@string/settings_post_compact_layout_toolbar_hidden_by_default_title" />
|
app:title="@string/settings_post_compact_layout_toolbar_hidden_by_default_title" />
|
||||||
|
|
||||||
<Preference
|
|
||||||
app:title="@string/settings_number_of_columns_in_post_feed_title"
|
|
||||||
app:fragment="ml.docilealligator.infinityforreddit.settings.NumberOfColumnsInPostFeedPreferenceFragment" />
|
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
app:title="@string/post_layout_gallery" />
|
app:title="@string/post_layout_gallery" />
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user