mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-15 20:48:00 +01:00
cleanup: fix flashing quarantine count and reduce logging
This commit is contained in:
parent
7642613612
commit
a3078fb549
6 changed files with 25 additions and 32 deletions
|
@ -717,7 +717,6 @@ class BoardDelegate(delegator: Delegator) :
|
|||
|
||||
override fun onPrepareOptionsMenu(menu: Menu): Boolean {
|
||||
var inTrade = false
|
||||
var item: MenuItem
|
||||
var strId: Int
|
||||
var enable: Boolean
|
||||
if (null != mGsi) {
|
||||
|
@ -729,7 +728,7 @@ class BoardDelegate(delegator: Delegator) :
|
|||
} else {
|
||||
R.string.board_menu_tray_show
|
||||
}
|
||||
item = menu.findItem(R.id.board_menu_tray)
|
||||
val item = menu.findItem(R.id.board_menu_tray)
|
||||
item.setTitle(getString(strId))
|
||||
Utils.setItemVisible(
|
||||
menu, R.id.board_menu_flip,
|
||||
|
@ -776,6 +775,7 @@ class BoardDelegate(delegator: Delegator) :
|
|||
mGsi!!.canUnpause
|
||||
)
|
||||
}
|
||||
|
||||
Utils.setItemVisible(menu, R.id.board_menu_trade_cancel, inTrade)
|
||||
Utils.setItemVisible(
|
||||
menu, R.id.board_menu_trade_commit,
|
||||
|
@ -784,7 +784,7 @@ class BoardDelegate(delegator: Delegator) :
|
|||
Utils.setItemVisible(menu, R.id.board_menu_game_resign, !inTrade)
|
||||
if (!inTrade) {
|
||||
enable = null == mGsi || mGsi!!.curTurnSelected
|
||||
item = menu.findItem(R.id.board_menu_done)
|
||||
val item = menu.findItem(R.id.board_menu_done)
|
||||
item.setVisible(enable)
|
||||
if (enable) {
|
||||
strId = if (0 >= mView!!.curPending()) {
|
||||
|
@ -796,7 +796,7 @@ class BoardDelegate(delegator: Delegator) :
|
|||
}
|
||||
if (mGameOver || DBUtils.gameOver(mActivity, mRowid)) {
|
||||
mGameOver = true
|
||||
item = menu.findItem(R.id.board_menu_game_resign)
|
||||
val item = menu.findItem(R.id.board_menu_game_resign)
|
||||
item.setTitle(getString(R.string.board_menu_game_final))
|
||||
}
|
||||
}
|
||||
|
@ -821,7 +821,6 @@ class BoardDelegate(delegator: Delegator) :
|
|||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
var handled = true
|
||||
var cmd = JNICmd.CMD_NONE
|
||||
val proc: Runnable? = null
|
||||
val id = item.itemId
|
||||
when (id) {
|
||||
R.id.board_menu_done -> {
|
||||
|
|
|
@ -119,10 +119,7 @@ class GameListItem(private val m_context: Context, aset: AttributeSet?) :
|
|||
super.onDraw(canvas)
|
||||
if (DBUtils.ROWID_NOTFOUND != rowID) {
|
||||
synchronized(s_invalRows) {
|
||||
if (s_invalRows.contains(
|
||||
rowID
|
||||
)
|
||||
) {
|
||||
if (s_invalRows.contains(rowID) ) {
|
||||
forceReload()
|
||||
}
|
||||
}
|
||||
|
@ -323,8 +320,9 @@ class GameListItem(private val m_context: Context, aset: AttributeSet?) :
|
|||
iv.setImageResource(resID)
|
||||
if (BuildConfig.NON_RELEASE) {
|
||||
val quarCount = Quarantine.getCount(rowID)
|
||||
(findViewById<View>(R.id.corrupt_count_marker) as TextView).text =
|
||||
if (0 == quarCount) "" else "" + quarCount
|
||||
findViewById<TextView>(R.id.corrupt_count_marker).text =
|
||||
// 1 is normal: means the game's open.
|
||||
if (quarCount <= 1) "" else "$quarCount"
|
||||
}
|
||||
|
||||
if (XWPrefs.moveCountEnabled(m_context)) {
|
||||
|
@ -375,7 +373,9 @@ class GameListItem(private val m_context: Context, aset: AttributeSet?) :
|
|||
|
||||
private inner class LoadItemTask() : Thread() {
|
||||
override fun run() {
|
||||
val summary = GameUtils.getSummary(m_context, rowID, SUMMARY_WAIT_MSECS.toLong())
|
||||
val summary = GameUtils.getSummary(
|
||||
m_context, rowID, SUMMARY_WAIT_MSECS.toLong()
|
||||
)
|
||||
|
||||
if (0 == --m_loadingCount) {
|
||||
mSummary = summary
|
||||
|
|
|
@ -284,7 +284,8 @@ object NetUtils {
|
|||
} catch (pe: ProtocolException) {
|
||||
Log.ex(TAG, pe)
|
||||
} catch (ioe: IOException) {
|
||||
Log.ex(TAG, ioe)
|
||||
Log.d(TAG, "runConn(%s) failed with IOException: %s",
|
||||
conn, ioe.message)
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "not running conn %s with params %s", conn, param)
|
||||
|
|
|
@ -27,10 +27,10 @@ object Quarantine {
|
|||
private val sDataRef = arrayOf<QData?>(null)
|
||||
|
||||
fun getCount(rowid: Long): Int {
|
||||
var result: Int
|
||||
synchronized(sDataRef) {
|
||||
result = get()!!.countFor(rowid)
|
||||
}
|
||||
val result =
|
||||
synchronized(sDataRef) {
|
||||
get().countFor(rowid)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ object Quarantine {
|
|||
sLogged.add(rowid)
|
||||
Log.d(TAG, "printing calling stack:")
|
||||
DbgUtils.printStack(TAG)
|
||||
val list = get()!!
|
||||
val list = get()
|
||||
.listFor(rowid)
|
||||
for (ii in list!!.indices) {
|
||||
val trace = list[ii]
|
||||
|
@ -59,14 +59,14 @@ object Quarantine {
|
|||
|
||||
fun clear(rowid: Long) {
|
||||
synchronized(sDataRef) {
|
||||
get()!!.clear(rowid)
|
||||
get().clear(rowid)
|
||||
store()
|
||||
}
|
||||
}
|
||||
|
||||
fun recordOpened(rowid: Long) {
|
||||
synchronized(sDataRef) {
|
||||
val newCount = get()!!.increment(rowid)
|
||||
val newCount = get().increment(rowid)
|
||||
store()
|
||||
Log.d(
|
||||
TAG, "recordOpened(%d): %s (count now %d)", rowid,
|
||||
|
@ -77,7 +77,7 @@ object Quarantine {
|
|||
|
||||
fun recordClosed(rowid: Long) {
|
||||
synchronized(sDataRef) {
|
||||
get()!!.clear(rowid)
|
||||
get().clear(rowid)
|
||||
store()
|
||||
Log.d(
|
||||
TAG, "recordClosed(%d): %s (count now 0)", rowid,
|
||||
|
@ -89,7 +89,7 @@ object Quarantine {
|
|||
fun markBad(rowid: Long) {
|
||||
synchronized(sDataRef) {
|
||||
for (ii in 0 until BuildConfig.BAD_COUNT) {
|
||||
get()!!.increment(rowid)
|
||||
get().increment(rowid)
|
||||
}
|
||||
store()
|
||||
Log.d(TAG, "markBad(%d): %s", rowid, sDataRef[0].toString())
|
||||
|
@ -103,7 +103,7 @@ object Quarantine {
|
|||
}
|
||||
}
|
||||
|
||||
private fun get(): QData? {
|
||||
private fun get(): QData {
|
||||
var data: QData?
|
||||
synchronized(sDataRef) {
|
||||
data = sDataRef[0]
|
||||
|
@ -118,7 +118,7 @@ object Quarantine {
|
|||
sDataRef[0] = data
|
||||
}
|
||||
}
|
||||
return data
|
||||
return data!!
|
||||
}
|
||||
|
||||
private val context: Context
|
||||
|
|
|
@ -210,9 +210,6 @@ mutex_init(CommsCtxt* comms)
|
|||
pthread_t _oldHolder = comms->lockHolder; \
|
||||
comms->lockHolder = pthread_self(); \
|
||||
XP_ASSERT(0 == _oldHolder || _oldHolder == comms->lockHolder); \
|
||||
if ( comms->lockHolder == _oldHolder ) { \
|
||||
XP_LOGFF("recursive mutex"); \
|
||||
}
|
||||
|
||||
#define COMMS_MUTEX_UNLOCK_DEBUG() \
|
||||
time_t unlockTime = time(NULL); \
|
||||
|
@ -922,7 +919,6 @@ comms_makeFromStream( MPFORMAL XWEnv xwe, XWStreamCtxt* stream,
|
|||
}
|
||||
if ( 0 == msg->smp.createdStamp ) {
|
||||
msg->smp.createdStamp = dutil_getCurSeconds( comms->dutil, xwe );
|
||||
COMMS_LOGFF( "added missing timestamp" );
|
||||
}
|
||||
#ifdef DEBUG
|
||||
XP_ASSERT( 0 == msg->sendCount );
|
||||
|
@ -2675,7 +2671,6 @@ preProcess(
|
|||
|
||||
/* There should be exactly one type associated with an incoming message */
|
||||
CommsConnType typ = addr_getType( useAddr );
|
||||
XP_LOGFF( "(typ=%s)", ConnType2Str(typ) );
|
||||
|
||||
switch ( typ ) {
|
||||
#ifdef XWFEATURE_RELAY
|
||||
|
@ -2711,7 +2706,6 @@ preProcess(
|
|||
XP_ASSERT(0);
|
||||
break;
|
||||
}
|
||||
LOG_RETURNF( "%s", boolToStr(consumed) );
|
||||
return consumed;
|
||||
} /* preProcess */
|
||||
|
||||
|
@ -3301,7 +3295,6 @@ comms_gatherPlayers( CommsCtxt* comms, XWEnv xwe, XP_U32 created )
|
|||
}
|
||||
}
|
||||
COMMS_MUTEX_UNLOCK();
|
||||
LOG_RETURN_VOID();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -395,7 +395,7 @@ dvc_makeMQTTMessages( XW_DUtilCtxt* dutil, XWEnv xwe,
|
|||
XP_S16 nSent0 = 0;
|
||||
XP_S16 nSent1 = 0;
|
||||
XP_U8 nBufs = 0;
|
||||
XP_LOGFF( "(streamVersion: %X)", streamVersion );
|
||||
// XP_LOGFF( "(streamVersion: %X)", streamVersion );
|
||||
XP_UCHAR devTopic[64]; /* used by two below */
|
||||
formatMQTTDevTopic( addressee, devTopic, VSIZE(devTopic) );
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue