Cached intent for media

This commit is contained in:
Thomas 2024-01-12 10:36:29 +01:00
parent 09a8b6c43c
commit 504e30c44a
13 changed files with 188 additions and 160 deletions

View file

@ -500,7 +500,7 @@ public class ProfileActivity extends BaseActivity {
binding.accountPp.setOnClickListener(v -> { binding.accountPp.setOnClickListener(v -> {
Intent intent = new Intent(ProfileActivity.this, MediaActivity.class); Intent intent = new Intent(ProfileActivity.this, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
Attachment attachment = new Attachment(); Attachment attachment = new Attachment();
attachment.description = account.acct; attachment.description = account.acct;
attachment.preview_url = account.avatar; attachment.preview_url = account.avatar;
@ -509,13 +509,17 @@ public class ProfileActivity extends BaseActivity {
attachment.type = "image"; attachment.type = "image";
ArrayList<Attachment> attachments = new ArrayList<>(); ArrayList<Attachment> attachments = new ArrayList<>();
attachments.add(attachment); attachments.add(attachment);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments); args.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments);
b.putInt(Helper.ARG_MEDIA_POSITION, 1); args.putInt(Helper.ARG_MEDIA_POSITION, 1);
intent.putExtras(b); new CachedBundle(ProfileActivity.this).insertBundle(args, currentAccount, bundleId -> {
ActivityOptionsCompat options = ActivityOptionsCompat Bundle bundle = new Bundle();
.makeSceneTransitionAnimation(ProfileActivity.this, binding.accountPp, attachment.url); bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
// start the new activity intent.putExtras(bundle);
startActivity(intent, options.toBundle()); ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation(ProfileActivity.this, binding.accountPp, attachment.url);
// start the new activity
startActivity(intent, options.toBundle());
});
}); });

View file

@ -344,7 +344,7 @@ public class AdminAccountActivity extends BaseActivity {
MastodonHelper.loadPPMastodon(binding.accountPp, adminAccount.account); MastodonHelper.loadPPMastodon(binding.accountPp, adminAccount.account);
binding.accountPp.setOnClickListener(v -> { binding.accountPp.setOnClickListener(v -> {
Intent intent = new Intent(AdminAccountActivity.this, MediaActivity.class); Intent intent = new Intent(AdminAccountActivity.this, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
Attachment attachment = new Attachment(); Attachment attachment = new Attachment();
attachment.description = adminAccount.account.acct; attachment.description = adminAccount.account.acct;
attachment.preview_url = adminAccount.account.avatar; attachment.preview_url = adminAccount.account.avatar;
@ -353,13 +353,17 @@ public class AdminAccountActivity extends BaseActivity {
attachment.type = "image"; attachment.type = "image";
ArrayList<Attachment> attachments = new ArrayList<>(); ArrayList<Attachment> attachments = new ArrayList<>();
attachments.add(attachment); attachments.add(attachment);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments); args.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments);
b.putInt(Helper.ARG_MEDIA_POSITION, 1); args.putInt(Helper.ARG_MEDIA_POSITION, 1);
intent.putExtras(b); new CachedBundle(AdminAccountActivity.this).insertBundle(args, currentAccount, bundleId -> {
ActivityOptionsCompat options = ActivityOptionsCompat Bundle bundle = new Bundle();
.makeSceneTransitionAnimation(AdminAccountActivity.this, binding.accountPp, attachment.url); bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
// start the new activity intent.putExtras(bundle);
startActivity(intent, options.toBundle()); ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation(AdminAccountActivity.this, binding.accountPp, attachment.url);
// start the new activity
startActivity(intent, options.toBundle());
});
}); });

View file

@ -357,7 +357,7 @@ public class AdminReportActivity extends BaseBarActivity {
MastodonHelper.loadPPMastodon(binding.accountPp, account); MastodonHelper.loadPPMastodon(binding.accountPp, account);
binding.accountPp.setOnClickListener(v -> { binding.accountPp.setOnClickListener(v -> {
Intent intent = new Intent(AdminReportActivity.this, MediaActivity.class); Intent intent = new Intent(AdminReportActivity.this, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
Attachment attachment = new Attachment(); Attachment attachment = new Attachment();
attachment.description = account.acct; attachment.description = account.acct;
attachment.preview_url = account.avatar; attachment.preview_url = account.avatar;
@ -366,13 +366,16 @@ public class AdminReportActivity extends BaseBarActivity {
attachment.type = "image"; attachment.type = "image";
ArrayList<Attachment> attachments = new ArrayList<>(); ArrayList<Attachment> attachments = new ArrayList<>();
attachments.add(attachment); attachments.add(attachment);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments); args.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments);
b.putInt(Helper.ARG_MEDIA_POSITION, 1); args.putInt(Helper.ARG_MEDIA_POSITION, 1);
intent.putExtras(b); new CachedBundle(AdminReportActivity.this).insertBundle(args, currentAccount, bundleId -> {
ActivityOptionsCompat options = ActivityOptionsCompat Bundle bundle = new Bundle();
.makeSceneTransitionAnimation(AdminReportActivity.this, binding.accountPp, attachment.url); bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
// start the new activity intent.putExtras(bundle);
startActivity(intent, options.toBundle()); ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation(AdminReportActivity.this, binding.accountPp, attachment.url);
startActivity(intent, options.toBundle());
});
}); });

View file

@ -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.Status;
import app.fedilab.android.mastodon.client.entities.api.Tag; 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.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.CamelTag;
import app.fedilab.android.mastodon.client.entities.app.Languages; import app.fedilab.android.mastodon.client.entities.app.Languages;
import app.fedilab.android.mastodon.client.entities.app.Quotes; import app.fedilab.android.mastodon.client.entities.app.Quotes;
@ -1366,14 +1367,18 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
} }
drawerMediaListBinding.getRoot().setOnClickListener(v -> { drawerMediaListBinding.getRoot().setOnClickListener(v -> {
Intent mediaIntent = new Intent(context, MediaActivity.class); Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
ArrayList<Attachment> attachments = new ArrayList<>(); ArrayList<Attachment> attachments = new ArrayList<>();
attachments.add(attachment); attachments.add(attachment);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments); args.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments);
mediaIntent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
ActivityOptionsCompat options = ActivityOptionsCompat Bundle bundle = new Bundle();
.makeSceneTransitionAnimation((Activity) context, drawerMediaListBinding.media, attachment.url); bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
context.startActivity(mediaIntent, options.toBundle()); mediaIntent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, drawerMediaListBinding.media, attachment.url);
context.startActivity(mediaIntent, options.toBundle());
});
}); });
holder.binding.simpleMedia.addView(drawerMediaListBinding.getRoot()); holder.binding.simpleMedia.addView(drawerMediaListBinding.getRoot());

