-
-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No image size resolving in visitor #33
Comments
Hey @Adonai ! Yeah, I think that the library should respect TextView canvas size to not exceed it (keeping original ratio of cause). Meanwhile, if it's an option, you could use HTML <!-- takes 33% of canvas width keeping the original ratio -->
<img src="my-super-image.png" width="33%"> |
@noties, yep, thanks, I recognized the difference in htmlParser/native markdown. The problem is that I can't control what users write in the app so for now will come up with small postprocessing hack. Thanks for quick reply! |
@noties , I'll test it this week and report, thanks! |
Ugh, compiling aar without uploading it is such a pain. https://jitpack.io/com/github/noties/Markwon/v1.0.5-SNAPSHOT/ |
Dafuq is this? 😶 It's not created by me. While we are on this I can recommend using local maven repo: https://noties.github.io/blog/2018/03/24/local-maven-repo no need to upload anything |
This thing is auto-generating build artifacts for any github repo you request it to do. |
Yeah, I don't like it. Maybe I should create a snapshot myself as development for the next release is mainly in one branch. |
Ok, tested this, works as expected. You may close this once it's released. |
The other problem, though, is that bounds in In particular, this happens when you have |
I think if you do something like this it should solve the RecyclerView issue: public class MyRecyclerViewAdapter extends RecyclerView.Adapter<MyHolder> {
@Override
public void onBindViewHolder(@NonNull final MyHolder holder, final int position) {
whenReady(holder.text, new Runnable() {
@Override
public void run() {
Markwon.setMarkdown(holder.text, getMarkdown(position));
}
});
}
private static void whenReady(@NonNull final View view, @NonNull final Runnable action) {
if (view.getWidth() == 0) {
view.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
if (view.getWidth() > 0) {
view.getViewTreeObserver().removeOnPreDrawListener(this);
action.run();
}
return true;
}
});
} else {
action.run();
}
}
} |
Thanks, I solved it the other but fairly similar way. |
Hi. Thanks for wonderful Markdown view, was a life-saver to me.
Here: SpannableMarkdownVisitor#visit(org.commonmark.node.Image)
The AsyncDrawable is created without imageSizeResolver and it's rendered veeeery big
I understand that there are no size constraints in native Markdown syntax but at least some level of customization should be possible for images to fit/scale into the textview.
The text was updated successfully, but these errors were encountered: