@@ -1507,42 +1507,47 @@ public void updateScrollBars() {
15071507 recomputeCharPositions ();
15081508 }
15091509
1510- Rect scrollPanelRect = dimensions .getScrollPanelRectangle ();
1510+ final Rect scrollPanelRect = dimensions .getScrollPanelRectangle ();
1511+ Activity activity = (Activity ) codeArea .getContext ();
1512+ activity .runOnUiThread (new Runnable () {
1513+ @ Override
1514+ public void run () {
15111515// dataView.layout(scrollPanelRect.left, scrollPanelRect.top, scrollPanelRect.right, scrollPanelRect.bottom);
1512- dataView .layout (0 , 0 , scrollPanelRect .width (), scrollPanelRect .height ());
1516+ dataView .layout (0 , 0 , scrollPanelRect .width (), scrollPanelRect .height ());
15131517
1514- if (rowHeight > 0 && characterWidth > 0 ) {
1515- scrolling .updateCache (codeArea , getHorizontalScrollBarSize (), getVerticalScrollBarSize ());
1516- scrolling .computeViewDimension (viewDimension , codeArea .getWidth (), codeArea .getHeight (), layout , structure , characterWidth , rowHeight );
1517- dataView .setMinimumWidth (viewDimension .getWidth ());
1518- dataView .setMinimumHeight (viewDimension .getHeight ());
1518+ if (rowHeight > 0 && characterWidth > 0 ) {
1519+ scrolling .updateCache (codeArea , getHorizontalScrollBarSize (), getVerticalScrollBarSize ());
1520+ scrolling .computeViewDimension (viewDimension , codeArea .getWidth (), codeArea .getHeight (), layout , structure , characterWidth , rowHeight );
1521+ dataView .setMinimumWidth (viewDimension .getWidth ());
1522+ dataView .setMinimumHeight (viewDimension .getHeight ());
15191523
1520- scrolling .updateCache (codeArea , getHorizontalScrollBarSize (), getVerticalScrollBarSize ());
1524+ scrolling .updateCache (codeArea , getHorizontalScrollBarSize (), getVerticalScrollBarSize ());
15211525
1522- int documentDataWidth = structure .getCharactersPerRow () * characterWidth ;
1523- long rowsPerData = (structure .getDataSize () / structure .getBytesPerRow ()) + 1 ;
1526+ int documentDataWidth = structure .getCharactersPerRow () * characterWidth ;
1527+ long rowsPerData = (structure .getDataSize () / structure .getBytesPerRow ()) + 1 ;
15241528
1525- int documentDataHeight ;
1526- if (rowsPerData > scrolling .getMaximumScrollBarHeight () / rowHeight ) {
1527- scrolling .setScrollBarVerticalScale (ScrollBarVerticalScale .SCALED );
1528- documentDataHeight = scrolling .getMaximumScrollBarHeight ();
1529- } else {
1530- scrolling .setScrollBarVerticalScale (ScrollBarVerticalScale .NORMAL );
1531- documentDataHeight = (int ) (rowsPerData * rowHeight );
1532- }
1529+ int documentDataHeight ;
1530+ if (rowsPerData > scrolling .getMaximumScrollBarHeight () / rowHeight ) {
1531+ scrolling .setScrollBarVerticalScale (ScrollBarVerticalScale .SCALED );
1532+ documentDataHeight = scrolling .getMaximumScrollBarHeight ();
1533+ } else {
1534+ scrolling .setScrollBarVerticalScale (ScrollBarVerticalScale .NORMAL );
1535+ documentDataHeight = (int ) (rowsPerData * rowHeight );
1536+ }
15331537
1534- recomputeDimensions ();
1535- scrollPanelRect = dimensions .getScrollPanelRectangle ();
1536- // dataView.layout(scrollPanelRect.left, scrollPanelRect.top, scrollPanelRect.right, scrollPanelRect.bottom);
1537- // dataView.layout(0, 0, scrollPanelRect.width(), scrollPanelRect.height());
1538- dataView .layout (0 , 0 , documentDataWidth , documentDataHeight );
1539- dataView .setMinimumWidth (documentDataWidth );
1540- dataView .setMinimumHeight (documentDataHeight );
1541- }
1538+ recomputeDimensions ();
1539+ // scrollPanelRect = dimensions.getScrollPanelRectangle();
1540+ // dataView.layout(scrollPanelRect.left, scrollPanelRect.top, scrollPanelRect.right, scrollPanelRect.bottom);
1541+ // dataView.layout(0, 0, scrollPanelRect.width(), scrollPanelRect.height());
1542+ dataView .layout (0 , 0 , documentDataWidth , documentDataHeight );
1543+ dataView .setMinimumWidth (documentDataWidth );
1544+ dataView .setMinimumHeight (documentDataHeight );
1545+ }
1546+ }
1547+ });
15421548
15431549 // TODO on resize only
15441550 final Rect scrollPanelRectangle = dimensions .getScrollPanelRectangle ();
1545- Activity activity = (Activity ) codeArea .getContext ();
15461551 activity .runOnUiThread (new Runnable () {
15471552 @ Override
15481553 public void run () {
0 commit comments