View file

@ -75,19 +75,20 @@ public class ImageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
} }
holder.binding.media.setOnClickListener(v -> { holder.binding.media.setOnClickListener(v -> {
Intent mediaIntent = new Intent(context, MediaActivity.class); Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, position + 1); args.putInt(Helper.ARG_MEDIA_POSITION, position + 1);
b.putBoolean(Helper.ARG_MEDIA_ARRAY_PROFILE, true); args.putBoolean(Helper.ARG_MEDIA_ARRAY_PROFILE, true);
mediaIntent.putExtras(b);
ActivityOptionsCompat options = null;
if (attachment != null) { if (attachment != null) {
options = ActivityOptionsCompat new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
.makeSceneTransitionAnimation((Activity) context, holder.binding.media, attachment.url); Bundle bundle = new Bundle();
} else { bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
return; 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 -> { holder.binding.media.setOnLongClickListener(v -> {

View file

@ -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, * You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; 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.activities.MediaActivity;
import app.fedilab.android.mastodon.client.entities.api.Attachment; 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.api.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
import jp.wasabeef.glide.transformations.BlurTransformation; import jp.wasabeef.glide.transformations.BlurTransformation;
@ -102,14 +105,17 @@ public class SliderAdapter extends SliderViewAdapter<SliderAdapter.SliderAdapter
} }
} else { } else {
Intent mediaIntent = new Intent(context, MediaActivity.class); Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, position + 1); args.putInt(Helper.ARG_MEDIA_POSITION, position + 1);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments)); args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments));
mediaIntent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
ActivityOptionsCompat options = ActivityOptionsCompat Bundle bundle = new Bundle();
.makeSceneTransitionAnimation((Activity) context, viewHolder.binding.ivAutoImageSlider, status.media_attachments.get(0).url); bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
// start the new activity mediaIntent.putExtras(bundle);
context.startActivity(mediaIntent, options.toBundle()); ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, viewHolder.binding.ivAutoImageSlider, status.media_attachments.get(0).url);
context.startActivity(mediaIntent, options.toBundle());
});
} }
}); });
} }

