use of com.keylesspalace.tusky.viewdata.AttachmentViewData in project Tusky by Vavassor.
the class SFragment method viewMedia.
protected void viewMedia(int urlIndex, List<AttachmentViewData> attachments, @Nullable View view) {
final AttachmentViewData active = attachments.get(urlIndex);
Attachment.Type type = active.getAttachment().getType();
switch(type) {
case GIFV:
case VIDEO:
case IMAGE:
case AUDIO:
{
final Intent intent = ViewMediaActivity.newIntent(getContext(), attachments, urlIndex);
if (view != null) {
String url = active.getAttachment().getUrl();
ViewCompat.setTransitionName(view, url);
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), view, url);
startActivity(intent, options.toBundle());
} else {
startActivity(intent);
}
break;
}
default:
case UNKNOWN:
{
LinkHelper.openLink(active.getAttachment().getUrl(), getContext());
break;
}
}
}
Aggregations