diff --git a/app/src/main/java/app/fedilab/android/mastodon/activities/ProfileActivity.java b/app/src/main/java/app/fedilab/android/mastodon/activities/ProfileActivity.java index 9be0b1ee..a1a83bd1 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/activities/ProfileActivity.java +++ b/app/src/main/java/app/fedilab/android/mastodon/activities/ProfileActivity.java @@ -500,7 +500,7 @@ public class ProfileActivity extends BaseActivity { binding.accountPp.setOnClickListener(v -> { Intent intent = new Intent(ProfileActivity.this, MediaActivity.class); - Bundle b = new Bundle(); + Bundle args = new Bundle(); Attachment attachment = new Attachment(); attachment.description = account.acct; attachment.preview_url = account.avatar; @@ -509,13 +509,17 @@ public class ProfileActivity extends BaseActivity { attachment.type = "image"; ArrayList attachments = new ArrayList<>(); attachments.add(attachment); - b.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments); - b.putInt(Helper.ARG_MEDIA_POSITION, 1); - intent.putExtras(b); - ActivityOptionsCompat options = ActivityOptionsCompat - .makeSceneTransitionAnimation(ProfileActivity.this, binding.accountPp, attachment.url); - // start the new activity - startActivity(intent, options.toBundle()); + args.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments); + args.putInt(Helper.ARG_MEDIA_POSITION, 1); + new CachedBundle(ProfileActivity.this).insertBundle(args, currentAccount, bundleId -> { + Bundle bundle = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId); + intent.putExtras(bundle); + ActivityOptionsCompat options = ActivityOptionsCompat + .makeSceneTransitionAnimation(ProfileActivity.this, binding.accountPp, attachment.url); + // start the new activity + startActivity(intent, options.toBundle()); + }); }); diff --git a/app/src/main/java/app/fedilab/android/mastodon/activities/admin/AdminAccountActivity.java b/app/src/main/java/app/fedilab/android/mastodon/activities/admin/AdminAccountActivity.java index fc9ba241..de8c7ba0 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/activities/admin/AdminAccountActivity.java +++ b/app/src/main/java/app/fedilab/android/mastodon/activities/admin/AdminAccountActivity.java @@ -344,7 +344,7 @@ public class AdminAccountActivity extends BaseActivity { MastodonHelper.loadPPMastodon(binding.accountPp, adminAccount.account); binding.accountPp.setOnClickListener(v -> { Intent intent = new Intent(AdminAccountActivity.this, MediaActivity.class); - Bundle b = new Bundle(); + Bundle args = new Bundle(); Attachment attachment = new Attachment(); attachment.description = adminAccount.account.acct; attachment.preview_url = adminAccount.account.avatar; @@ -353,13 +353,17 @@ public class AdminAccountActivity extends BaseActivity { attachment.type = "image"; ArrayList attachments = new ArrayList<>(); attachments.add(attachment); - b.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments); - b.putInt(Helper.ARG_MEDIA_POSITION, 1); - intent.putExtras(b); - ActivityOptionsCompat options = ActivityOptionsCompat - .makeSceneTransitionAnimation(AdminAccountActivity.this, binding.accountPp, attachment.url); - // start the new activity - startActivity(intent, options.toBundle()); + args.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments); + args.putInt(Helper.ARG_MEDIA_POSITION, 1); + new CachedBundle(AdminAccountActivity.this).insertBundle(args, currentAccount, bundleId -> { + Bundle bundle = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId); + intent.putExtras(bundle); + ActivityOptionsCompat options = ActivityOptionsCompat + .makeSceneTransitionAnimation(AdminAccountActivity.this, binding.accountPp, attachment.url); + // start the new activity + startActivity(intent, options.toBundle()); + }); }); diff --git a/app/src/main/java/app/fedilab/android/mastodon/activities/admin/AdminReportActivity.java b/app/src/main/java/app/fedilab/android/mastodon/activities/admin/AdminReportActivity.java index 73da31f8..01a5ba73 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/activities/admin/AdminReportActivity.java +++ b/app/src/main/java/app/fedilab/android/mastodon/activities/admin/AdminReportActivity.java @@ -357,7 +357,7 @@ public class AdminReportActivity extends BaseBarActivity { MastodonHelper.loadPPMastodon(binding.accountPp, account); binding.accountPp.setOnClickListener(v -> { Intent intent = new Intent(AdminReportActivity.this, MediaActivity.class); - Bundle b = new Bundle(); + Bundle args = new Bundle(); Attachment attachment = new Attachment(); attachment.description = account.acct; attachment.preview_url = account.avatar; @@ -366,13 +366,16 @@ public class AdminReportActivity extends BaseBarActivity { attachment.type = "image"; ArrayList attachments = new ArrayList<>(); attachments.add(attachment); - b.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments); - b.putInt(Helper.ARG_MEDIA_POSITION, 1); - intent.putExtras(b); - ActivityOptionsCompat options = ActivityOptionsCompat - .makeSceneTransitionAnimation(AdminReportActivity.this, binding.accountPp, attachment.url); - // start the new activity - startActivity(intent, options.toBundle()); + args.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments); + args.putInt(Helper.ARG_MEDIA_POSITION, 1); + new CachedBundle(AdminReportActivity.this).insertBundle(args, currentAccount, bundleId -> { + Bundle bundle = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId); + intent.putExtras(bundle); + ActivityOptionsCompat options = ActivityOptionsCompat + .makeSceneTransitionAnimation(AdminReportActivity.this, binding.accountPp, attachment.url); + startActivity(intent, options.toBundle()); + }); }); diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java index 274c536b..20e21b8b 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java @@ -118,6 +118,7 @@ import app.fedilab.android.mastodon.client.entities.api.Poll; import app.fedilab.android.mastodon.client.entities.api.Status; import app.fedilab.android.mastodon.client.entities.api.Tag; import app.fedilab.android.mastodon.client.entities.app.BaseAccount; +import app.fedilab.android.mastodon.client.entities.app.CachedBundle; import app.fedilab.android.mastodon.client.entities.app.CamelTag; import app.fedilab.android.mastodon.client.entities.app.Languages; import app.fedilab.android.mastodon.client.entities.app.Quotes; @@ -1366,14 +1367,18 @@ public class ComposeAdapter extends RecyclerView.Adapter { Intent mediaIntent = new Intent(context, MediaActivity.class); - Bundle b = new Bundle(); + Bundle args = new Bundle(); ArrayList attachments = new ArrayList<>(); attachments.add(attachment); - b.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments); - mediaIntent.putExtras(b); - ActivityOptionsCompat options = ActivityOptionsCompat - .makeSceneTransitionAnimation((Activity) context, drawerMediaListBinding.media, attachment.url); - context.startActivity(mediaIntent, options.toBundle()); + args.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments); + new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> { + Bundle bundle = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId); + mediaIntent.putExtras(bundle); + ActivityOptionsCompat options = ActivityOptionsCompat + .makeSceneTransitionAnimation((Activity) context, drawerMediaListBinding.media, attachment.url); + context.startActivity(mediaIntent, options.toBundle()); + }); }); holder.binding.simpleMedia.addView(drawerMediaListBinding.getRoot()); diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ImageAdapter.java b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ImageAdapter.java index dba70134..817b79ed 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ImageAdapter.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ImageAdapter.java @@ -75,19 +75,20 @@ public class ImageAdapter extends RecyclerView.Adapter } holder.binding.media.setOnClickListener(v -> { Intent mediaIntent = new Intent(context, MediaActivity.class); - Bundle b = new Bundle(); - b.putInt(Helper.ARG_MEDIA_POSITION, position + 1); - b.putBoolean(Helper.ARG_MEDIA_ARRAY_PROFILE, true); - mediaIntent.putExtras(b); - ActivityOptionsCompat options = null; + Bundle args = new Bundle(); + args.putInt(Helper.ARG_MEDIA_POSITION, position + 1); + args.putBoolean(Helper.ARG_MEDIA_ARRAY_PROFILE, true); if (attachment != null) { - options = ActivityOptionsCompat - .makeSceneTransitionAnimation((Activity) context, holder.binding.media, attachment.url); - } else { - return; + new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> { + Bundle bundle = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId); + mediaIntent.putExtras(bundle); + ActivityOptionsCompat options = null; + options = ActivityOptionsCompat + .makeSceneTransitionAnimation((Activity) context, holder.binding.media, attachment.url); + context.startActivity(mediaIntent, options.toBundle()); + }); } - // start the new activity - context.startActivity(mediaIntent, options.toBundle()); }); holder.binding.media.setOnLongClickListener(v -> { diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/SliderAdapter.java b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/SliderAdapter.java index 0cf829bd..69c2b2cd 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/SliderAdapter.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/SliderAdapter.java @@ -14,6 +14,8 @@ package app.fedilab.android.mastodon.ui.drawer; * You should have received a copy of the GNU General Public License along with Fedilab; if not, * see . */ +import static app.fedilab.android.BaseMainActivity.currentAccount; + import android.app.Activity; import android.content.Context; import android.content.Intent; @@ -38,6 +40,7 @@ import app.fedilab.android.databinding.DrawerSliderBinding; import app.fedilab.android.mastodon.activities.MediaActivity; import app.fedilab.android.mastodon.client.entities.api.Attachment; import app.fedilab.android.mastodon.client.entities.api.Status; +import app.fedilab.android.mastodon.client.entities.app.CachedBundle; import app.fedilab.android.mastodon.helper.Helper; import jp.wasabeef.glide.transformations.BlurTransformation; @@ -102,14 +105,17 @@ public class SliderAdapter extends SliderViewAdapter(status.media_attachments)); - mediaIntent.putExtras(b); - ActivityOptionsCompat options = ActivityOptionsCompat - .makeSceneTransitionAnimation((Activity) context, viewHolder.binding.ivAutoImageSlider, status.media_attachments.get(0).url); - // start the new activity - context.startActivity(mediaIntent, options.toBundle()); + Bundle args = new Bundle(); + args.putInt(Helper.ARG_MEDIA_POSITION, position + 1); + args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments)); + new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> { + Bundle bundle = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId); + mediaIntent.putExtras(bundle); + ActivityOptionsCompat options = ActivityOptionsCompat + .makeSceneTransitionAnimation((Activity) context, viewHolder.binding.ivAutoImageSlider, status.media_attachments.get(0).url); + context.startActivity(mediaIntent, options.toBundle()); + }); } }); } diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java index aeaf80d6..ea37cb11 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java @@ -1674,14 +1674,17 @@ public class StatusAdapter extends RecyclerView.Adapter return; } Intent mediaIntent = new Intent(context, MediaActivity.class); - Bundle b = new Bundle(); - b.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition); - b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments)); - mediaIntent.putExtras(b); - ActivityOptionsCompat options = ActivityOptionsCompat - .makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url); - // start the new activity - context.startActivity(mediaIntent, options.toBundle()); + Bundle args = new Bundle(); + args.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition); + args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments)); + new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> { + Bundle bundle = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId); + mediaIntent.putExtras(bundle); + ActivityOptionsCompat options = ActivityOptionsCompat + .makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url); + context.startActivity(mediaIntent, options.toBundle()); + }); }); layoutMediaBinding.viewHide.setOnClickListener(v -> { statusToDeal.sensitive = !statusToDeal.sensitive; @@ -1742,14 +1745,17 @@ public class StatusAdapter extends RecyclerView.Adapter return; } Intent mediaIntent = new Intent(context, MediaActivity.class); - Bundle b = new Bundle(); - b.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition); - b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments)); - mediaIntent.putExtras(b); - ActivityOptionsCompat options = ActivityOptionsCompat - .makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url); - // start the new activity - context.startActivity(mediaIntent, options.toBundle()); + Bundle args = new Bundle(); + args.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition); + args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments)); + new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> { + Bundle bundle = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId); + mediaIntent.putExtras(bundle); + ActivityOptionsCompat options = ActivityOptionsCompat + .makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url); + context.startActivity(mediaIntent, options.toBundle()); + }); }); layoutMediaBinding.viewHide.setOnClickListener(v -> { statusToDeal.sensitive = !statusToDeal.sensitive; @@ -2782,14 +2788,17 @@ public class StatusAdapter extends RecyclerView.Adapter return; } Intent mediaIntent = new Intent(context, MediaActivity.class); - Bundle b = new Bundle(); - b.putInt(Helper.ARG_MEDIA_POSITION, mediaPosition); - b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments)); - mediaIntent.putExtras(b); - ActivityOptionsCompat options = ActivityOptionsCompat - .makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url); - // start the new activity - context.startActivity(mediaIntent, options.toBundle()); + Bundle args = new Bundle(); + args.putInt(Helper.ARG_MEDIA_POSITION, mediaPosition); + args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments)); + new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> { + Bundle bundle = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId); + mediaIntent.putExtras(bundle); + ActivityOptionsCompat options = ActivityOptionsCompat + .makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url); + context.startActivity(mediaIntent, options.toBundle()); + }); }); layoutMediaBinding.viewHide.setOnClickListener(v -> { statusToDeal.sensitive = !statusToDeal.sensitive; @@ -3251,15 +3260,19 @@ public class StatusAdapter extends RecyclerView.Adapter holder.bindingArt.artMedia.setOnClickListener(v -> { if (status.art_attachment != null) { Intent mediaIntent = new Intent(context, MediaActivity.class); - Bundle b = new Bundle(); - b.putInt(Helper.ARG_MEDIA_POSITION, 1); + Bundle args = new Bundle(); + args.putInt(Helper.ARG_MEDIA_POSITION, 1); ArrayList attachments = new ArrayList<>(); attachments.add(status.art_attachment); - b.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments); - mediaIntent.putExtras(b); - ActivityOptionsCompat options = ActivityOptionsCompat - .makeSceneTransitionAnimation((Activity) context, holder.bindingArt.artMedia, status.art_attachment.url); - context.startActivity(mediaIntent, options.toBundle()); + args.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments); + new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> { + Bundle bundle = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId); + mediaIntent.putExtras(bundle); + ActivityOptionsCompat options = ActivityOptionsCompat + .makeSceneTransitionAnimation((Activity) context, holder.bindingArt.artMedia, status.art_attachment.url); + context.startActivity(mediaIntent, options.toBundle()); + }); } else { Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show(); } diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusDirectMessageAdapter.java b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusDirectMessageAdapter.java index 83d1f881..4523cae7 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusDirectMessageAdapter.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusDirectMessageAdapter.java @@ -15,6 +15,7 @@ package app.fedilab.android.mastodon.ui.drawer; * see . */ +import static app.fedilab.android.BaseMainActivity.currentAccount; import static app.fedilab.android.mastodon.ui.drawer.StatusAdapter.prepareRequestBuilder; import android.app.Activity; @@ -77,6 +78,7 @@ import app.fedilab.android.mastodon.activities.MediaActivity; import app.fedilab.android.mastodon.client.entities.api.Attachment; import app.fedilab.android.mastodon.client.entities.api.Poll; import app.fedilab.android.mastodon.client.entities.api.Status; +import app.fedilab.android.mastodon.client.entities.app.CachedBundle; import app.fedilab.android.mastodon.helper.CacheDataSourceFactory; import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.LongClickLinkMovementMethod; @@ -191,14 +193,17 @@ public class StatusDirectMessageAdapter extends RecyclerView.Adapter(status.media_attachments)); - mediaIntent.putExtras(b); - ActivityOptionsCompat options = ActivityOptionsCompat - .makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, status.media_attachments.get(0).url); - // start the new activity - context.startActivity(mediaIntent, options.toBundle()); + Bundle args = new Bundle(); + args.putInt(Helper.ARG_MEDIA_POSITION, mediaPosition); + args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments)); + new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> { + Bundle bundle = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId); + mediaIntent.putExtras(bundle); + ActivityOptionsCompat options = ActivityOptionsCompat + .makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, status.media_attachments.get(0).url); + context.startActivity(mediaIntent, options.toBundle()); + }); }); layoutMediaBinding.viewHide.setOnClickListener(v -> { status.sensitive = !status.sensitive; @@ -667,14 +672,17 @@ public class StatusDirectMessageAdapter extends RecyclerView.Adapter(status.media_attachments)); - mediaIntent.putExtras(b); - ActivityOptionsCompat options = ActivityOptionsCompat - .makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, status.media_attachments.get(0).url); - // start the new activity - context.startActivity(mediaIntent, options.toBundle()); + Bundle args = new Bundle(); + args.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition); + args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments)); + new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> { + Bundle bundle = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId); + mediaIntent.putExtras(bundle); + ActivityOptionsCompat options = ActivityOptionsCompat + .makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, status.media_attachments.get(0).url); + context.startActivity(mediaIntent, options.toBundle()); + }); }); layoutMediaBinding.viewHide.setOnClickListener(v -> { status.sensitive = !status.sensitive; diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonAccount.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonAccount.java index 5f504c87..c4006b0f 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonAccount.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonAccount.java @@ -95,7 +95,6 @@ public class FragmentMastodonAccount extends Fragment { } } initializeAfterBundle(getArguments()); - } } else { initializeAfterBundle(null); diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonTimeline.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonTimeline.java index 21093873..b7720b94 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonTimeline.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonTimeline.java @@ -382,7 +382,6 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter. } } initializeAfterBundle(getArguments()); - } } return binding.getRoot(); diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentNotificationContainer.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentNotificationContainer.java index 6350b0fb..906dbc3a 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentNotificationContainer.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentNotificationContainer.java @@ -114,42 +114,42 @@ public class FragmentNotificationContainer extends Fragment { String[] categoriesArray = excludedCategories.split("\\|"); for (String category : categoriesArray) { switch (category) { - case "mention": + case "mention" -> { excludedCategoriesList.add("mention"); dialogView.displayMentions.setChecked(false); - break; - case "favourite": + } + case "favourite" -> { excludedCategoriesList.add("favourite"); dialogView.displayFavourites.setChecked(false); - break; - case "reblog": + } + case "reblog" -> { excludedCategoriesList.add("reblog"); dialogView.displayReblogs.setChecked(false); - break; - case "poll": + } + case "poll" -> { excludedCategoriesList.add("poll"); dialogView.displayPollResults.setChecked(false); - break; - case "status": + } + case "status" -> { excludedCategoriesList.add("status"); dialogView.displayUpdatesFromPeople.setChecked(false); - break; - case "follow": + } + case "follow" -> { excludedCategoriesList.add("follow"); dialogView.displayFollows.setChecked(false); - break; - case "update": + } + case "update" -> { excludedCategoriesList.add("update"); dialogView.displayUpdates.setChecked(false); - break; - case "admin.sign_up": + } + case "admin.sign_up" -> { excludedCategoriesList.add("admin.sign_up"); dialogView.displaySignups.setChecked(false); - break; - case "admin.report": + } + case "admin.report" -> { excludedCategoriesList.add("admin.report"); dialogView.displayReports.setChecked(false); - break; + } } } } diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/pageadapter/FedilabNotificationPageAdapter.java b/app/src/main/java/app/fedilab/android/mastodon/ui/pageadapter/FedilabNotificationPageAdapter.java index 57c90774..5a4721e0 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/pageadapter/FedilabNotificationPageAdapter.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/pageadapter/FedilabNotificationPageAdapter.java @@ -53,45 +53,33 @@ public class FedilabNotificationPageAdapter extends FragmentStatePagerAdapter { FragmentMastodonNotification fragmentMastodonNotification = new FragmentMastodonNotification(); if (!extended) { switch (position) { - case 0: - bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ALL); - break; - case 1: - bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.MENTIONS); - break; + case 0 -> + bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ALL); + case 1 -> + bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.MENTIONS); } } else { switch (position) { - case 0: - bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ALL); - break; - case 1: - bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.MENTIONS); - break; - case 2: - bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.FAVOURITES); - break; - case 3: - bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.REBLOGS); - break; - case 4: - bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.POLLS); - break; - case 5: - bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.TOOTS); - break; - case 6: - bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.FOLLOWS); - break; - case 7: - bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.UPDATES); - break; - case 8: - bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ADMIN_SIGNUP); - break; - case 9: - bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ADMIN_REPORT); - break; + case 0 -> + bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ALL); + case 1 -> + bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.MENTIONS); + case 2 -> + bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.FAVOURITES); + case 3 -> + bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.REBLOGS); + case 4 -> + bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.POLLS); + case 5 -> + bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.TOOTS); + case 6 -> + bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.FOLLOWS); + case 7 -> + bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.UPDATES); + case 8 -> + bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ADMIN_SIGNUP); + case 9 -> + bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ADMIN_REPORT); } } fragmentMastodonNotification.setArguments(bundle); diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/pageadapter/FedilabScheduledPageAdapter.java b/app/src/main/java/app/fedilab/android/mastodon/ui/pageadapter/FedilabScheduledPageAdapter.java index 9045d8e2..26cb486a 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/pageadapter/FedilabScheduledPageAdapter.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/pageadapter/FedilabScheduledPageAdapter.java @@ -52,14 +52,12 @@ public class FedilabScheduledPageAdapter extends FragmentStatePagerAdapter { bundle.putString(Helper.ARG_VIEW_MODEL_KEY, "FEDILAB_" + position); FragmentScheduled fragmentScheduled = new FragmentScheduled(); switch (position) { - case 1: - bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.SCHEDULED_TOOT_CLIENT); - break; - case 2: - bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.SCHEDULED_BOOST); - break; - default: - bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.SCHEDULED_TOOT_SERVER); + case 1 -> + bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.SCHEDULED_TOOT_CLIENT); + case 2 -> + bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.SCHEDULED_BOOST); + default -> + bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.SCHEDULED_TOOT_SERVER); } fragmentScheduled.setArguments(bundle); return fragmentScheduled;