View file

@ -1674,14 +1674,17 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
return; return;
} }
Intent mediaIntent = new Intent(context, MediaActivity.class); Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition); args.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments)); args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments));
mediaIntent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
ActivityOptionsCompat options = ActivityOptionsCompat Bundle bundle = new Bundle();
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url); bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
// start the new activity mediaIntent.putExtras(bundle);
context.startActivity(mediaIntent, options.toBundle()); ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url);
context.startActivity(mediaIntent, options.toBundle());
});
}); });
layoutMediaBinding.viewHide.setOnClickListener(v -> { layoutMediaBinding.viewHide.setOnClickListener(v -> {
statusToDeal.sensitive = !statusToDeal.sensitive; statusToDeal.sensitive = !statusToDeal.sensitive;
@ -1742,14 +1745,17 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
return; return;
} }
Intent mediaIntent = new Intent(context, MediaActivity.class); Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition); args.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments)); args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments));
mediaIntent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
ActivityOptionsCompat options = ActivityOptionsCompat Bundle bundle = new Bundle();
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url); bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
// start the new activity mediaIntent.putExtras(bundle);
context.startActivity(mediaIntent, options.toBundle()); ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url);
context.startActivity(mediaIntent, options.toBundle());
});
}); });
layoutMediaBinding.viewHide.setOnClickListener(v -> { layoutMediaBinding.viewHide.setOnClickListener(v -> {
statusToDeal.sensitive = !statusToDeal.sensitive; statusToDeal.sensitive = !statusToDeal.sensitive;
@ -2782,14 +2788,17 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
return; return;
} }
Intent mediaIntent = new Intent(context, MediaActivity.class); Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, mediaPosition); args.putInt(Helper.ARG_MEDIA_POSITION, mediaPosition);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments)); args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments));
mediaIntent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
ActivityOptionsCompat options = ActivityOptionsCompat Bundle bundle = new Bundle();
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url); bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
// start the new activity mediaIntent.putExtras(bundle);
context.startActivity(mediaIntent, options.toBundle()); ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url);
context.startActivity(mediaIntent, options.toBundle());
});
}); });
layoutMediaBinding.viewHide.setOnClickListener(v -> { layoutMediaBinding.viewHide.setOnClickListener(v -> {
statusToDeal.sensitive = !statusToDeal.sensitive; statusToDeal.sensitive = !statusToDeal.sensitive;
@ -3251,15 +3260,19 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
holder.bindingArt.artMedia.setOnClickListener(v -> { holder.bindingArt.artMedia.setOnClickListener(v -> {
if (status.art_attachment != null) { if (status.art_attachment != null) {
Intent mediaIntent = new Intent(context, MediaActivity.class); Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, 1); args.putInt(Helper.ARG_MEDIA_POSITION, 1);
ArrayList<Attachment> attachments = new ArrayList<>(); ArrayList<Attachment> attachments = new ArrayList<>();
attachments.add(status.art_attachment); attachments.add(status.art_attachment);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments); args.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments);
mediaIntent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
ActivityOptionsCompat options = ActivityOptionsCompat Bundle bundle = new Bundle();
.makeSceneTransitionAnimation((Activity) context, holder.bindingArt.artMedia, status.art_attachment.url); bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
context.startActivity(mediaIntent, options.toBundle()); mediaIntent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, holder.bindingArt.artMedia, status.art_attachment.url);
context.startActivity(mediaIntent, options.toBundle());
});
} else { } else {
Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show(); Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show();
} }

View file

@ -15,6 +15,7 @@ package app.fedilab.android.mastodon.ui.drawer;
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import static app.fedilab.android.mastodon.ui.drawer.StatusAdapter.prepareRequestBuilder; import static app.fedilab.android.mastodon.ui.drawer.StatusAdapter.prepareRequestBuilder;
import android.app.Activity; 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.Attachment;
import app.fedilab.android.mastodon.client.entities.api.Poll; 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.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.CacheDataSourceFactory; import app.fedilab.android.mastodon.helper.CacheDataSourceFactory;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.LongClickLinkMovementMethod; import app.fedilab.android.mastodon.helper.LongClickLinkMovementMethod;
@ -191,14 +193,17 @@ public class StatusDirectMessageAdapter extends RecyclerView.Adapter<RecyclerVie
return; return;
} }
Intent mediaIntent = new Intent(context, MediaActivity.class); Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, mediaPosition); args.putInt(Helper.ARG_MEDIA_POSITION, mediaPosition);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments)); args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments));
mediaIntent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
ActivityOptionsCompat options = ActivityOptionsCompat Bundle bundle = new Bundle();
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, status.media_attachments.get(0).url); bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
// start the new activity mediaIntent.putExtras(bundle);
context.startActivity(mediaIntent, options.toBundle()); ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, status.media_attachments.get(0).url);
context.startActivity(mediaIntent, options.toBundle());
});
}); });
layoutMediaBinding.viewHide.setOnClickListener(v -> { layoutMediaBinding.viewHide.setOnClickListener(v -> {
status.sensitive = !status.sensitive; status.sensitive = !status.sensitive;
@ -667,14 +672,17 @@ public class StatusDirectMessageAdapter extends RecyclerView.Adapter<RecyclerVie
return; return;
} }
Intent mediaIntent = new Intent(context, MediaActivity.class); Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition); args.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments)); args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments));
mediaIntent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
ActivityOptionsCompat options = ActivityOptionsCompat Bundle bundle = new Bundle();
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, status.media_attachments.get(0).url); bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
// start the new activity mediaIntent.putExtras(bundle);
context.startActivity(mediaIntent, options.toBundle()); ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, status.media_attachments.get(0).url);
context.startActivity(mediaIntent, options.toBundle());
});
}); });
layoutMediaBinding.viewHide.setOnClickListener(v -> { layoutMediaBinding.viewHide.setOnClickListener(v -> {
status.sensitive = !status.sensitive; status.sensitive = !status.sensitive;

View file

@ -95,7 +95,6 @@ public class FragmentMastodonAccount extends Fragment {
} }
} }
initializeAfterBundle(getArguments()); initializeAfterBundle(getArguments());
} }
} else { } else {
initializeAfterBundle(null); initializeAfterBundle(null);

View file

@ -382,7 +382,6 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
} }
} }
initializeAfterBundle(getArguments()); initializeAfterBundle(getArguments());
} }
} }
return binding.getRoot(); return binding.getRoot();

