Loading app/src/main/java/app/fedilab/android/activities/MediaActivity.java +15 −3 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ package app.fedilab.android.activities; * You should have received a copy of the GNU General Public License along with Fedilab; if not, * see <http://www.gnu.org/licenses>. */ import static app.fedilab.android.ui.fragment.media.FragmentMediaProfile.mediaAttachmentProfile; import android.Manifest; import android.app.DownloadManager; import android.content.BroadcastReceiver; Loading @@ -26,6 +28,7 @@ import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; Loading Loading @@ -95,6 +98,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload private ActivityMediaPagerBinding binding; private FragmentMedia mCurrentFragment; private Status status; private boolean mediaFromProfile; @Override protected void onCreate(Bundle savedInstanceState) { Loading @@ -105,14 +109,21 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload binding = ActivityMediaPagerBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); fullscreen = false; flags = getWindow().getDecorView().getSystemUiVisibility(); Bundle b = getIntent().getExtras(); if (b != null) { mediaPosition = b.getInt(Helper.ARG_MEDIA_POSITION, 1); attachments = (ArrayList<Attachment>) b.getSerializable(Helper.ARG_MEDIA_ARRAY); mediaFromProfile = b.getBoolean(Helper.ARG_MEDIA_ARRAY_PROFILE, false); status = (Status) b.getSerializable(Helper.ARG_STATUS); } Log.v(Helper.TAG, "mediaPosition: " + mediaPosition); if (mediaFromProfile && mediaAttachmentProfile != null) { attachments = new ArrayList<>(); attachments.addAll(mediaAttachmentProfile); } if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); Loading @@ -130,10 +141,10 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload registerReceiver(onDownloadComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); String description = attachments.get(mediaPosition - 1).description; handler = new Handler(); if (status != null) { if (attachments.get(mediaPosition - 1).status != null) { binding.originalMessage.setOnClickListener(v -> { Intent intentContext = new Intent(MediaActivity.this, ContextActivity.class); intentContext.putExtra(Helper.ARG_STATUS, status); intentContext.putExtra(Helper.ARG_STATUS, attachments.get(mediaPosition - 1).status); intentContext.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intentContext); }); Loading Loading @@ -171,6 +182,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload } public void onPageSelected(int position) { mediaPosition = position; String description = attachments.get(position).description; if (handler != null) { handler.removeCallbacksAndMessages(null); Loading Loading @@ -386,7 +398,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload showSystemUI(); binding.mediaDescription.setVisibility(View.VISIBLE); binding.translate.setVisibility(View.VISIBLE); if (status != null) { if (mediaFromProfile) { binding.originalMessage.setVisibility(View.VISIBLE); } } else { Loading app/src/main/java/app/fedilab/android/client/entities/api/Attachment.java +14 −1 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ package app.fedilab.android.client.entities.api; * You should have received a copy of the GNU General Public License along with Fedilab; if not, * see <http://www.gnu.org/licenses>. */ import androidx.annotation.Nullable; import com.google.gson.annotations.SerializedName; import java.io.Serializable; Loading Loading @@ -52,7 +54,7 @@ public class Attachment implements Serializable { public String peertubeId = null; public String focus = null; public String translation = null; public transient Status status = null; public static class Meta implements Serializable { @SerializedName("focus") Loading Loading @@ -80,4 +82,15 @@ public class Attachment implements Serializable { @SerializedName("aspect") public float aspect; } @Override public boolean equals(@Nullable Object obj) { boolean same = false; if (obj instanceof Attachment) { same = this.id.equals(((Attachment) obj).id); } return same; } } app/src/main/java/app/fedilab/android/helper/Helper.java +1 −0 Original line number Diff line number Diff line Loading @@ -272,6 +272,7 @@ public class Helper { public static final String ARG_CHECK_REMOTELY = "ARG_CHECK_REMOTELY"; public static final String ARG_USER_ID = "ARG_USER_ID"; public static final String ARG_MEDIA_ARRAY = "ARG_MEDIA_ARRAY"; public static final String ARG_MEDIA_ARRAY_PROFILE = "ARG_MEDIA_ARRAY_PROFILE"; public static final String ARG_VISIBILITY = "ARG_VISIBILITY"; public static final String ARG_SCHEDULED_DATE = "ARG_SCHEDULED_DATE"; Loading app/src/main/java/app/fedilab/android/helper/SpannableHelper.java +114 −51 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ import com.bumptech.glide.Glide; import java.io.IOException; import java.lang.ref.WeakReference; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; Loading Loading @@ -370,6 +371,66 @@ public class SpannableHelper { new Thread(() -> { try { String redirect = null; if (finalUrl.startsWith("http://")) { HttpURLConnection httpURLConnection = (HttpURLConnection) finalUrlCheck.openConnection(); httpURLConnection.setConnectTimeout(10 * 1000); httpURLConnection.setRequestProperty("http.keepAlive", "false"); //httpsURLConnection.setRequestProperty("User-Agent", USER_AGENT); httpURLConnection.setRequestMethod("HEAD"); httpURLConnection.setInstanceFollowRedirects(false); if (httpURLConnection.getResponseCode() == 301 || httpURLConnection.getResponseCode() == 302) { Map<String, List<String>> map = httpURLConnection.getHeaderFields(); for (Map.Entry<String, List<String>> entry : map.entrySet()) { if (entry.toString().toLowerCase().startsWith("location")) { Matcher matcher = Patterns.WEB_URL.matcher(entry.toString()); if (matcher.find()) { redirect = matcher.group(1); } } } } httpURLConnection.getInputStream().close(); if (redirect != null && redirect.compareTo(finalUrl) != 0) { URL redirectURL = new URL(redirect); String host = redirectURL.getHost(); String protocol = redirectURL.getProtocol(); if (protocol == null || host == null) { redirect = null; } } Handler mainHandler = new Handler(context.getMainLooper()); String finalRedirect = redirect; Runnable myRunnable = () -> { AlertDialog.Builder builder1 = new AlertDialog.Builder(view.getContext()); if (finalRedirect != null) { builder1.setMessage(context.getString(R.string.redirect_detected, finalUrl, finalRedirect)); builder1.setNegativeButton(R.string.copy_link, (dialog, which) -> { ClipboardManager clipboard1 = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip1 = ClipData.newPlainText(Helper.CLIP_BOARD, finalRedirect); if (clipboard1 != null) { clipboard1.setPrimaryClip(clip1); Toasty.info(context, context.getString(R.string.clipboard_url), Toast.LENGTH_LONG).show(); } dialog.dismiss(); }); builder1.setNeutralButton(R.string.share_link, (dialog, which) -> { Intent sendIntent1 = new Intent(Intent.ACTION_SEND); sendIntent1.putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.shared_via)); sendIntent1.putExtra(Intent.EXTRA_TEXT, finalUrl); sendIntent1.setType("text/plain"); context.startActivity(Intent.createChooser(sendIntent1, context.getString(R.string.share_with))); dialog.dismiss(); }); } else { builder1.setMessage(R.string.no_redirect); } builder1.setTitle(context.getString(R.string.check_redirect)); builder1.setPositiveButton(R.string.close, (dialog, which) -> dialog.dismiss()) .show(); }; mainHandler.post(myRunnable); } else { HttpsURLConnection httpsURLConnection = (HttpsURLConnection) finalUrlCheck.openConnection(); httpsURLConnection.setConnectTimeout(10 * 1000); httpsURLConnection.setRequestProperty("http.keepAlive", "false"); Loading Loading @@ -428,6 +489,8 @@ public class SpannableHelper { }; mainHandler.post(myRunnable); } } catch (IOException e) { e.printStackTrace(); } Loading app/src/main/java/app/fedilab/android/ui/drawer/ImageAdapter.java +28 −26 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ package app.fedilab.android.ui.drawer; * You should have received a copy of the GNU General Public License along with Fedilab; if not, * see <http://www.gnu.org/licenses>. */ import static app.fedilab.android.ui.fragment.media.FragmentMediaProfile.mediaAttachmentProfile; import android.app.Activity; import android.content.Context; import android.content.Intent; Loading @@ -27,31 +29,26 @@ import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import java.util.ArrayList; import java.util.List; import app.fedilab.android.activities.ContextActivity; import app.fedilab.android.activities.MediaActivity; import app.fedilab.android.client.entities.api.Attachment; import app.fedilab.android.client.entities.api.Status; import app.fedilab.android.databinding.DrawerMediaBinding; import app.fedilab.android.helper.Helper; public class ImageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private final List<Status> statuses; private Context context; public ImageAdapter(List<Status> statuses) { this.statuses = statuses; public ImageAdapter() { } public int getCount() { return statuses.size(); return mediaAttachmentProfile.size(); } public Status getItem(int position) { return statuses.get(position); public Attachment getItem(int position) { return mediaAttachmentProfile.get(position); } @NonNull Loading @@ -64,35 +61,40 @@ public class ImageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) { Status status = statuses.get(position); Attachment attachment = mediaAttachmentProfile.get(position); final ViewHolder holder = (ViewHolder) viewHolder; if (Helper.isValidContextForGlide(context) && status.art_attachment != null) { if (status.art_attachment.preview_url != null) { Glide.with(context).load(status.art_attachment.preview_url).into(holder.binding.media); } else if (status.art_attachment.url != null) { Glide.with(context).load(status.art_attachment.url).into(holder.binding.media); if (Helper.isValidContextForGlide(context) && attachment != null) { if (attachment.preview_url != null) { Glide.with(context).load(attachment.preview_url).into(holder.binding.media); } else if (attachment.url != null) { Glide.with(context).load(attachment.url).into(holder.binding.media); } } holder.binding.media.setOnClickListener(v -> { Intent mediaIntent = new Intent(context, MediaActivity.class); Bundle b = new Bundle(); b.putInt(Helper.ARG_MEDIA_POSITION, 1); ArrayList<Attachment> attachmentsTmp = new ArrayList<>(); attachmentsTmp.add(status.art_attachment); b.putSerializable(Helper.ARG_STATUS, status); b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(attachmentsTmp)); b.putInt(Helper.ARG_MEDIA_POSITION, position + 1); b.putBoolean(Helper.ARG_MEDIA_ARRAY_PROFILE, true); mediaIntent.putExtras(b); ActivityOptionsCompat options = ActivityOptionsCompat .makeSceneTransitionAnimation((Activity) context, holder.binding.media, status.media_attachments.get(0).url); ActivityOptionsCompat options = null; if (attachment != null) { options = ActivityOptionsCompat .makeSceneTransitionAnimation((Activity) context, holder.binding.media, attachment.url); } else { return; } // start the new activity context.startActivity(mediaIntent, options.toBundle()); }); holder.binding.media.setOnLongClickListener(v -> { Intent intentContext = new Intent(context, ContextActivity.class); intentContext.putExtra(Helper.ARG_STATUS, status); if (attachment != null) { intentContext.putExtra(Helper.ARG_STATUS, attachment.status); } else { return false; } intentContext.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intentContext); return false; Loading @@ -105,7 +107,7 @@ public class ImageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> @Override public int getItemCount() { return statuses.size(); return mediaAttachmentProfile.size(); } Loading Loading
app/src/main/java/app/fedilab/android/activities/MediaActivity.java +15 −3 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ package app.fedilab.android.activities; * You should have received a copy of the GNU General Public License along with Fedilab; if not, * see <http://www.gnu.org/licenses>. */ import static app.fedilab.android.ui.fragment.media.FragmentMediaProfile.mediaAttachmentProfile; import android.Manifest; import android.app.DownloadManager; import android.content.BroadcastReceiver; Loading @@ -26,6 +28,7 @@ import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; Loading Loading @@ -95,6 +98,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload private ActivityMediaPagerBinding binding; private FragmentMedia mCurrentFragment; private Status status; private boolean mediaFromProfile; @Override protected void onCreate(Bundle savedInstanceState) { Loading @@ -105,14 +109,21 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload binding = ActivityMediaPagerBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); fullscreen = false; flags = getWindow().getDecorView().getSystemUiVisibility(); Bundle b = getIntent().getExtras(); if (b != null) { mediaPosition = b.getInt(Helper.ARG_MEDIA_POSITION, 1); attachments = (ArrayList<Attachment>) b.getSerializable(Helper.ARG_MEDIA_ARRAY); mediaFromProfile = b.getBoolean(Helper.ARG_MEDIA_ARRAY_PROFILE, false); status = (Status) b.getSerializable(Helper.ARG_STATUS); } Log.v(Helper.TAG, "mediaPosition: " + mediaPosition); if (mediaFromProfile && mediaAttachmentProfile != null) { attachments = new ArrayList<>(); attachments.addAll(mediaAttachmentProfile); } if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); Loading @@ -130,10 +141,10 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload registerReceiver(onDownloadComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); String description = attachments.get(mediaPosition - 1).description; handler = new Handler(); if (status != null) { if (attachments.get(mediaPosition - 1).status != null) { binding.originalMessage.setOnClickListener(v -> { Intent intentContext = new Intent(MediaActivity.this, ContextActivity.class); intentContext.putExtra(Helper.ARG_STATUS, status); intentContext.putExtra(Helper.ARG_STATUS, attachments.get(mediaPosition - 1).status); intentContext.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intentContext); }); Loading Loading @@ -171,6 +182,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload } public void onPageSelected(int position) { mediaPosition = position; String description = attachments.get(position).description; if (handler != null) { handler.removeCallbacksAndMessages(null); Loading Loading @@ -386,7 +398,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload showSystemUI(); binding.mediaDescription.setVisibility(View.VISIBLE); binding.translate.setVisibility(View.VISIBLE); if (status != null) { if (mediaFromProfile) { binding.originalMessage.setVisibility(View.VISIBLE); } } else { Loading
app/src/main/java/app/fedilab/android/client/entities/api/Attachment.java +14 −1 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ package app.fedilab.android.client.entities.api; * You should have received a copy of the GNU General Public License along with Fedilab; if not, * see <http://www.gnu.org/licenses>. */ import androidx.annotation.Nullable; import com.google.gson.annotations.SerializedName; import java.io.Serializable; Loading Loading @@ -52,7 +54,7 @@ public class Attachment implements Serializable { public String peertubeId = null; public String focus = null; public String translation = null; public transient Status status = null; public static class Meta implements Serializable { @SerializedName("focus") Loading Loading @@ -80,4 +82,15 @@ public class Attachment implements Serializable { @SerializedName("aspect") public float aspect; } @Override public boolean equals(@Nullable Object obj) { boolean same = false; if (obj instanceof Attachment) { same = this.id.equals(((Attachment) obj).id); } return same; } }
app/src/main/java/app/fedilab/android/helper/Helper.java +1 −0 Original line number Diff line number Diff line Loading @@ -272,6 +272,7 @@ public class Helper { public static final String ARG_CHECK_REMOTELY = "ARG_CHECK_REMOTELY"; public static final String ARG_USER_ID = "ARG_USER_ID"; public static final String ARG_MEDIA_ARRAY = "ARG_MEDIA_ARRAY"; public static final String ARG_MEDIA_ARRAY_PROFILE = "ARG_MEDIA_ARRAY_PROFILE"; public static final String ARG_VISIBILITY = "ARG_VISIBILITY"; public static final String ARG_SCHEDULED_DATE = "ARG_SCHEDULED_DATE"; Loading
app/src/main/java/app/fedilab/android/helper/SpannableHelper.java +114 −51 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ import com.bumptech.glide.Glide; import java.io.IOException; import java.lang.ref.WeakReference; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; Loading Loading @@ -370,6 +371,66 @@ public class SpannableHelper { new Thread(() -> { try { String redirect = null; if (finalUrl.startsWith("http://")) { HttpURLConnection httpURLConnection = (HttpURLConnection) finalUrlCheck.openConnection(); httpURLConnection.setConnectTimeout(10 * 1000); httpURLConnection.setRequestProperty("http.keepAlive", "false"); //httpsURLConnection.setRequestProperty("User-Agent", USER_AGENT); httpURLConnection.setRequestMethod("HEAD"); httpURLConnection.setInstanceFollowRedirects(false); if (httpURLConnection.getResponseCode() == 301 || httpURLConnection.getResponseCode() == 302) { Map<String, List<String>> map = httpURLConnection.getHeaderFields(); for (Map.Entry<String, List<String>> entry : map.entrySet()) { if (entry.toString().toLowerCase().startsWith("location")) { Matcher matcher = Patterns.WEB_URL.matcher(entry.toString()); if (matcher.find()) { redirect = matcher.group(1); } } } } httpURLConnection.getInputStream().close(); if (redirect != null && redirect.compareTo(finalUrl) != 0) { URL redirectURL = new URL(redirect); String host = redirectURL.getHost(); String protocol = redirectURL.getProtocol(); if (protocol == null || host == null) { redirect = null; } } Handler mainHandler = new Handler(context.getMainLooper()); String finalRedirect = redirect; Runnable myRunnable = () -> { AlertDialog.Builder builder1 = new AlertDialog.Builder(view.getContext()); if (finalRedirect != null) { builder1.setMessage(context.getString(R.string.redirect_detected, finalUrl, finalRedirect)); builder1.setNegativeButton(R.string.copy_link, (dialog, which) -> { ClipboardManager clipboard1 = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip1 = ClipData.newPlainText(Helper.CLIP_BOARD, finalRedirect); if (clipboard1 != null) { clipboard1.setPrimaryClip(clip1); Toasty.info(context, context.getString(R.string.clipboard_url), Toast.LENGTH_LONG).show(); } dialog.dismiss(); }); builder1.setNeutralButton(R.string.share_link, (dialog, which) -> { Intent sendIntent1 = new Intent(Intent.ACTION_SEND); sendIntent1.putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.shared_via)); sendIntent1.putExtra(Intent.EXTRA_TEXT, finalUrl); sendIntent1.setType("text/plain"); context.startActivity(Intent.createChooser(sendIntent1, context.getString(R.string.share_with))); dialog.dismiss(); }); } else { builder1.setMessage(R.string.no_redirect); } builder1.setTitle(context.getString(R.string.check_redirect)); builder1.setPositiveButton(R.string.close, (dialog, which) -> dialog.dismiss()) .show(); }; mainHandler.post(myRunnable); } else { HttpsURLConnection httpsURLConnection = (HttpsURLConnection) finalUrlCheck.openConnection(); httpsURLConnection.setConnectTimeout(10 * 1000); httpsURLConnection.setRequestProperty("http.keepAlive", "false"); Loading Loading @@ -428,6 +489,8 @@ public class SpannableHelper { }; mainHandler.post(myRunnable); } } catch (IOException e) { e.printStackTrace(); } Loading
app/src/main/java/app/fedilab/android/ui/drawer/ImageAdapter.java +28 −26 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ package app.fedilab.android.ui.drawer; * You should have received a copy of the GNU General Public License along with Fedilab; if not, * see <http://www.gnu.org/licenses>. */ import static app.fedilab.android.ui.fragment.media.FragmentMediaProfile.mediaAttachmentProfile; import android.app.Activity; import android.content.Context; import android.content.Intent; Loading @@ -27,31 +29,26 @@ import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import java.util.ArrayList; import java.util.List; import app.fedilab.android.activities.ContextActivity; import app.fedilab.android.activities.MediaActivity; import app.fedilab.android.client.entities.api.Attachment; import app.fedilab.android.client.entities.api.Status; import app.fedilab.android.databinding.DrawerMediaBinding; import app.fedilab.android.helper.Helper; public class ImageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private final List<Status> statuses; private Context context; public ImageAdapter(List<Status> statuses) { this.statuses = statuses; public ImageAdapter() { } public int getCount() { return statuses.size(); return mediaAttachmentProfile.size(); } public Status getItem(int position) { return statuses.get(position); public Attachment getItem(int position) { return mediaAttachmentProfile.get(position); } @NonNull Loading @@ -64,35 +61,40 @@ public class ImageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) { Status status = statuses.get(position); Attachment attachment = mediaAttachmentProfile.get(position); final ViewHolder holder = (ViewHolder) viewHolder; if (Helper.isValidContextForGlide(context) && status.art_attachment != null) { if (status.art_attachment.preview_url != null) { Glide.with(context).load(status.art_attachment.preview_url).into(holder.binding.media); } else if (status.art_attachment.url != null) { Glide.with(context).load(status.art_attachment.url).into(holder.binding.media); if (Helper.isValidContextForGlide(context) && attachment != null) { if (attachment.preview_url != null) { Glide.with(context).load(attachment.preview_url).into(holder.binding.media); } else if (attachment.url != null) { Glide.with(context).load(attachment.url).into(holder.binding.media); } } holder.binding.media.setOnClickListener(v -> { Intent mediaIntent = new Intent(context, MediaActivity.class); Bundle b = new Bundle(); b.putInt(Helper.ARG_MEDIA_POSITION, 1); ArrayList<Attachment> attachmentsTmp = new ArrayList<>(); attachmentsTmp.add(status.art_attachment); b.putSerializable(Helper.ARG_STATUS, status); b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(attachmentsTmp)); b.putInt(Helper.ARG_MEDIA_POSITION, position + 1); b.putBoolean(Helper.ARG_MEDIA_ARRAY_PROFILE, true); mediaIntent.putExtras(b); ActivityOptionsCompat options = ActivityOptionsCompat .makeSceneTransitionAnimation((Activity) context, holder.binding.media, status.media_attachments.get(0).url); ActivityOptionsCompat options = null; if (attachment != null) { options = ActivityOptionsCompat .makeSceneTransitionAnimation((Activity) context, holder.binding.media, attachment.url); } else { return; } // start the new activity context.startActivity(mediaIntent, options.toBundle()); }); holder.binding.media.setOnLongClickListener(v -> { Intent intentContext = new Intent(context, ContextActivity.class); intentContext.putExtra(Helper.ARG_STATUS, status); if (attachment != null) { intentContext.putExtra(Helper.ARG_STATUS, attachment.status); } else { return false; } intentContext.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intentContext); return false; Loading @@ -105,7 +107,7 @@ public class ImageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> @Override public int getItemCount() { return statuses.size(); return mediaAttachmentProfile.size(); } Loading