Fixed image sizing

pull/162/head
M66B 6 years ago
parent e097a01922
commit 2d917e21ab

@ -1419,13 +1419,17 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
wvBody.setVisibility(View.GONE);
}
Bundle args = new Bundle();
final Bundle args = new Bundle();
args.putSerializable("message", message);
args.putBoolean("show_images", show_images);
args.putBoolean("show_full", show_full);
args.putBoolean("show_quotes", show_quotes);
args.putInt("zoom", zoom);
// Run task after measure
new Handler().post(new Runnable() {
@Override
public void run() {
new SimpleTask<Object>() {
@Override
protected Object onExecute(final Context context, final Bundle args) throws IOException {
@ -1593,6 +1597,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
}.execute(context, owner, args, "message:body");
}
});
}
private void bindAttachments(final TupleMessageEx message, @Nullable List<EntityAttachment> attachments) {
if (attachments == null)

@ -58,8 +58,6 @@ import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
class ImageHelper {
private static final float MIN_LUMINANCE = 0.33f;
@ -387,17 +385,6 @@ class ImageHelper {
d.setBounds(0, 0, w, h);
}
final Semaphore semaphore = new Semaphore(0);
view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
view.removeOnLayoutChangeListener(this);
Rect bounds = d.getBounds();
int w = bounds.width();
int h = bounds.height();
float width = view.getWidth();
if (w > width) {
float scale = width / w;
@ -405,16 +392,6 @@ class ImageHelper {
h = Math.round(h * scale);
d.setBounds(0, 0, w, h);
}
semaphore.release();
}
});
try {
semaphore.tryAcquire(2500, TimeUnit.MILLISECONDS);
} catch (InterruptedException ex) {
Log.e(ex);
}
}
private static Drawable getDataDrawable(Context context, String source) {

Loading…
Cancel
Save