View file

@ -114,42 +114,42 @@ public class FragmentNotificationContainer extends Fragment {
String[] categoriesArray = excludedCategories.split("\\|"); String[] categoriesArray = excludedCategories.split("\\|");
for (String category : categoriesArray) { for (String category : categoriesArray) {
switch (category) { switch (category) {
case "mention": case "mention" -> {
excludedCategoriesList.add("mention"); excludedCategoriesList.add("mention");
dialogView.displayMentions.setChecked(false); dialogView.displayMentions.setChecked(false);
break; }
case "favourite": case "favourite" -> {
excludedCategoriesList.add("favourite"); excludedCategoriesList.add("favourite");
dialogView.displayFavourites.setChecked(false); dialogView.displayFavourites.setChecked(false);
break; }
case "reblog": case "reblog" -> {
excludedCategoriesList.add("reblog"); excludedCategoriesList.add("reblog");
dialogView.displayReblogs.setChecked(false); dialogView.displayReblogs.setChecked(false);
break; }
case "poll": case "poll" -> {
excludedCategoriesList.add("poll"); excludedCategoriesList.add("poll");
dialogView.displayPollResults.setChecked(false); dialogView.displayPollResults.setChecked(false);
break; }
case "status": case "status" -> {
excludedCategoriesList.add("status"); excludedCategoriesList.add("status");
dialogView.displayUpdatesFromPeople.setChecked(false); dialogView.displayUpdatesFromPeople.setChecked(false);
break; }
case "follow": case "follow" -> {
excludedCategoriesList.add("follow"); excludedCategoriesList.add("follow");
dialogView.displayFollows.setChecked(false); dialogView.displayFollows.setChecked(false);
break; }
case "update": case "update" -> {
excludedCategoriesList.add("update"); excludedCategoriesList.add("update");
dialogView.displayUpdates.setChecked(false); dialogView.displayUpdates.setChecked(false);
break; }
case "admin.sign_up": case "admin.sign_up" -> {
excludedCategoriesList.add("admin.sign_up"); excludedCategoriesList.add("admin.sign_up");
dialogView.displaySignups.setChecked(false); dialogView.displaySignups.setChecked(false);
break; }
case "admin.report": case "admin.report" -> {
excludedCategoriesList.add("admin.report"); excludedCategoriesList.add("admin.report");
dialogView.displayReports.setChecked(false); dialogView.displayReports.setChecked(false);
break; }
} }
} }
} }

