diff options
Diffstat (limited to '')
12 files changed, 220 insertions, 44 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SaveMemoryCenterInisdeDownsampleStrategy.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SaveMemoryCenterInisdeDownsampleStrategy.java index 8516c53e..acb38267 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SaveMemoryCenterInisdeDownsampleStrategy.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SaveMemoryCenterInisdeDownsampleStrategy.java @@ -4,16 +4,22 @@ import com.bumptech.glide.load.resource.bitmap.DownsampleStrategy; public class SaveMemoryCenterInisdeDownsampleStrategy extends DownsampleStrategy { + private int threshold; + + public SaveMemoryCenterInisdeDownsampleStrategy(int threshold) { + this.threshold = threshold; + } + @Override public float getScaleFactor(int sourceWidth, int sourceHeight, int requestedWidth, int requestedHeight) { int originalSourceWidth = sourceWidth; int originalSourceHeight = sourceHeight; - if (sourceWidth * sourceHeight > 5_000_000) { + if (sourceWidth * sourceHeight > threshold) { int divisor = 2; do { sourceWidth /= divisor; sourceHeight /= divisor; - } while (sourceWidth * sourceHeight > 5_000_000); + } while (sourceWidth * sourceHeight > threshold); } float widthPercentage = (float) requestedWidth / (float) sourceWidth; @@ -26,4 +32,8 @@ public class SaveMemoryCenterInisdeDownsampleStrategy extends DownsampleStrategy public SampleSizeRounding getSampleSizeRounding(int sourceWidth, int sourceHeight, int requestedWidth, int requestedHeight) { return SampleSizeRounding.MEMORY; } + + public void setThreshold(int threshold) { + this.threshold = threshold; + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java index 529bed8d..983c887a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java @@ -141,6 +141,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler private Retrofit mStreamableRetrofit; private RedditDataRoomDatabase mRedditDataRoomDatabase; private RequestManager mGlide; + private SaveMemoryCenterInisdeDownsampleStrategy mSaveMemoryCenterInsideDownSampleStrategy; private Markwon mPostDetailMarkwon; private final MarkwonAdapter mMarkwonAdapter; private String mAccessToken; @@ -233,6 +234,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler mStreamableRetrofit = streamableRetrofit; mRedditDataRoomDatabase = redditDataRoomDatabase; mGlide = glide; + mSaveMemoryCenterInsideDownSampleStrategy = new SaveMemoryCenterInisdeDownsampleStrategy(Integer.parseInt(sharedPreferences.getString(SharedPreferencesUtils.POST_FEED_MAX_RESOLUTION, "5000000"))); mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(); int markdownColor = customThemeWrapper.getPostContentColor(); int postSpoilerBackgroundColor = markdownColor | 0xFF000000; @@ -655,7 +657,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler Post.Preview preview = getSuitablePreview(mPost.getPreviews()); if (preview != null) { ((PostDetailVideoAutoplayViewHolder) holder).aspectRatioFrameLayout.setAspectRatio((float) preview.getPreviewWidth() / preview.getPreviewHeight()); - mGlide.load(preview.getPreviewUrl()).centerInside().downsample(new SaveMemoryCenterInisdeDownsampleStrategy()).into(((PostDetailVideoAutoplayViewHolder) holder).previewImageView); + mGlide.load(preview.getPreviewUrl()).centerInside().downsample(mSaveMemoryCenterInsideDownSampleStrategy).into(((PostDetailVideoAutoplayViewHolder) holder).previewImageView); } else { ((PostDetailVideoAutoplayViewHolder) holder).aspectRatioFrameLayout.setAspectRatio(1); } @@ -916,7 +918,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler if (blurImage) { imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))).into(((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView); } else { - imageRequestBuilder.centerInside().downsample(new SaveMemoryCenterInisdeDownsampleStrategy()).into(((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView); + imageRequestBuilder.centerInside().downsample(mSaveMemoryCenterInsideDownSampleStrategy).into(((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView); } } else if (holder instanceof PostDetailVideoAndGifPreviewHolder) { RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(preview.getPreviewUrl()) @@ -944,7 +946,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))) .into(((PostDetailVideoAndGifPreviewHolder) holder).mImageView); } else { - imageRequestBuilder.centerInside().downsample(new SaveMemoryCenterInisdeDownsampleStrategy()).into(((PostDetailVideoAndGifPreviewHolder) holder).mImageView); + imageRequestBuilder.centerInside().downsample(mSaveMemoryCenterInsideDownSampleStrategy).into(((PostDetailVideoAndGifPreviewHolder) holder).mImageView); } } else if (holder instanceof PostDetailLinkViewHolder) { RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(preview.getPreviewUrl()) @@ -972,7 +974,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))) .into(((PostDetailLinkViewHolder) holder).mImageView); } else { - imageRequestBuilder.centerInside().downsample(new SaveMemoryCenterInisdeDownsampleStrategy()).into(((PostDetailLinkViewHolder) holder).mImageView); + imageRequestBuilder.centerInside().downsample(mSaveMemoryCenterInsideDownSampleStrategy).into(((PostDetailLinkViewHolder) holder).mImageView); } } else if (holder instanceof PostDetailGalleryViewHolder) { RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(preview.getPreviewUrl()) @@ -999,7 +1001,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler if ((mPost.isNSFW() && mNeedBlurNsfw && !(mDoNotBlurNsfwInNsfwSubreddits && mFragment != null && mFragment.getIsNsfwSubreddit()) && !(mPost.getPostType() == Post.GIF_TYPE && mAutoplayNsfwVideos)) || (mPost.isSpoiler() && mNeedBlurSpoiler)) { imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))).into(((PostDetailGalleryViewHolder) holder).mImageView); } else { - imageRequestBuilder.centerInside().downsample(new SaveMemoryCenterInisdeDownsampleStrategy()).into(((PostDetailGalleryViewHolder) holder).mImageView); + imageRequestBuilder.centerInside().downsample(mSaveMemoryCenterInsideDownSampleStrategy).into(((PostDetailGalleryViewHolder) holder).mImageView); } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java index 6a25642e..15504df8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -11,9 +11,11 @@ import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.os.Handler; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.ViewTreeObserver; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; @@ -135,6 +137,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie private Retrofit mStreamableRetrofit; private String mAccessToken; private RequestManager mGlide; + private int mMaxResolution; + private SaveMemoryCenterInisdeDownsampleStrategy mSaveMemoryCenterInsideDownsampleStrategy; private Locale mLocale; private boolean canStartActivity = true; private int mPostType; @@ -332,6 +336,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie mScale = resources.getDisplayMetrics().density; mGlide = Glide.with(mActivity); + mMaxResolution = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.POST_FEED_MAX_RESOLUTION, "5000000")); + mSaveMemoryCenterInsideDownsampleStrategy = new SaveMemoryCenterInisdeDownsampleStrategy(mMaxResolution); mLocale = locale; mExoCreator = exoCreator; mCallback = callback; @@ -687,7 +693,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie Post.Preview preview = getSuitablePreview(post.getPreviews()); if (!mFixedHeightPreviewInCard && preview != null) { ((PostVideoAutoplayViewHolder) holder).aspectRatioFrameLayout.setAspectRatio((float) preview.getPreviewWidth() / preview.getPreviewHeight()); - mGlide.load(preview.getPreviewUrl()).centerInside().downsample(new SaveMemoryCenterInisdeDownsampleStrategy()).into(((PostVideoAutoplayViewHolder) holder).previewImageView); + mGlide.load(preview.getPreviewUrl()).centerInside().downsample(mSaveMemoryCenterInsideDownsampleStrategy).into(((PostVideoAutoplayViewHolder) holder).previewImageView); } else { ((PostVideoAutoplayViewHolder) holder).aspectRatioFrameLayout.setAspectRatio(1); } @@ -810,7 +816,13 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie ((PostWithPreviewTypeViewHolder) holder).imageView .setRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth()); } - loadImage(holder); + ((PostWithPreviewTypeViewHolder) holder).imageView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + ((PostWithPreviewTypeViewHolder) holder).imageView.getViewTreeObserver().removeOnGlobalLayoutListener(this); + loadImage(holder); + } + }); } else { ((PostWithPreviewTypeViewHolder) holder).noPreviewLinkImageView.setVisibility(View.VISIBLE); if (post.getPostType() == Post.VIDEO_TYPE) { @@ -839,7 +851,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie Post.Preview preview = getSuitablePreview(post.getPreviews()); if (!mFixedHeightPreviewInCard && preview != null) { ((PostCard2VideoAutoplayViewHolder) holder).aspectRatioFrameLayout.setAspectRatio((float) preview.getPreviewWidth() / preview.getPreviewHeight()); - mGlide.load(preview.getPreviewUrl()).centerInside().downsample(new SaveMemoryCenterInisdeDownsampleStrategy()).into(((PostCard2VideoAutoplayViewHolder) holder).previewImageView); + mGlide.load(preview.getPreviewUrl()).centerInside().downsample(mSaveMemoryCenterInsideDownsampleStrategy).into(((PostCard2VideoAutoplayViewHolder) holder).previewImageView); } else { ((PostCard2VideoAutoplayViewHolder) holder).aspectRatioFrameLayout.setAspectRatio(1); } @@ -964,7 +976,13 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie ((PostCard2WithPreviewViewHolder) holder).imageView .setRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth()); } - loadImage(holder); + ((PostCard2WithPreviewViewHolder) holder).imageView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + ((PostCard2WithPreviewViewHolder) holder).imageView.getViewTreeObserver().removeOnGlobalLayoutListener(this); + loadImage(holder); + } + }); } else { ((PostCard2WithPreviewViewHolder) holder).progressBar.setVisibility(View.GONE); ((PostCard2WithPreviewViewHolder) holder).noPreviewImageView.setVisibility(View.VISIBLE); @@ -1342,7 +1360,13 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie ((PostGalleryViewHolder) holder).imageView .setRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth()); } - loadImage(holder); + ((PostGalleryViewHolder) holder).imageView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + ((PostGalleryViewHolder) holder).imageView.getViewTreeObserver().removeOnGlobalLayoutListener(this); + loadImage(holder); + } + }); } else { ((PostGalleryViewHolder) holder).noPreviewImageView.setVisibility(View.VISIBLE); if (post.getPostType() == Post.VIDEO_TYPE) { @@ -1400,7 +1424,13 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie ((PostGalleryViewHolder) holder).imageView .setRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth()); } - loadImage(holder); + ((PostGalleryViewHolder) holder).imageView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + ((PostGalleryViewHolder) holder).imageView.getViewTreeObserver().removeOnGlobalLayoutListener(this); + loadImage(holder); + } + }); } else { ((PostGalleryViewHolder) holder).noPreviewImageView.setVisibility(View.VISIBLE); ((PostGalleryViewHolder) holder).noPreviewImageView.setImageResource(R.drawable.ic_outline_video_24dp); @@ -1424,7 +1454,13 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie ((PostGalleryViewHolder) holder).imageView .setRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth()); } - loadImage(holder); + ((PostGalleryViewHolder) holder).imageView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + ((PostGalleryViewHolder) holder).imageView.getViewTreeObserver().removeOnGlobalLayoutListener(this); + loadImage(holder); + } + }); } else { ((PostGalleryViewHolder) holder).noPreviewImageView.setVisibility(View.VISIBLE); ((PostGalleryViewHolder) holder).noPreviewImageView.setImageResource(R.drawable.ic_link); @@ -1458,7 +1494,13 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie ((PostGalleryViewHolder) holder).imageView .setRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth()); } - loadImage(holder); + ((PostGalleryViewHolder) holder).imageView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + ((PostGalleryViewHolder) holder).imageView.getViewTreeObserver().removeOnGlobalLayoutListener(this); + loadImage(holder); + } + }); } else { ((PostGalleryViewHolder) holder).noPreviewImageView.setVisibility(View.VISIBLE); ((PostGalleryViewHolder) holder).noPreviewImageView.setImageResource(R.drawable.ic_gallery_24dp); @@ -1481,10 +1523,10 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie previewIndex = 0; } preview = previews.get(previewIndex); - if (preview.getPreviewWidth() * preview.getPreviewHeight() > 5_000_000) { + if (preview.getPreviewWidth() * preview.getPreviewHeight() > mMaxResolution) { for (int i = previews.size() - 1; i >= 1; i--) { preview = previews.get(i); - if (preview.getPreviewWidth() * preview.getPreviewHeight() <= 5_000_000) { + if (preview.getPreviewWidth() * preview.getPreviewHeight() <= mMaxResolution) { return preview; } } @@ -1513,7 +1555,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))) .into(((PostWithPreviewTypeViewHolder) holder).imageView); } else { - imageRequestBuilder.centerInside().downsample(new SaveMemoryCenterInisdeDownsampleStrategy()).into(((PostWithPreviewTypeViewHolder) holder).imageView); + imageRequestBuilder.downsample(mSaveMemoryCenterInsideDownsampleStrategy).into(((PostWithPreviewTypeViewHolder) holder).imageView); } } } else if (holder instanceof PostCompactBaseViewHolder) { @@ -1553,7 +1595,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))) .into(((PostGalleryViewHolder) holder).imageView); } else { - imageRequestBuilder.centerInside().downsample(new SaveMemoryCenterInisdeDownsampleStrategy()).into(((PostGalleryViewHolder) holder).imageView); + imageRequestBuilder.centerInside().downsample(mSaveMemoryCenterInsideDownsampleStrategy).into(((PostGalleryViewHolder) holder).imageView); } } } else if (holder instanceof PostCard2WithPreviewViewHolder) { @@ -1573,7 +1615,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))) .into(((PostCard2WithPreviewViewHolder) holder).imageView); } else { - imageRequestBuilder.centerInside().downsample(new SaveMemoryCenterInisdeDownsampleStrategy()).into(((PostCard2WithPreviewViewHolder) holder).imageView); + imageRequestBuilder.centerInside().downsample(mSaveMemoryCenterInsideDownsampleStrategy).into(((PostCard2WithPreviewViewHolder) holder).imageView); } } } @@ -1741,6 +1783,13 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie mHideTextPostContent = hideTextPostContent; } + public void setPostFeedMaxResolution(int postFeedMaxResolution) { + mMaxResolution = postFeedMaxResolution; + if (mSaveMemoryCenterInsideDownsampleStrategy != null) { + mSaveMemoryCenterInsideDownsampleStrategy.setThreshold(postFeedMaxResolution); + } + } + @Override public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) { super.onViewRecycled(holder); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/AspectRatioGifImageView.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/AspectRatioGifImageView.java index bd735f90..499e92b2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/AspectRatioGifImageView.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/AspectRatioGifImageView.java @@ -37,6 +37,7 @@ public class AspectRatioGifImageView extends GifImageView { } + @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int width = this.getMeasuredWidth(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontEditTextPreference.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontEditTextPreference.java new file mode 100644 index 00000000..bbdb1f80 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontEditTextPreference.java @@ -0,0 +1,52 @@ +package ml.docilealligator.infinityforreddit.customviews; + +import android.content.Context; +import android.graphics.Typeface; +import android.util.AttributeSet; +import android.view.View; +import android.widget.TextView; + +import androidx.preference.EditTextPreference; +import androidx.preference.PreferenceViewHolder; + +import ml.docilealligator.infinityforreddit.CustomFontReceiver; + +public class CustomFontEditTextPreference extends EditTextPreference implements CustomFontReceiver { + private Typeface typeface; + + public CustomFontEditTextPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } + + public CustomFontEditTextPreference(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + public CustomFontEditTextPreference(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public CustomFontEditTextPreference(Context context) { + super(context); + } + + @Override + public void onBindViewHolder(PreferenceViewHolder holder) { + super.onBindViewHolder(holder); + if (typeface != null) { + View titleTextView = holder.findViewById(android.R.id.title); + if (titleTextView instanceof TextView) { + ((TextView) titleTextView).setTypeface(typeface); + } + View summaryTextView = holder.findViewById(android.R.id.summary); + if (summaryTextView instanceof TextView) { + ((TextView) summaryTextView).setTypeface(typeface); + } + } + } + + @Override + public void setCustomFont(Typeface typeface, Typeface titleTypeface, Typeface contentTypeface) { + this.typeface = typeface; + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/events/ChangePostFeedMaxResolutionEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/events/ChangePostFeedMaxResolutionEvent.java new file mode 100644 index 00000000..ac83ae4a --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/events/ChangePostFeedMaxResolutionEvent.java @@ -0,0 +1,9 @@ +package ml.docilealligator.infinityforreddit.events; + +public class ChangePostFeedMaxResolutionEvent { + public int postFeedMaxResolution; + + public ChangePostFeedMaxResolutionEvent(int postFeedMaxResolution) { + this.postFeedMaxResolution = postFeedMaxResolution; + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java index 22071f55..cba59d00 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java @@ -109,6 +109,7 @@ import ml.docilealligator.infinityforreddit.events.ChangeMuteNSFWVideoEvent; import ml.docilealligator.infinityforreddit.events.ChangeNSFWBlurEvent; import ml.docilealligator.infinityforreddit.events.ChangeNetworkStatusEvent; import ml.docilealligator.infinityforreddit.events.ChangeOnlyDisablePreviewInVideoAndGifPostsEvent; +import ml.docilealligator.infinityforreddit.events.ChangePostFeedMaxResolutionEvent; import ml.docilealligator.infinityforreddit.events.ChangePostLayoutEvent; import ml.docilealligator.infinityforreddit.events.ChangePullToRefreshEvent; import ml.docilealligator.infinityforreddit.events.ChangeRememberMutingOptionInPostFeedEvent; @@ -2089,6 +2090,14 @@ public class PostFragment extends Fragment implements FragmentCommunicator { } } + @Subscribe + public void onChangePostFeedMaxResolutionEvent(ChangePostFeedMaxResolutionEvent event) { + if (mAdapter != null) { + mAdapter.setPostFeedMaxResolution(event.postFeedMaxResolution); + refreshAdapter(); + } + } + private void refreshAdapter() { int previousPosition = -1; if (mLinearLayoutManager != null) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MiscellaneousPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MiscellaneousPreferenceFragment.java index 0c9d5fa7..9fef58ab 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MiscellaneousPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MiscellaneousPreferenceFragment.java @@ -2,7 +2,9 @@ package ml.docilealligator.infinityforreddit.settings; import android.content.SharedPreferences; import android.os.Bundle; +import android.widget.Toast; +import androidx.preference.EditTextPreference; import androidx.preference.ListPreference; import androidx.preference.SwitchPreference; @@ -14,6 +16,7 @@ import javax.inject.Named; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.customviews.CustomFontPreferenceFragmentCompat; +import ml.docilealligator.infinityforreddit.events.ChangePostFeedMaxResolutionEvent; import ml.docilealligator.infinityforreddit.events.ChangeSavePostFeedScrolledPositionEvent; import ml.docilealligator.infinityforreddit.events.RecreateActivityEvent; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; @@ -41,6 +44,7 @@ public class MiscellaneousPreferenceFragment extends CustomFontPreferenceFragmen ListPreference mainPageBackButtonActionListPreference = findPreference(SharedPreferencesUtils.MAIN_PAGE_BACK_BUTTON_ACTION); SwitchPreference savePostFeedScrolledPositionSwitch = findPreference(SharedPreferencesUtils.SAVE_FRONT_PAGE_SCROLLED_POSITION); ListPreference languageListPreference = findPreference(SharedPreferencesUtils.LANGUAGE); + EditTextPreference postFeedMaxResolution = findPreference(SharedPreferencesUtils.POST_FEED_MAX_RESOLUTION); if (mainPageBackButtonActionListPreference != null) { mainPageBackButtonActionListPreference.setOnPreferenceChangeListener((preference, newValue) -> { @@ -65,5 +69,22 @@ public class MiscellaneousPreferenceFragment extends CustomFontPreferenceFragmen return true; }); } + + if (postFeedMaxResolution != null) { + postFeedMaxResolution.setOnPreferenceChangeListener((preference, newValue) -> { + try { + int resolution = Integer.parseInt((String) newValue); + if (resolution <= 0) { + Toast.makeText(activity, R.string.not_a_valid_number, Toast.LENGTH_SHORT).show(); + return false; + } + EventBus.getDefault().post(new ChangePostFeedMaxResolutionEvent(resolution)); + } catch (NumberFormatException e) { + Toast.makeText(activity, R.string.not_a_valid_number, Toast.LENGTH_SHORT).show(); + return false; + } + return true; + }); + } } }
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java index 4ade7642..9417352d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java @@ -208,6 +208,7 @@ public class SharedPreferencesUtils { public static final String SHOW_AUTHOR_AVATAR = "show_author_avatar"; public static final String ALWAYS_SHOW_CHILD_COMMENT_COUNT = "always_show_child_comment_count"; public static final String HIDE_UPVOTE_RATIO = "hide_upvote_ratio"; + public static final String POST_FEED_MAX_RESOLUTION = "post_feed_max_resolution"; public static final String DEFAULT_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit_preferences"; public static final String MAIN_PAGE_TABS_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.main_page_tabs"; diff --git a/app/src/main/res/drawable/ic_launcher_foreground_monochrome.xml b/app/src/main/res/drawable/ic_launcher_foreground_monochrome.xml index ea998cae..40fde1ad 100644 --- a/app/src/main/res/drawable/ic_launcher_foreground_monochrome.xml +++ b/app/src/main/res/drawable/ic_launcher_foreground_monochrome.xml @@ -1,24 +1,27 @@ -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="108dp" - android:height="108dp" - android:viewportWidth="357.14285" - android:viewportHeight="357.14285"> - <group android:translateX="-71.42857" - android:translateY="-71.42857"> - <path - android:pathData="M219.748,296.993C219.408,300.87 214.329,303.591 208.405,303.071C202.48,302.552 197.953,298.988 198.293,295.111C198.633,291.234 203.712,288.513 209.637,289.033C215.561,289.553 220.089,293.117 219.748,296.993Z" - android:fillColor="#000000" /> - <path - android:pathData="M262.901,299.84C262.901,304.319 256.949,307.95 249.606,307.95C242.263,307.95 236.311,304.319 236.311,299.84C236.311,295.361 242.263,291.73 249.606,291.73C256.949,291.73 262.901,295.361 262.901,299.84Z" - android:fillColor="#000000" /> - <path - android:pathData="M301.779,294.703C302.331,297.737 298.143,302.337 292.075,303.44C286.007,304.543 280.355,301.732 279.803,298.698C279.252,295.664 283.724,292.31 289.793,291.206C295.861,290.103 301.227,291.668 301.779,294.703Z" - android:fillColor="#000000" /> - <path - android:pathData="M339.357,284.694C339.357,284.694 330.183,264.955 266.958,256.022L250.001,256.443L233.044,256.022C169.817,264.955 160.643,284.694 160.643,284.694C160.643,284.694 199.105,298.247 250.001,297.934C300.896,298.247 339.357,284.694 339.357,284.694Z" - android:fillColor="#000000" /> - <path - android:pathData="M248.534,281.258C232.183,281.258 213.218,278.066 192.874,268.628L192.568,268.487L192.541,268.152C192.527,267.994 191.304,252.154 197.566,234.818C202.173,222.07 211.682,206.407 231.3,196.873C247.204,189.143 266.287,190.652 280.032,201.776C280.516,202.169 281,202.575 281.481,202.995C296.148,215.804 304.313,237.264 305.753,266.777L305.769,267.116L305.482,267.295C305.148,267.503 282.475,281.258 248.534,281.258Z" - android:fillColor="#000000" /> - </group> -</vector>
\ No newline at end of file +<vector android:height="36dp" android:viewportHeight="50.8" + android:viewportWidth="50.8" android:width="36dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <group> + <clip-path android:pathData="M13.9852,13.9851l22.8296,0l0,22.8296l-22.8296,0z"/> + <group> + <clip-path android:pathData="M13.9852,13.9851L13.9852,36.8147L36.8149,36.8147L36.8149,13.9851Z"/> + <path android:fillColor="#f9a745" android:pathData="m21.5792,31.3354c-0.0429,0.4897 -0.6844,0.8334 -1.4328,0.7677 -0.7482,-0.0657 -1.3201,-0.5158 -1.2772,-1.0055 0.0429,-0.4896 0.6843,-0.8334 1.4328,-0.7677 0.7482,0.0657 1.3201,0.5158 1.2772,1.0055z"/> + <path android:fillColor="#f9a745" android:pathData="m27.0294,31.695c0,0.5657 -0.7518,1.0245 -1.6791,1.0245 -0.9276,0 -1.6793,-0.4587 -1.6793,-1.0245 0,-0.5657 0.7518,-1.0242 1.6793,-1.0242 0.9273,0 1.6791,0.4585 1.6791,1.0242z"/> + <path android:fillColor="#f9a745" android:pathData="m31.94,31.0461c0.0697,0.3832 -0.4592,0.9642 -1.2255,1.1035 -0.7665,0.1393 -1.4803,-0.2157 -1.55,-0.5989 -0.0697,-0.3832 0.4951,-0.8068 1.2617,-0.9463 0.7664,-0.1393 1.4443,0.0584 1.5139,0.4417z"/> + <path android:fillColor="#ee505a" android:pathData="m34.3384,29.1017c0.0581,0.2148 -0.1924,0.4695 -0.5594,0.5688 -0.367,0.0991 -0.7116,0.0054 -0.7697,-0.2094 -0.0582,-0.2148 0.1922,-0.4695 0.5593,-0.5688 0.3673,-0.0991 0.7119,-0.0054 0.7698,0.2094z"/> + <path android:fillColor="#ee505a" android:pathData="m30.4999,29.836c0.0215,0.2215 -0.2678,0.431 -0.6462,0.4677 -0.3784,0.0369 -0.7028,-0.1129 -0.7244,-0.3345 -0.0215,-0.2215 0.2678,-0.431 0.6462,-0.4677 0.3784,-0.0369 0.7028,0.1129 0.7244,0.3345z"/> + <path android:fillColor="#ee505a" android:pathData="m26.0037,30.1878c0.0015,0.2225 -0.3055,0.4051 -0.686,0.4076 -0.3803,0.0025 -0.6898,-0.1758 -0.691,-0.3984 -0.0015,-0.2227 0.3054,-0.4051 0.6856,-0.4076 0.3804,-0.0025 0.6898,0.1758 0.6914,0.3984z"/> + <path android:fillColor="#ee505a" android:pathData="m21.6244,29.9191c-0.0403,0.2189 -0.3763,0.3404 -0.7503,0.2713 -0.3739,-0.069 -0.6442,-0.3024 -0.6039,-0.5213 0.0404,-0.2189 0.3764,-0.3403 0.7503,-0.2713 0.374,0.069 0.6442,0.3024 0.6039,0.5213z"/> + <path android:fillColor="#ee505a" android:pathData="m17.776,28.9927c-0.0289,0.2207 -0.3583,0.3593 -0.7351,0.3096 -0.3771,-0.0496 -0.6592,-0.2689 -0.6299,-0.4896 0.0289,-0.2207 0.3582,-0.3592 0.7351,-0.3096 0.377,0.0496 0.6591,0.2689 0.6299,0.4896z"/> + <path android:fillColor="#FF000000" + android:pathData="m25.8152,18.0824c-0.9425,-0.0235 -1.8982,0.1801 -2.7771,0.6072 -0.1549,0.0753 -0.3047,0.1536 -0.4498,0.2346 -0.145,0.081 -0.2852,0.1648 -0.4207,0.2511 -1.6266,1.035 -2.5815,2.4249 -3.1416,3.6881 -0.0933,0.2105 -0.1758,0.4176 -0.2485,0.6189 -0.0654,0.1811 -0.1221,0.36 -0.1752,0.5375 -0.0143,0.0477 -0.028,0.0948 -0.0414,0.1421 -0.046,0.1621 -0.0887,0.3224 -0.1256,0.4794 -0.0029,0.0123 -0.0064,0.0251 -0.0092,0.0374 -0.0387,0.1674 -0.0711,0.3298 -0.1006,0.4894 -0.0085,0.0459 -0.0164,0.0907 -0.0242,0.1358 -0.0242,0.1398 -0.0458,0.2765 -0.0638,0.4081 -0.0023,0.0165 -0.0052,0.0339 -0.0074,0.0503 -0.0194,0.1463 -0.0343,0.2849 -0.0472,0.4189 -0.0036,0.038 -0.0068,0.0743 -0.01,0.1112 -0.0063,0.0728 -0.0103,0.138 -0.015,0.2063 -0.0064,0.0938 -0.0101,0.1722 -0.0139,0.2568 -0.0094,0.2095 -0.0143,0.3961 -0.0133,0.5402 0,0.0043 -0.0004,0.0122 -0.0004,0.0165 0.0001,-0 0.0001,0 0.0002,0 0,0.0015 -0,0.0037 0,0.0052 -0,-0.0032 -0.0002,-0.002 -0.0002,-0.0052 -3.4012,1.1528 -4.0163,2.4698 -4.0163,2.4698 0,0 4.8578,1.7117 11.2862,1.6722 6.4284,0.0395 11.2862,-1.6722 11.2862,-1.6722 0,0 -0.6439,-1.3804 -4.2628,-2.5518 -0,-0.0003 0,-0.0007 0,-0.0009 -0.0138,-0.2232 -0.0307,-0.4428 -0.0507,-0.6585 -0,-0.0001 0,-0.0001 0,-0.0002 -0,-0.0001 0,-0.0001 0,-0.0002 -0.0201,-0.2159 -0.0433,-0.4281 -0.0696,-0.6365 -0.0263,-0.2084 -0.0557,-0.413 -0.0883,-0.6137 -0,-0.0001 0,-0.0003 0,-0.0004 -0,-0.0002 -0.0002,-0.0004 -0.0002,-0.0006 -0.0325,-0.2002 -0.0679,-0.3969 -0.1066,-0.5895 -0.0001,-0.0004 -0.0001,-0.0008 -0.0002,-0.0011 -0.0002,-0.0009 -0.0004,-0.0017 -0.0006,-0.0026 -0.0383,-0.1906 -0.0795,-0.3775 -0.124,-0.5606 -0.0014,-0.0058 -0.003,-0.0114 -0.0044,-0.0172 -0.0434,-0.1779 -0.0894,-0.3526 -0.1386,-0.5234 -0.0035,-0.0123 -0.0074,-0.0242 -0.0109,-0.0364 -0.0476,-0.1637 -0.0975,-0.3247 -0.1504,-0.4818 -0.0064,-0.019 -0.0133,-0.0373 -0.0198,-0.0562 -0.0512,-0.1492 -0.1041,-0.2962 -0.16,-0.4394 -0.0103,-0.0265 -0.0215,-0.0518 -0.032,-0.0781 -0.1849,-0.462 -0.3936,-0.8939 -0.6292,-1.291 -0.0817,-0.1378 -0.1664,-0.2719 -0.2542,-0.4019 -0.0005,-0.0007 -0.0009,-0.0014 -0.0013,-0.002 -0.0009,-0.0012 -0.0018,-0.0023 -0.0026,-0.0035 -0.0868,-0.1282 -0.1764,-0.2528 -0.2692,-0.3734 -0.0023,-0.003 -0.0047,-0.0059 -0.007,-0.0089 -0.0917,-0.1187 -0.186,-0.234 -0.2834,-0.3452 -0.0047,-0.0054 -0.0097,-0.0105 -0.0144,-0.0159 -0.0959,-0.1088 -0.1944,-0.2143 -0.2958,-0.3158 -0.0055,-0.0055 -0.0113,-0.0108 -0.0168,-0.0163 -0.1029,-0.1023 -0.2082,-0.2013 -0.3167,-0.296 -0.0609,-0.0532 -0.122,-0.1043 -0.183,-0.1539 -0.1221,-0.0988 -0.2474,-0.1917 -0.3758,-0.2785 -0.1284,-0.0868 -0.2598,-0.1675 -0.3937,-0.2424 -0.1339,-0.0748 -0.2704,-0.1437 -0.4091,-0.2067 -0.1387,-0.0629 -0.2796,-0.1197 -0.4224,-0.1708 -0.1428,-0.051 -0.2873,-0.0963 -0.4333,-0.1354 -0.1461,-0.0392 -0.2936,-0.0724 -0.4422,-0.0997 -0.1486,-0.0273 -0.2983,-0.0487 -0.4487,-0.0642 -0.0001,-0 -0.0001,0 -0.0002,0 -0.1504,-0.0155 -0.3015,-0.0253 -0.4529,-0.029zM25.7774,21.058c0.1254,0.0011 0.2484,0.0067 0.3689,0.0168 1.5663,0.1313 2.7203,1.0027 3.5638,2.0833 0.1106,-0.1175 0.2666,-0.1917 0.4405,-0.1917 0.3352,0 0.6069,0.2714 0.6069,0.6065 0,0.2583 -0.1625,0.4775 -0.3898,0.5649 0.0949,0.1635 0.1841,0.328 0.2681,0.4921 0.252,0.4925 0.4562,0.9816 0.62,1.4269 0.116,0.3157 0.2193,0.6233 0.3123,0.9199 0,0 0.0002,-0 0.0002,0 0.0999,0.3185 0.1877,0.6242 0.2638,0.9108 0.0001,0.0003 0.0001,0.0005 0.0002,0.0008 -0.0034,0.0016 -0.0073,0.0034 -0.0111,0.0052 -0.1542,0.0744 -0.339,0.1584 -0.5493,0.2476 -0.0258,0.0109 -0.05,0.0213 -0.0766,0.0324 -0.09,0.0375 -0.1847,0.0754 -0.2838,0.1142 -0.0274,0.0107 -0.0526,0.0211 -0.0807,0.0318 -0.1259,0.0483 -0.2592,0.0971 -0.3987,0.146 -0.0323,0.0113 -0.0664,0.0224 -0.0994,0.0337 -0.1118,0.0383 -0.2273,0.0763 -0.3471,0.1142 -0.0469,0.0148 -0.0936,0.0295 -0.1417,0.0442 -0.1393,0.0426 -0.2831,0.0845 -0.4322,0.1254 -0.0201,0.0055 -0.0388,0.0112 -0.059,0.0167 -0.1715,0.0463 -0.35,0.0908 -0.5338,0.1336 -0.0461,0.0107 -0.0938,0.0206 -0.1406,0.0311 -0.1409,0.0315 -0.285,0.0614 -0.4326,0.0901 -0.0589,0.0114 -0.1173,0.0229 -0.1772,0.0339 -0.1774,0.0324 -0.3585,0.0626 -0.5447,0.0899 -0.0229,0.0034 -0.0445,0.0075 -0.0675,0.0107 -0.2075,0.0296 -0.4217,0.0547 -0.6396,0.0768 -0.0586,0.0059 -0.1183,0.0106 -0.1776,0.0159 -0.1679,0.0151 -0.3384,0.0277 -0.5119,0.0377 -0.0672,0.0039 -0.1338,0.008 -0.2019,0.0111 -0.2326,0.0104 -0.4685,0.0176 -0.7105,0.0176 -0.2508,0 -0.5068,-0.0064 -0.7671,-0.0191 -0.0203,-0.001 -0.0409,-0.0025 -0.0612,-0.0035 -0.2397,-0.0126 -0.4833,-0.0309 -0.7304,-0.0553 -0.0364,-0.0036 -0.073,-0.0076 -0.1095,-0.0115 -0.2324,-0.0246 -0.4679,-0.0548 -0.7064,-0.0908 -0.0483,-0.0073 -0.0964,-0.0145 -0.1449,-0.0222 -0.2322,-0.0372 -0.4675,-0.0806 -0.7051,-0.1295 -0.0543,-0.0112 -0.1083,-0.0217 -0.1628,-0.0335 -0.2446,-0.053 -0.4921,-0.1129 -0.7419,-0.1791 -0.1685,-0.0446 -0.3383,-0.0928 -0.509,-0.1438 -0.0018,-0.0006 -0.0036,-0.0009 -0.0054,-0.0015 -0.0139,-0.0041 -0.0277,-0.0082 -0.0416,-0.0124 -0.001,-0.0003 -0.002,-0.0007 -0.003,-0.0009 -0.5348,-0.1614 -1.0799,-0.3543 -1.6344,-0.5837 0.0398,-0.4355 0.1082,-0.912 0.2179,-1.4046 0.0254,-0.114 0.053,-0.2289 0.0831,-0.3443 0.0026,-0.0099 0.0053,-0.0199 0.008,-0.0298 0.0285,-0.1081 0.0594,-0.2167 0.0923,-0.3256 0.0041,-0.0136 0.008,-0.0272 0.0122,-0.0409 0.0356,-0.1156 0.0737,-0.2315 0.1147,-0.3473 0.0053,-0.0149 0.0111,-0.0298 0.0165,-0.0448 0.0356,-0.0989 0.0734,-0.1977 0.1132,-0.2962 0.0098,-0.0242 0.0196,-0.0484 0.0296,-0.0725 0.0467,-0.1125 0.0957,-0.2245 0.1482,-0.336 0.0051,-0.0108 0.0106,-0.0214 0.0157,-0.0322 0.0467,-0.0978 0.0962,-0.1948 0.1476,-0.2914 0.0162,-0.0304 0.0325,-0.0608 0.0492,-0.091 0.0589,-0.1068 0.1197,-0.213 0.1848,-0.3177 -0.0429,-0.0268 -0.0823,-0.0587 -0.1173,-0.0949 -0.035,-0.0362 -0.0656,-0.0767 -0.0908,-0.1206 -0.0252,-0.0439 -0.0451,-0.0914 -0.0587,-0.1414 -0.0135,-0.05 -0.0207,-0.1025 -0.0207,-0.1569 0,-0.3351 0.2718,-0.6065 0.6069,-0.6065 0.1583,0 0.3012,0.0619 0.4091,0.1611 0.1144,-0.1238 0.2352,-0.2442 0.3626,-0.3606 0.1275,-0.1164 0.2616,-0.2288 0.4028,-0.3365 0.1412,-0.1078 0.2894,-0.2109 0.445,-0.309 0.1556,-0.098 0.3187,-0.1909 0.4894,-0.2781 0.6828,-0.3487 1.4893,-0.6058 2.4415,-0.7347 0.1355,-0.0183 0.2685,-0.0316 0.3989,-0.04 0.1304,-0.0084 0.2583,-0.0118 0.3837,-0.0107zM21.8323,28.9836c0.0514,0.0111 0.1024,0.0211 0.1536,0.0316 -0.0019,-0.0004 -0.0038,-0.0007 -0.0057,-0.0011 -0.0479,-0.0099 -0.0953,-0.0191 -0.1434,-0.0294 -0.0015,-0.0003 -0.003,-0.0008 -0.0044,-0.0011z" android:strokeWidth="0.12630458"/> + <path android:fillColor="#403f6a" android:pathData="m24.1018,24.0103c0,0.4959 -0.4019,0.8974 -0.8965,0.8974 -0.4963,0 -0.8978,-0.4015 -0.8978,-0.8974 0,-0.4955 0.4015,-0.8969 0.8978,-0.8969 0.4946,0 0.8965,0.4015 0.8965,0.8969z"/> + <path android:fillColor="#403f6a" android:pathData="m28.4489,24.0103c0,0.4959 -0.4015,0.8974 -0.8974,0.8974 -0.4955,0 -0.8974,-0.4015 -0.8974,-0.8974 0,-0.4955 0.4019,-0.8969 0.8974,-0.8969 0.4959,0 0.8974,0.4015 0.8974,0.8969z"/> + <path android:fillColor="#403f6a" + android:pathData="m23.2423,26.95c0.3552,0.5704 0.8945,1.0971 1.5213,1.3502 1.244,0.5025 2.264,-0.3483 2.9828,-1.2942 0.2727,-0.3587 -0.3353,-0.7077 -0.6045,-0.3533 -0.6322,0.8328 -1.5087,1.473 -2.4891,0.7944 -0.3157,-0.2186 -0.6022,-0.5228 -0.8063,-0.8504 -0.2371,-0.3817 -0.8431,-0.0307 -0.6042,0.3533z" android:strokeWidth="0.3835899"/> + <path android:fillColor="#f8a24f" + android:pathData="m22.3631,26.5996c0,0.4895 -0.4508,0.8865 -1.0069,0.8865 -0.5561,0 -1.0069,-0.397 -1.0069,-0.8865 0,-0.4898 0.4508,-0.8868 1.0069,-0.8868 0.5561,0 1.0069,0.397 1.0069,0.8868z" android:strokeWidth="0.24031371"/> + <path android:fillColor="#f8a24f" + android:pathData="m30.2259,26.5996c0,0.4895 -0.4508,0.8865 -1.0072,0.8865 -0.5561,0 -1.0067,-0.397 -1.0067,-0.8865 0,-0.4898 0.4506,-0.8868 1.0067,-0.8868 0.5563,0 1.0072,0.397 1.0072,0.8868z" android:strokeWidth="0.24031371"/> + </group> + </group> +</vector> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e0a00dca..1293fe57 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -637,6 +637,9 @@ <string name="settings_reddit_user_agreement_title">Reddit User Agreement</string> <string name="settings_always_show_child_comment_count_title">Always Show the Number of Child Comments</string> <string name="settings_hide_upvote_ratio_title">Hide Upvote Ratio</string> + <string name="settings_miscellaneous_dangerous_group_title">Dangerous</string> + <string name="settings_post_feed_max_resolution_warning_title">Increase the value to show previews in higher resolution, but the app may crash unexpectedly.</string> + <string name="settings_post_feed_max_resolution_title">Post Feed Preview Max Resolution (Width * Height)</string> <string name="no_link_available">Cannot get the link</string> @@ -1283,4 +1286,6 @@ <string name="option_5_hint">Option 5</string> <string name="option_6_hint">Option 6</string> + <string name="not_a_valid_number">Not a valid number</string> + </resources> diff --git a/app/src/main/res/xml/miscellaneous_preferences.xml b/app/src/main/res/xml/miscellaneous_preferences.xml index 132df3d8..1ae7ed8f 100644 --- a/app/src/main/res/xml/miscellaneous_preferences.xml +++ b/app/src/main/res/xml/miscellaneous_preferences.xml @@ -40,4 +40,18 @@ app:title="@string/settings_language_title" app:useSimpleSummaryProvider="true" /> + <ml.docilealligator.infinityforreddit.customviews.CustomFontPreferenceCategory + app:title="@string/settings_miscellaneous_dangerous_group_title" /> + + <ml.docilealligator.infinityforreddit.customviews.CustomFontPreference + app:icon="@drawable/ic_info_preference_24dp" + app:summary="@string/settings_post_feed_max_resolution_warning_title" + app:enabled="false" /> + + <ml.docilealligator.infinityforreddit.customviews.CustomFontEditTextPreference + app:defaultValue="5000000" + app:key="post_feed_max_resolution" + app:title="@string/settings_post_feed_max_resolution_title" + app:useSimpleSummaryProvider="true" /> + </PreferenceScreen>
\ No newline at end of file |