cleanup, e.g. add @Override, found while debugging

This commit is contained in:
Eric House 2020-01-13 09:15:44 -08:00
parent 97bec5ca73
commit 2cd94671fd
4 changed files with 54 additions and 22 deletions

View file

@ -209,6 +209,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
} }
// DrawCtxt interface implementation // DrawCtxt interface implementation
@Override
public boolean scoreBegin( Rect rect, int numPlayers, int[] scores, public boolean scoreBegin( Rect rect, int numPlayers, int[] scores,
int remCount ) int remCount )
{ {
@ -217,6 +218,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
return true; return true;
} }
@Override
public boolean measureRemText( Rect r, int nTilesLeft, int[] width, public boolean measureRemText( Rect r, int nTilesLeft, int[] width,
int[] height ) int[] height )
{ {
@ -238,6 +240,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
return showREM; return showREM;
} }
@Override
public void drawRemText( Rect rInner, Rect rOuter, int nTilesLeft, public void drawRemText( Rect rInner, Rect rOuter, int nTilesLeft,
boolean focussed ) boolean focussed )
{ {
@ -249,6 +252,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
drawCentered( m_remText, rInner, null ); drawCentered( m_remText, rInner, null );
} }
@Override
public void measureScoreText( Rect rect, DrawScoreInfo dsi, public void measureScoreText( Rect rect, DrawScoreInfo dsi,
int[] width, int[] height ) int[] width, int[] height )
{ {
@ -299,6 +303,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
height[0] = rect.height(); height[0] = rect.height();
} }
@Override
public void score_drawPlayer( Rect rInner, Rect rOuter, public void score_drawPlayer( Rect rInner, Rect rOuter,
int gotPct, DrawScoreInfo dsi ) int gotPct, DrawScoreInfo dsi )
{ {
@ -326,6 +331,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
} }
} }
@Override
public void drawTimer( Rect rect, final int player, public void drawTimer( Rect rect, final int player,
int secondsLeft ) int secondsLeft )
{ {
@ -358,6 +364,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
} }
} }
@Override
public boolean drawCell( Rect rect, String text, int tile, int value, public boolean drawCell( Rect rect, String text, int tile, int value,
int owner, int bonus, int hintAtts, int flags ) int owner, int bonus, int hintAtts, int flags )
{ {
@ -434,6 +441,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
return canDraw; return canDraw;
} // drawCell } // drawCell
@Override
public void drawBoardArrow( Rect rect, int bonus, boolean vert, public void drawBoardArrow( Rect rect, int bonus, boolean vert,
int hintAtts, int flags ) int hintAtts, int flags )
{ {
@ -463,6 +471,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
postNAHint( R.string.not_again_arrow, R.string.key_notagain_arrow ); postNAHint( R.string.not_again_arrow, R.string.key_notagain_arrow );
} }
@Override
public boolean trayBegin( Rect rect, int owner, int score ) public boolean trayBegin( Rect rect, int owner, int score )
{ {
m_trayOwner = owner; m_trayOwner = owner;
@ -470,22 +479,26 @@ public class BoardCanvas extends Canvas implements DrawCtx {
return true; return true;
} }
@Override
public boolean drawTile( Rect rect, String text, int val, int flags ) public boolean drawTile( Rect rect, String text, int val, int flags )
{ {
return drawTileImpl( rect, text, val, flags, true ); return drawTileImpl( rect, text, val, flags, true );
} }
@Override
public boolean drawTileMidDrag( Rect rect, String text, int val, int owner, public boolean drawTileMidDrag( Rect rect, String text, int val, int owner,
int flags ) int flags )
{ {
return drawTileImpl( rect, text, val, flags, false ); return drawTileImpl( rect, text, val, flags, false );
} }
@Override
public boolean drawTileBack( Rect rect, int flags ) public boolean drawTileBack( Rect rect, int flags )
{ {
return drawTileImpl( rect, "?", -1, flags, true ); return drawTileImpl( rect, "?", -1, flags, true );
} }
@Override
public void drawTrayDivider( Rect rect, int flags ) public void drawTrayDivider( Rect rect, int flags )
{ {
boolean isCursor = 0 != (flags & CELL_ISCURSOR); boolean isCursor = 0 != (flags & CELL_ISCURSOR);
@ -502,6 +515,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
} }
} }
@Override
public void score_pendingScore( Rect rect, int score, int playerNum, public void score_pendingScore( Rect rect, int score, int playerNum,
int curTurn, int flags ) int curTurn, int flags )
{ {
@ -528,6 +542,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
rect, null ); rect, null );
} }
@Override
public void objFinished( /*BoardObjectType*/int typ, Rect rect ) public void objFinished( /*BoardObjectType*/int typ, Rect rect )
{ {
if ( DrawCtx.OBJ_BOARD == typ ) { if ( DrawCtx.OBJ_BOARD == typ ) {

View file

@ -149,9 +149,9 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
@Override @Override
protected void onMeasure( int widthMeasureSpec, int heightMeasureSpec ) protected void onMeasure( int widthMeasureSpec, int heightMeasureSpec )
{ {
// DbgUtils.logf( "BoardView.onMeasure(width: %s, height: %s)", // Log.d( TAG, "onMeasure(width: %s, height: %s)",
// MeasureSpec.toString( widthMeasureSpec ), // MeasureSpec.toString( widthMeasureSpec ),
// MeasureSpec.toString( heightMeasureSpec ) ); // MeasureSpec.toString( heightMeasureSpec ) );
if ( null != m_dims ) { if ( null != m_dims ) {
if ( BoardContainer.getIsPortrait() != (m_dims.height > m_dims.width) ) { if ( BoardContainer.getIsPortrait() != (m_dims.height > m_dims.width) ) {
@ -160,6 +160,8 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
if ( ++m_dimsTossCount < 4 ) { if ( ++m_dimsTossCount < 4 ) {
m_dims = null; m_dims = null;
m_layoutWidth = m_layoutHeight = 0; m_layoutWidth = m_layoutHeight = 0;
} else {
Assert.failDbg();
} }
} }
} }
@ -200,7 +202,12 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
protected void onDraw( Canvas canvas ) protected void onDraw( Canvas canvas )
{ {
synchronized( this ) { synchronized( this ) {
if ( layoutBoardOnce() && m_measuredFromDims ) { if ( !layoutBoardOnce() ) {
// Log.d( TAG, "onDraw(): layoutBoardOnce() failed" );
} else if ( ! m_measuredFromDims ) {
// Log.d( TAG, "onDraw(): m_measuredFromDims not set" );
} else {
Log.d( TAG, "onDraw(): ready to go!" );
Bitmap bitmap = s_bitmap; Bitmap bitmap = s_bitmap;
if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ) { if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ) {
bitmap = Bitmap.createBitmap(bitmap); bitmap = Bitmap.createBitmap(bitmap);
@ -209,8 +216,6 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
ConnStatusHandler.draw( m_context, canvas, getResources(), ConnStatusHandler.draw( m_context, canvas, getResources(),
m_connTypes, m_isSolo ); m_connTypes, m_isSolo );
} else {
Log.d( TAG, "onDraw(): board not laid out yet" );
} }
} }
} }
@ -285,6 +290,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
} // layoutBoardOnce } // layoutBoardOnce
// BoardHandler interface implementation // BoardHandler interface implementation
@Override
public void startHandling( Activity parent, JNIThread thread, public void startHandling( Activity parent, JNIThread thread,
CommsConnTypeSet connTypes ) CommsConnTypeSet connTypes )
{ {
@ -312,6 +318,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
invalidate(); invalidate();
} }
@Override
public void stopHandling() public void stopHandling()
{ {
m_jniThread = null; m_jniThread = null;
@ -322,6 +329,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
} }
// SyncedDraw interface implementation // SyncedDraw interface implementation
@Override
public void doJNIDraw() public void doJNIDraw()
{ {
boolean drew = false; boolean drew = false;
@ -339,8 +347,10 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
} }
} }
@Override
public void dimsChanged( BoardDims dims ) public void dimsChanged( BoardDims dims )
{ {
Log.d( TAG, "dimsChanged(%s)", dims );
m_dims = dims; m_dims = dims;
m_parent.runOnUiThread( new Runnable() { m_parent.runOnUiThread( new Runnable() {
public void run() public void run()

View file

@ -267,8 +267,11 @@ public class DBUtils {
long endMS = System.currentTimeMillis(); long endMS = System.currentTimeMillis();
// Might want to be cacheing this... // Might want to be cacheing this...
Log.d( TAG, "getSummary(rowid=%d) => %s (took %dms)", long elapsed = endMS - startMS;
lock.getRowid(), summary, endMS - startMS ); if ( elapsed > 10 ) {
Log.d( TAG, "getSummary(rowid=%d) => %s (took>10: %dms)",
lock.getRowid(), summary, elapsed );
}
return summary; return summary;
} // getSummary } // getSummary

View file

@ -31,21 +31,25 @@ public class BoardDims {
public int cellSize, maxCellSize; public int cellSize, maxCellSize;
public int timerWidth; public int timerWidth;
// @Override
// public String toString() // public String toString()
// { // {
// return "width: " + width // StringBuilder sb = new StringBuilder()
// + " height: " + height // .append( "width: " ).append( width )
// + " left: " + left // .append(" height: ").append( height )
// + " top: " + top // .append(" left: " ).append( left )
// + " scoreLeft: " + scoreLeft // .append(" top: " ).append( top )
// + " scoreHt: " + scoreHt // .append(" scoreLeft: " ).append( scoreLeft )
// + " scoreWidth: " + scoreWidth // .append(" scoreHt: " ).append( scoreHt )
// + " boardHt: " + boardHt // .append(" scoreWidth: " ).append( scoreWidth )
// + " trayLeft: " + trayLeft // .append(" boardHt: " ).append( boardHt )
// + " trayTop: " + trayTop // .append(" trayLeft: " ).append( trayLeft )
// + " trayWidth: " + trayWidth // .append(" trayTop: " ).append( trayTop )
// + " trayHt: " + trayHt // .append(" trayWidth: " ).append( trayWidth )
// + " cellSize: " + cellSize // .append(" trayHt: " ).append( trayHt )
// + " maxCellSize: " + maxCellSize; // .append(" cellSize: " ).append(cellSize)
// .append(" maxCellSize: " ).append(maxCellSize)
// ;
// return sb.toString();
// } // }
} }