diff options
author | Alex Ning <chineseperson5@gmail.com> | 2020-07-18 04:45:40 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2020-07-18 04:45:40 +0000 |
commit | 3a621e290190e67f777e4f442398a4db120aa7af (patch) | |
tree | cab2d07f51f9ecb3ddad0299af6a0b8179314a9e | |
parent | 39ae0d3aaf0eba042ca70e7fd67fcea0349af156 (diff) | |
download | infinity-for-reddit-3a621e290190e67f777e4f442398a4db120aa7af.tar infinity-for-reddit-3a621e290190e67f777e4f442398a4db120aa7af.tar.gz infinity-for-reddit-3a621e290190e67f777e4f442398a4db120aa7af.tar.bz2 infinity-for-reddit-3a621e290190e67f777e4f442398a4db120aa7af.tar.lz infinity-for-reddit-3a621e290190e67f777e4f442398a4db120aa7af.tar.xz infinity-for-reddit-3a621e290190e67f777e4f442398a4db120aa7af.tar.zst infinity-for-reddit-3a621e290190e67f777e4f442398a4db120aa7af.zip |
Fix subreddits not showing in SelectedSubredditsActivity when editing a multireddit by clicking Editing Multireddit in MultiRedditOptionsBottomSheetFragment. Support gfycat.com/ifr/<id>.
3 files changed, 7 insertions, 7 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditMultiRedditActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditMultiRedditActivity.java index 4d3943d7..60945420 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditMultiRedditActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditMultiRedditActivity.java @@ -42,7 +42,6 @@ import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import retrofit2.Retrofit; public class EditMultiRedditActivity extends BaseActivity { - public static final String EXTRA_MULTI_REDDIT = "EMR"; public static final String EXTRA_MULTI_PATH = "EMP"; private static final int SUBREDDIT_SELECTION_REQUEST_CODE = 1; private static final String NULL_ACCESS_TOKEN_STATE = "NATS"; @@ -126,7 +125,6 @@ public class EditMultiRedditActivity extends BaseActivity { bindView(); } } else { - multiReddit = getIntent().getParcelableExtra(EXTRA_MULTI_REDDIT); multipath = getIntent().getStringExtra(EXTRA_MULTI_PATH); getCurrentAccountAndBindView(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java index 95e98f40..15a072d8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java @@ -39,7 +39,7 @@ public class LinkResolverActivity extends AppCompatActivity { private static final String MULTIREDDIT_PATTERN = "/user/\\w+/m/\\w+/?"; private static final String MULTIREDDIT_PATTERN_2 = "/[rR]/(\\w+\\+?)+/?"; private static final String REDD_IT_POST_PATTERN = "/\\w+/?"; - private static final String GFYCAT_PATTERN = "/[\\w-]+$"; + private static final String GFYCAT_PATTERN = "(/ifr)?/[\\w-]+$"; private static final String REDGIFS_PATTERN = "/watch/[\\w-]+$"; private static final String IMGUR_GALLERY_PATTERN = "/gallery/\\w+/?"; private static final String IMGUR_ALBUM_PATTERN = "/(album|a)/\\w+/?"; @@ -185,7 +185,7 @@ public class LinkResolverActivity extends AppCompatActivity { } else if (authority.contains("gfycat.com")) { if (path.matches(GFYCAT_PATTERN)) { Intent intent = new Intent(this, ViewVideoActivity.class); - intent.putExtra(ViewVideoActivity.EXTRA_GFYCAT_ID, path.substring(1)); + intent.putExtra(ViewVideoActivity.EXTRA_GFYCAT_ID, path.substring(path.lastIndexOf("/") + 1)); intent.putExtra(ViewVideoActivity.EXTRA_VIDEO_TYPE, ViewVideoActivity.VIDEO_TYPE_GFYCAT); intent.putExtra(ViewVideoActivity.EXTRA_IS_NSFW, getIntent().getBooleanExtra(EXTRA_IS_NSFW, false)); startActivity(intent); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/MultiRedditOptionsBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/MultiRedditOptionsBottomSheetFragment.java index 27a9ccdc..8c7d49cd 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/MultiRedditOptionsBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/MultiRedditOptionsBottomSheetFragment.java @@ -48,9 +48,11 @@ public class MultiRedditOptionsBottomSheetFragment extends RoundedBottomSheetDia MultiReddit multiReddit = getArguments().getParcelable(EXTRA_MULTI_REDDIT); editMultiRedditTextView.setOnClickListener(view -> { - Intent editIntent = new Intent(subscribedThingListingActivity, EditMultiRedditActivity.class); - editIntent.putExtra(EditMultiRedditActivity.EXTRA_MULTI_REDDIT, multiReddit); - startActivity(editIntent); + if (multiReddit != null) { + Intent editIntent = new Intent(subscribedThingListingActivity, EditMultiRedditActivity.class); + editIntent.putExtra(EditMultiRedditActivity.EXTRA_MULTI_PATH, multiReddit.getPath()); + startActivity(editIntent); + } dismiss(); }); |