View file

@ -53,45 +53,33 @@ public class FedilabNotificationPageAdapter extends FragmentStatePagerAdapter {
FragmentMastodonNotification fragmentMastodonNotification = new FragmentMastodonNotification(); FragmentMastodonNotification fragmentMastodonNotification = new FragmentMastodonNotification();
if (!extended) { if (!extended) {
switch (position) { switch (position) {
case 0: case 0 ->
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ALL); bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ALL);
break; case 1 ->
case 1: bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.MENTIONS);
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.MENTIONS);
break;
} }
} else { } else {
switch (position) { switch (position) {
case 0: case 0 ->
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ALL); bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ALL);
break; case 1 ->
case 1: bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.MENTIONS);
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.MENTIONS); case 2 ->
break; bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.FAVOURITES);
case 2: case 3 ->
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.FAVOURITES); bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.REBLOGS);
break; case 4 ->
case 3: bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.POLLS);
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.REBLOGS); case 5 ->
break; bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.TOOTS);
case 4: case 6 ->
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.POLLS); bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.FOLLOWS);
break; case 7 ->
case 5: bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.UPDATES);
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.TOOTS); case 8 ->
break; bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ADMIN_SIGNUP);
case 6: case 9 ->
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.FOLLOWS); bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ADMIN_REPORT);
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;
} }
} }
fragmentMastodonNotification.setArguments(bundle); fragmentMastodonNotification.setArguments(bundle);

View file

@ -52,14 +52,12 @@ public class FedilabScheduledPageAdapter extends FragmentStatePagerAdapter {
bundle.putString(Helper.ARG_VIEW_MODEL_KEY, "FEDILAB_" + position); bundle.putString(Helper.ARG_VIEW_MODEL_KEY, "FEDILAB_" + position);
FragmentScheduled fragmentScheduled = new FragmentScheduled(); FragmentScheduled fragmentScheduled = new FragmentScheduled();
switch (position) { switch (position) {
case 1: case 1 ->
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.SCHEDULED_TOOT_CLIENT); bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.SCHEDULED_TOOT_CLIENT);
break; case 2 ->
case 2: bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.SCHEDULED_BOOST);
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.SCHEDULED_BOOST); default ->
break; bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.SCHEDULED_TOOT_SERVER);
default:
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.SCHEDULED_TOOT_SERVER);
} }
fragmentScheduled.setArguments(bundle); fragmentScheduled.setArguments(bundle);
return fragmentScheduled; return fragmentScheduled;