diff options
Diffstat (limited to 'app/src/main/java/ml')
38 files changed, 49 insertions, 63 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java index deebb612..40a81378 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java @@ -225,7 +225,7 @@ public abstract class BaseActivity extends AppCompatActivity implements CustomFo } } - protected abstract SharedPreferences getDefaultSharedPreferences(); + public abstract SharedPreferences getDefaultSharedPreferences(); protected abstract CustomThemeWrapper getCustomThemeWrapper(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java index 3ad2c699..495a6df4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java @@ -213,7 +213,7 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA ImageAndGifPlugin imageAndGifPlugin = new ImageAndGifPlugin(); Markwon postBodyMarkwon = MarkdownUtils.createFullRedditMarkwon(this, miscPlugin, imageAndGifPlugin, parentTextColor, parentSpoilerBackgroundColor, null); - MarkwonAdapter markwonAdapter = MarkdownUtils.createTablesAdapter(new ImageAndGifEntry(this, mGlide, new ImageAndGifEntry.OnItemClickListener() { + MarkwonAdapter markwonAdapter = MarkdownUtils.createTablesAdapter(new ImageAndGifEntry(this, mSharedPreferences, mGlide, new ImageAndGifEntry.OnItemClickListener() { @Override public void onItemClick(Post.MediaMetadata mediaMetadata) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterPreferenceActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterPreferenceActivity.java index 74a65218..11a1aa9a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterPreferenceActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterPreferenceActivity.java @@ -138,7 +138,7 @@ public class CommentFilterPreferenceActivity extends BaseActivity { } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return sharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterUsageListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterUsageListingActivity.java index 7a1d6662..2a05936f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterUsageListingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterUsageListingActivity.java @@ -160,7 +160,7 @@ public class CommentFilterUsageListingActivity extends BaseActivity { } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return sharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemeListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemeListingActivity.java index c47023e5..3e983761 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemeListingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemeListingActivity.java @@ -9,7 +9,6 @@ import android.os.Handler; import android.text.TextUtils; import android.view.MenuItem; import android.view.View; -import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.Toast; @@ -143,7 +142,7 @@ public class CustomThemeListingActivity extends BaseActivity implements } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return sharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeCommentFilterActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeCommentFilterActivity.java index 94dcd532..991bc7a9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeCommentFilterActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeCommentFilterActivity.java @@ -1,10 +1,8 @@ package ml.docilealligator.infinityforreddit.activities; -import android.Manifest; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; -import android.content.pm.PackageManager; import android.content.res.ColorStateList; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; @@ -20,7 +18,6 @@ import android.widget.Toast; import androidx.activity.result.ActivityResultLauncher; import androidx.activity.result.contract.ActivityResultContracts; import androidx.annotation.NonNull; -import androidx.core.content.ContextCompat; import com.google.android.material.dialog.MaterialAlertDialogBuilder; @@ -39,7 +36,6 @@ import ml.docilealligator.infinityforreddit.commentfilter.CommentFilter; import ml.docilealligator.infinityforreddit.commentfilter.SaveCommentFilter; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.databinding.ActivityCustomizeCommentFilterBinding; -import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.utils.Utils; public class CustomizeCommentFilterActivity extends BaseActivity { @@ -156,7 +152,7 @@ public class CustomizeCommentFilterActivity extends BaseActivity { } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java index 0cb3e54b..815f89ee 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java @@ -370,7 +370,7 @@ public class CustomizePostFilterActivity extends BaseActivity { } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeThemeActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeThemeActivity.java index ddc0962d..1372c235 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeThemeActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeThemeActivity.java @@ -245,7 +245,7 @@ public class CustomizeThemeActivity extends BaseActivity { } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return sharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java index 3f7079a2..96bfcad3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java @@ -44,8 +44,6 @@ import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; -import ml.docilealligator.infinityforreddit.customviews.slidr.model.SlidrInterface; -import ml.docilealligator.infinityforreddit.customviews.slidr.widget.SliderPanel; import ml.docilealligator.infinityforreddit.events.SubmitChangeAvatarEvent; import ml.docilealligator.infinityforreddit.events.SubmitChangeBannerEvent; import ml.docilealligator.infinityforreddit.events.SubmitSaveProfileEvent; @@ -333,7 +331,7 @@ public class EditProfileActivity extends BaseActivity { @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FetchRandomSubredditOrPostActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FetchRandomSubredditOrPostActivity.java index 365209b1..e5e8a3b8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FetchRandomSubredditOrPostActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FetchRandomSubredditOrPostActivity.java @@ -89,7 +89,7 @@ public class FetchRandomSubredditOrPostActivity extends BaseActivity { } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java index 73092f1d..0825a8fa 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java @@ -146,8 +146,8 @@ public class FullMarkdownActivity extends BaseActivity { Markwon markwon = MarkdownUtils.createFullRedditMarkwon(this, miscPlugin, imageAndGifPlugin, markdownColor, spoilerBackgroundColor, null); - MarkwonAdapter markwonAdapter = MarkdownUtils.createTablesAdapter(new ImageAndGifEntry(this, Glide.with(this), - new ImageAndGifEntry.OnItemClickListener() { + MarkwonAdapter markwonAdapter = MarkdownUtils.createTablesAdapter(new ImageAndGifEntry(this, + mSharedPreferences, Glide.with(this), new ImageAndGifEntry.OnItemClickListener() { @Override public void onItemClick(Post.MediaMetadata mediaMetadata) { @@ -200,7 +200,7 @@ public class FullMarkdownActivity extends BaseActivity { } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LockScreenActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LockScreenActivity.java index 12f5f929..0224648c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LockScreenActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LockScreenActivity.java @@ -84,7 +84,7 @@ public class LockScreenActivity extends BaseActivity { @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java index 670729c0..d91d1c87 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java @@ -92,7 +92,6 @@ import ml.docilealligator.infinityforreddit.bottomsheetfragments.FABMoreOptionsB import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostLayoutBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostTypeBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.RandomBottomSheetFragment; -import ml.docilealligator.infinityforreddit.bottomsheetfragments.ImportantInfoBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.SortTimeBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.SortTypeBottomSheetFragment; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java index d3214f50..c8d99a0b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java @@ -130,7 +130,7 @@ public class MultiredditSelectionActivity extends BaseActivity implements Activi } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java index c838c07d..e54b9730 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java @@ -208,7 +208,7 @@ public class PostFilterPreferenceActivity extends BaseActivity { } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return sharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterUsageListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterUsageListingActivity.java index bb3265fa..37759e57 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterUsageListingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterUsageListingActivity.java @@ -194,7 +194,7 @@ public class PostFilterUsageListingActivity extends BaseActivity { } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return sharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java index e66eb57f..b5a63083 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java @@ -419,7 +419,7 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java index fccbd61b..1b9e3cc3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java @@ -33,7 +33,6 @@ import com.google.android.material.divider.MaterialDivider; import com.google.android.material.materialswitch.MaterialSwitch; import com.google.android.material.slider.Slider; import com.google.android.material.snackbar.Snackbar; -import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.textfield.TextInputEditText; import com.google.android.material.textfield.TextInputLayout; import com.google.gson.Gson; @@ -401,7 +400,7 @@ public class PostPollActivity extends BaseActivity implements FlairBottomSheetFr } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java index c1c3dfe0..58968bc3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java @@ -36,7 +36,6 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.divider.MaterialDivider; import com.google.android.material.materialswitch.MaterialSwitch; import com.google.android.material.snackbar.Snackbar; -import com.google.android.material.switchmaterial.SwitchMaterial; import com.libRG.CustomTextView; import org.greenrobot.eventbus.EventBus; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ReportActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ReportActivity.java index 8ef82bd6..4f928827 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ReportActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ReportActivity.java @@ -184,7 +184,7 @@ public class ReportActivity extends BaseActivity { } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/RulesActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/RulesActivity.java index e7923cd6..54991517 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/RulesActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/RulesActivity.java @@ -38,7 +38,6 @@ import ml.docilealligator.infinityforreddit.Rule; import ml.docilealligator.infinityforreddit.adapters.RulesRecyclerViewAdapter; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; -import ml.docilealligator.infinityforreddit.customviews.slidr.model.SlidrInterface; import ml.docilealligator.infinityforreddit.customviews.slidr.widget.SliderPanel; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchUsersResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchUsersResultActivity.java index 122ee34c..86f064e0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchUsersResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchUsersResultActivity.java @@ -125,7 +125,7 @@ public class SearchUsersResultActivity extends BaseActivity implements ActivityT } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SelectUserFlairActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SelectUserFlairActivity.java index 82cb3198..1dc61d96 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SelectUserFlairActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SelectUserFlairActivity.java @@ -219,7 +219,7 @@ public class SelectUserFlairActivity extends BaseActivity implements ActivityToo } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SelectedSubredditsAndUsersActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SelectedSubredditsAndUsersActivity.java index 80ac0828..bc89f1de 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SelectedSubredditsAndUsersActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SelectedSubredditsAndUsersActivity.java @@ -181,7 +181,7 @@ public class SelectedSubredditsAndUsersActivity extends BaseActivity implements } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SendPrivateMessageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SendPrivateMessageActivity.java index eb38ef3c..0f12c15c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SendPrivateMessageActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SendPrivateMessageActivity.java @@ -162,7 +162,7 @@ public class SendPrivateMessageActivity extends BaseActivity { } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java index 392535c0..97c82b66 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java @@ -429,7 +429,7 @@ public class SubmitCrosspostActivity extends BaseActivity implements FlairBottom } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SuicidePreventionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SuicidePreventionActivity.java index 81710e98..82f27104 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SuicidePreventionActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SuicidePreventionActivity.java @@ -68,7 +68,7 @@ public class SuicidePreventionActivity extends BaseActivity { } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/TrendingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/TrendingActivity.java index a12307b2..c4ecdcfc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/TrendingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/TrendingActivity.java @@ -314,7 +314,7 @@ public class TrendingActivity extends BaseActivity { } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPrivateMessagesActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPrivateMessagesActivity.java index 46656aa4..a32fc8cc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPrivateMessagesActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPrivateMessagesActivity.java @@ -297,7 +297,7 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java index 7917a662..521b0dd1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java @@ -13,7 +13,6 @@ import android.os.Bundle; import android.os.Handler; import android.text.Editable; import android.text.TextWatcher; -import android.text.util.Linkify; import android.view.Gravity; import android.view.KeyEvent; import android.view.Menu; @@ -71,13 +70,6 @@ import io.noties.markwon.Markwon; import io.noties.markwon.MarkwonConfiguration; import io.noties.markwon.MarkwonPlugin; import io.noties.markwon.core.MarkwonTheme; -import io.noties.markwon.ext.strikethrough.StrikethroughPlugin; -import io.noties.markwon.inlineparser.BangInlineProcessor; -import io.noties.markwon.inlineparser.HtmlInlineProcessor; -import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin; -import io.noties.markwon.linkify.LinkifyPlugin; -import io.noties.markwon.movement.MovementMethodPlugin; -import io.noties.markwon.recycler.table.TableEntryPlugin; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; import me.saket.bettermovementmethod.BetterLinkMovementMethod; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; @@ -106,17 +98,12 @@ import ml.docilealligator.infinityforreddit.bottomsheetfragments.UrlMenuBottomSh import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.NavigationWrapper; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; -import ml.docilealligator.infinityforreddit.customviews.slidr.widget.SliderPanel; import ml.docilealligator.infinityforreddit.events.ChangeNSFWEvent; import ml.docilealligator.infinityforreddit.events.GoBackToMainPageEvent; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; import ml.docilealligator.infinityforreddit.fragments.PostFragment; import ml.docilealligator.infinityforreddit.fragments.SidebarFragment; import ml.docilealligator.infinityforreddit.markdown.MarkdownUtils; -import ml.docilealligator.infinityforreddit.markdown.RedditHeadingPlugin; -import ml.docilealligator.infinityforreddit.markdown.SpoilerAwareMovementMethod; -import ml.docilealligator.infinityforreddit.markdown.SpoilerParserPlugin; -import ml.docilealligator.infinityforreddit.markdown.SuperscriptPlugin; import ml.docilealligator.infinityforreddit.message.ReadMessage; import ml.docilealligator.infinityforreddit.multireddit.MultiReddit; import ml.docilealligator.infinityforreddit.post.Post; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java index febce817..2fb72f3f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java @@ -95,8 +95,6 @@ import ml.docilealligator.infinityforreddit.bottomsheetfragments.UserThingSortTy import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.NavigationWrapper; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; -import ml.docilealligator.infinityforreddit.customviews.slidr.model.SlidrInterface; -import ml.docilealligator.infinityforreddit.customviews.slidr.widget.SliderPanel; import ml.docilealligator.infinityforreddit.events.ChangeNSFWEvent; import ml.docilealligator.infinityforreddit.events.GoBackToMainPageEvent; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java index c61bb41b..adff13a1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java @@ -110,7 +110,7 @@ public class WebViewActivity extends BaseActivity { } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java index 01acf928..2df36e7b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java @@ -183,8 +183,8 @@ public class WikiActivity extends BaseActivity { markwon = MarkdownUtils.createFullRedditMarkwon(this, miscPlugin, imageAndGifPlugin, markdownColor, spoilerBackgroundColor, onLinkLongClickListener); - markwonAdapter = MarkdownUtils.createTablesAdapter(new ImageAndGifEntry(this, mGlide, - new ImageAndGifEntry.OnItemClickListener() { + markwonAdapter = MarkdownUtils.createTablesAdapter(new ImageAndGifEntry(this, mSharedPreferences, + mGlide, new ImageAndGifEntry.OnItemClickListener() { @Override public void onItemClick(Post.MediaMetadata mediaMetadata) { @@ -296,7 +296,7 @@ public class WikiActivity extends BaseActivity { } @Override - protected SharedPreferences getDefaultSharedPreferences() { + public SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; } 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 63206e06..e3746a7e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java @@ -293,7 +293,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler mImageAndGifPlugin = new ImageAndGifPlugin(); mPostDetailMarkwon = MarkdownUtils.createFullRedditMarkwon(mActivity, miscPlugin, mImageAndGifPlugin, markdownColor, postSpoilerBackgroundColor, onLinkLongClickListener); - mMarkwonAdapter = MarkdownUtils.createTablesAdapter(new ImageAndGifEntry(activity, mGlide, new ImageAndGifEntry.OnItemClickListener() { + mMarkwonAdapter = MarkdownUtils.createTablesAdapter(new ImageAndGifEntry(activity, sharedPreferences, + mGlide, new ImageAndGifEntry.OnItemClickListener() { @Override public void onItemClick(Post.MediaMetadata mediaMetadata) { Intent intent = new Intent(activity, ViewImageOrGifActivity.class); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java index 906f95c4..1f0a8451 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java @@ -143,7 +143,8 @@ public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecycler if (activity.typeface != null) { shortNameTextView.setTypeface(activity.typeface); } - markwonAdapter = MarkdownUtils.createTablesAdapter(new ImageAndGifEntry(activity, Glide.with(activity), + markwonAdapter = MarkdownUtils.createTablesAdapter(new ImageAndGifEntry(activity, + activity.getDefaultSharedPreferences(), Glide.with(activity), new ImageAndGifEntry.OnItemClickListener() { @Override public void onItemClick(Post.MediaMetadata mediaMetadata) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java index 9c438448..54cd4241 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java @@ -150,7 +150,8 @@ public class SidebarFragment extends Fragment { ImageAndGifPlugin imageAndGifPlugin = new ImageAndGifPlugin(); Markwon markwon = MarkdownUtils.createFullRedditMarkwon(activity, miscPlugin, imageAndGifPlugin, markdownColor, spoilerBackgroundColor, onLinkLongClickListener); - MarkwonAdapter markwonAdapter = MarkdownUtils.createTablesAdapter(new ImageAndGifEntry(activity, Glide.with(this), + MarkwonAdapter markwonAdapter = MarkdownUtils.createTablesAdapter(new ImageAndGifEntry(activity, + activity.getDefaultSharedPreferences(),Glide.with(this), new ImageAndGifEntry.OnItemClickListener() { @Override public void onItemClick(Post.MediaMetadata mediaMetadata) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifEntry.java b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifEntry.java index 18834f90..1e3460ec 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifEntry.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifEntry.java @@ -1,5 +1,6 @@ package ml.docilealligator.infinityforreddit.markdown; +import android.content.SharedPreferences; import android.graphics.drawable.Drawable; import android.view.LayoutInflater; import android.view.View; @@ -19,18 +20,24 @@ import com.bumptech.glide.request.target.Target; import io.noties.markwon.Markwon; import io.noties.markwon.recycler.MarkwonAdapter; import jp.wasabeef.glide.transformations.BlurTransformation; +import ml.docilealligator.infinityforreddit.SaveMemoryCenterInisdeDownsampleStrategy; import ml.docilealligator.infinityforreddit.activities.BaseActivity; import ml.docilealligator.infinityforreddit.databinding.MarkdownImageAndGifBlockBinding; import ml.docilealligator.infinityforreddit.post.Post; +import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; public class ImageAndGifEntry extends MarkwonAdapter.Entry<ImageAndGifBlock, ImageAndGifEntry.Holder> { private BaseActivity baseActivity; private RequestManager glide; + private SaveMemoryCenterInisdeDownsampleStrategy saveMemoryCenterInsideDownsampleStrategy; private OnItemClickListener onItemClickListener; - public ImageAndGifEntry(BaseActivity baseActivity, RequestManager glide, OnItemClickListener onItemClickListener) { + public ImageAndGifEntry(BaseActivity baseActivity, SharedPreferences sharedPreferences, + RequestManager glide, OnItemClickListener onItemClickListener) { this.baseActivity = baseActivity; this.glide = glide; + this.saveMemoryCenterInsideDownsampleStrategy = new SaveMemoryCenterInisdeDownsampleStrategy( + Integer.parseInt(sharedPreferences.getString(SharedPreferencesUtils.POST_FEED_MAX_RESOLUTION, "5000000"))); this.onItemClickListener = onItemClickListener; } @@ -52,7 +59,7 @@ public class ImageAndGifEntry extends MarkwonAdapter.Entry<ImageAndGifBlock, Ima imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))) .into(holder.binding.imageViewMarkdownImageAndGifBlock); } else { - imageRequestBuilder.centerInside().into(holder.binding.imageViewMarkdownImageAndGifBlock); + imageRequestBuilder.centerInside().downsample(saveMemoryCenterInsideDownsampleStrategy).into(holder.binding.imageViewMarkdownImageAndGifBlock); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java index a7cb137b..379d63b6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java @@ -788,6 +788,7 @@ public class Post implements Parcelable { protected MediaMetadata(Parcel in) { id = in.readString(); e = in.readString(); + fileName = in.readString(); original = in.readParcelable(MediaItem.class.getClassLoader()); downscaled = in.readParcelable(MediaItem.class.getClassLoader()); } @@ -813,6 +814,7 @@ public class Post implements Parcelable { public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeString(id); dest.writeString(e); + dest.writeString(fileName); dest.writeParcelable(original, flags); dest.writeParcelable(downscaled, flags); } |