Skip to content

Commit

Permalink
Update image display
Browse files Browse the repository at this point in the history
- Fix images not appearing at the end of notes
- Keep image aspect ratio when using fixed size
  • Loading branch information
aancel committed Oct 10, 2018
1 parent f84b628 commit 977b55e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class TextViewWithMarkup : TextViewFixed {

// Ensure that we are updating the correct portion of text
// As this could be called during drawing
if(this.text.length > end) {
if(this.text.length >= end) {
builder.setSpan(span, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)

setText(builder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ protected void onPostExecute(Drawable result) {
float newPixelWidth = (int) ((float) view.getWidth());

if(fixedSize > 0) {
result.setBounds(0, 0, fixedSize, fixedSize);
// Keep aspect ratio when using fixed size
float ratio = drawableHeight / drawableWidth;
result.setBounds(0, 0, fixedSize, (int) (fixedSize * ratio));
}
else {
// Rescale the drawable if it is larger that the current view width
Expand Down

0 comments on commit 977b55e

Please sign in to comment.