|
|
@ -3851,17 +3851,47 @@ 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);
|
|
|
|
|
|
|
|
|
|
|
|
FragmentDialogImage fragment = new FragmentDialogImage();
|
|
|
|
if ("cid".equals(scheme)) {
|
|
|
|
fragment.setArguments(args);
|
|
|
|
new SimpleTask<EntityAttachment>() {
|
|
|
|
fragment.show(parentFragment.getParentFragmentManager(), "view:image");
|
|
|
|
@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();
|
|
|
|
|
|
|
|
fragment.setArguments(args);
|
|
|
|
|
|
|
|
fragment.show(parentFragment.getParentFragmentManager(), "view:image");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void onMenuUnseen(final TupleMessageEx message) {
|
|
|
|
private void onMenuUnseen(final TupleMessageEx message) {
|
|
|
|