turn off saving logs for now; move capture of title to where it's more

likely to succeed, and assert that it is. I think this will fix the
title-not-reverting problem I've been seeing.
This commit is contained in:
Eric House 2016-05-10 06:40:23 -07:00
parent 608533d189
commit 253c0d7496
2 changed files with 20 additions and 17 deletions

View file

@ -67,8 +67,8 @@ public class DBUtils {
public static final int GROUPID_UNSPEC = -1;
public static final String KEY_NEWGAMECOUNT = "DBUtils.newGameCount";
// how many log rows to keep?
private static final int LOGLIMIT = 5000;
// how many log rows to keep? (0 means off)
private static final int LOGLIMIT = 0;
private static final String DICTS_SEP = ",";
@ -2418,22 +2418,24 @@ public class DBUtils {
private static void appendLog( Context context, String msg )
{
ContentValues values = new ContentValues();
values.put( DBHelper.MESSAGE, msg );
if ( 0 < LOGLIMIT ) {
ContentValues values = new ContentValues();
values.put( DBHelper.MESSAGE, msg );
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getWritableDatabase();
long rowid = db.insert( DBHelper.TABLE_NAME_LOGS, null, values );
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getWritableDatabase();
long rowid = db.insert( DBHelper.TABLE_NAME_LOGS, null, values );
if ( 0 == (rowid % (LOGLIMIT / 10)) ) {
String where =
String.format( "not rowid in (select rowid from %s order by TIMESTAMP desc limit %d)",
DBHelper.TABLE_NAME_LOGS, LOGLIMIT );
int nGone = db.delete( DBHelper.TABLE_NAME_LOGS, where, null );
DbgUtils.logf( false, "appendLog(): deleted %d rows", nGone );
if ( 0 == (rowid % (LOGLIMIT / 10)) ) {
String where =
String.format( "not rowid in (select rowid from %s order by TIMESTAMP desc limit %d)",
DBHelper.TABLE_NAME_LOGS, LOGLIMIT );
int nGone = db.delete( DBHelper.TABLE_NAME_LOGS, where, null );
DbgUtils.logf( false, "appendLog(): deleted %d rows", nGone );
}
db.close();
}
db.close();
}
}

View file

@ -918,6 +918,9 @@ public class GamesListDelegate extends ListDelegateBase
@Override
protected void init( Bundle savedInstanceState )
{
m_origTitle = getTitle();
Assert.assertTrue( m_origTitle.equals( getString(R.string.app_name) ) );
m_handler = new Handler();
// Next line useful if contents of DB are crashing app on start
// DBUtils.saveDB( m_activity );
@ -951,8 +954,6 @@ public class GamesListDelegate extends ListDelegateBase
tryStartsFromIntent( getIntent() );
getDictForLangIf();
m_origTitle = getTitle();
} // init
// protected View onCreateView( Bundle savedInstanceState )