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
@Override
public boolean scoreBegin( Rect rect, int numPlayers, int[] scores,
int remCount )
{
@ -217,6 +218,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
return true;
}
@Override
public boolean measureRemText( Rect r, int nTilesLeft, int[] width,
int[] height )
{
@ -238,6 +240,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
return showREM;
}
@Override
public void drawRemText( Rect rInner, Rect rOuter, int nTilesLeft,
boolean focussed )
{
@ -249,6 +252,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
drawCentered( m_remText, rInner, null );
}
@Override
public void measureScoreText( Rect rect, DrawScoreInfo dsi,
int[] width, int[] height )
{
@ -299,6 +303,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
height[0] = rect.height();
}
@Override
public void score_drawPlayer( Rect rInner, Rect rOuter,
int gotPct, DrawScoreInfo dsi )
{
@ -326,6 +331,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
}
}
@Override
public void drawTimer( Rect rect, final int player,
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,
int owner, int bonus, int hintAtts, int flags )
{
@ -434,6 +441,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
return canDraw;
} // drawCell
@Override
public void drawBoardArrow( Rect rect, int bonus, boolean vert,
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 );
}
@Override
public boolean trayBegin( Rect rect, int owner, int score )
{
m_trayOwner = owner;
@ -470,22 +479,26 @@ public class BoardCanvas extends Canvas implements DrawCtx {
return true;
}
@Override
public boolean drawTile( Rect rect, String text, int val, int flags )
{
return drawTileImpl( rect, text, val, flags, true );
}
@Override
public boolean drawTileMidDrag( Rect rect, String text, int val, int owner,
int flags )
{
return drawTileImpl( rect, text, val, flags, false );
}
@Override
public boolean drawTileBack( Rect rect, int flags )
{
return drawTileImpl( rect, "?", -1, flags, true );
}
@Override
public void drawTrayDivider( Rect rect, int flags )
{
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,
int curTurn, int flags )
{
@ -528,6 +542,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
rect, null );
}
@Override
public void objFinished( /*BoardObjectType*/int typ, Rect rect )
{
if ( DrawCtx.OBJ_BOARD == typ ) {

View file

@ -149,9 +149,9 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
@Override
protected void onMeasure( int widthMeasureSpec, int heightMeasureSpec )
{
// DbgUtils.logf( "BoardView.onMeasure(width: %s, height: %s)",
// MeasureSpec.toString( widthMeasureSpec ),
// MeasureSpec.toString( heightMeasureSpec ) );
// Log.d( TAG, "onMeasure(width: %s, height: %s)",
// MeasureSpec.toString( widthMeasureSpec ),
// MeasureSpec.toString( heightMeasureSpec ) );
if ( null != m_dims ) {
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 ) {
m_dims = null;
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 )
{
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;
if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ) {
bitmap = Bitmap.createBitmap(bitmap);
@ -209,8 +216,6 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
ConnStatusHandler.draw( m_context, canvas, getResources(),
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
// BoardHandler interface implementation
@Override
public void startHandling( Activity parent, JNIThread thread,
CommsConnTypeSet connTypes )
{
@ -312,6 +318,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
invalidate();
}
@Override
public void stopHandling()
{
m_jniThread = null;
@ -322,6 +329,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
}
// SyncedDraw interface implementation
@Override
public void doJNIDraw()
{
boolean drew = false;
@ -339,8 +347,10 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
}
}
@Override
public void dimsChanged( BoardDims dims )
{
Log.d( TAG, "dimsChanged(%s)", dims );
m_dims = dims;
m_parent.runOnUiThread( new Runnable() {
public void run()

View file

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

View file

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