wait until view is ready

This commit is contained in:
contrudar 2016-11-07 16:10:34 +03:00
parent 289cf0211e
commit c2ffe43d44
1 changed files with 10 additions and 1 deletions

View File

@ -300,6 +300,16 @@ public class PdfViewerFragment extends Fragment {
int maxWidthToPopulate = mGraphView.getWidth();
int maxHeightToPopulate = mGraphView.getHeight();
if (maxWidthToPopulate == 0 || maxHeightToPopulate == 0) {
mGraphView.post(new Runnable() {
@Override
public void run() {
showPage(page);
}
});
return;
}
int calculatedWidth;
int calculatedHeight;
final double widthRatio = width / maxWidthToPopulate;
@ -331,7 +341,6 @@ public class PdfViewerFragment extends Fragment {
}
}
}
final Bitmap bitmap = mPdfPage.getImage(calculatedWidth, calculatedHeight, null, true, true);
mGraphView.setPageBitmap(bitmap);
mGraphView.updateImage();