|
|
@ -3851,18 +3851,48 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void onOpenImage(long id, String source) {
|
|
|
|
private void onOpenImage(long id, @NonNull String source) {
|
|
|
|
Log.i("Viewing image source=" + source);
|
|
|
|
Log.i("Viewing image source=" + source);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Uri uri = Uri.parse(source);
|
|
|
|
|
|
|
|
String scheme = uri.getScheme();
|
|
|
|
|
|
|
|
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putLong("id", id);
|
|
|
|
args.putLong("id", id);
|
|
|
|
args.putString("source", source);
|
|
|
|
args.putString("source", source);
|
|
|
|
args.putInt("zoom", zoom);
|
|
|
|
args.putInt("zoom", zoom);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ("cid".equals(scheme)) {
|
|
|
|
|
|
|
|
new SimpleTask<EntityAttachment>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected EntityAttachment onExecute(Context context, Bundle args) {
|
|
|
|
|
|
|
|
long id = args.getLong("id");
|
|
|
|
|
|
|
|
String source = args.getString("source");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
|
|
|
|
String cid = "<" + source.substring(4) + ">";
|
|
|
|
|
|
|
|
return db.attachment().getAttachment(id, cid);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void onExecuted(Bundle args, EntityAttachment attachment) {
|
|
|
|
|
|
|
|
if (attachment != null)
|
|
|
|
|
|
|
|
Helper.share(context, attachment.getFile(context), attachment.getMimeType(), attachment.name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void onException(Bundle args, Throwable ex) {
|
|
|
|
|
|
|
|
Log.unexpectedError(parentFragment.getParentFragmentManager(), ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}.execute(context, owner, args, "view:cid");
|
|
|
|
|
|
|
|
} else if ("http".equals(scheme) || "https".equals(scheme))
|
|
|
|
|
|
|
|
Helper.view(context, uri, false);
|
|
|
|
|
|
|
|
else {
|
|
|
|
FragmentDialogImage fragment = new FragmentDialogImage();
|
|
|
|
FragmentDialogImage fragment = new FragmentDialogImage();
|
|
|
|
fragment.setArguments(args);
|
|
|
|
fragment.setArguments(args);
|
|
|
|
fragment.show(parentFragment.getParentFragmentManager(), "view:image");
|
|
|
|
fragment.show(parentFragment.getParentFragmentManager(), "view:image");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void onMenuUnseen(final TupleMessageEx message) {
|
|
|
|
private void onMenuUnseen(final TupleMessageEx message) {
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
Bundle args = new Bundle();
|
|
|
|