Loading app/src/main/java/net/fabiszewski/ulogger/DbAccess.java +2 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ class DbAccess { mDbHelper = DbHelper.getInstance(context.getApplicationContext()); db = mDbHelper.getWritableDatabase(); } if (Logger.DEBUG) { Log.d(TAG, "[+openCount = " + openCount + "]"); } } } Loading Loading @@ -335,6 +336,7 @@ class DbAccess { mDbHelper.close(); } } if (Logger.DEBUG) { Log.d(TAG, "[-openCount = " + openCount + "]"); } } } Loading app/src/main/java/net/fabiszewski/ulogger/MainActivity.java +10 −11 Original line number Diff line number Diff line Loading @@ -91,14 +91,6 @@ public class MainActivity extends AppCompatActivity { locLabel = (TextView) findViewById(R.id.location_status); locLed = (TextView) findViewById(R.id.loc_led); db = DbAccess.getInstance(); db.open(this); String trackName = db.getTrackName(); if (trackName != null) { updateTrackLabel(trackName); } registerBroadcastReceiver(); updateStatus(); } /** Loading @@ -109,6 +101,13 @@ public class MainActivity extends AppCompatActivity { super.onResume(); if (Logger.DEBUG) { Log.d(TAG, "[onResume]"); } db = DbAccess.getInstance(); db.open(this); String trackName = db.getTrackName(); if (trackName != null) { updateTrackLabel(trackName); } if (LoggerService.isRunning()) { toggleButton.setText(TXT_STOP); setLocLed(LED_GREEN); Loading @@ -127,6 +126,9 @@ public class MainActivity extends AppCompatActivity { protected void onPause() { if (Logger.DEBUG) { Log.d(TAG, "[onPause]"); } unregisterReceiver(mBroadcastReceiver); if (db != null) { db.close(); } super.onPause(); } Loading @@ -136,9 +138,6 @@ public class MainActivity extends AppCompatActivity { @Override protected void onDestroy() { if (Logger.DEBUG) { Log.d(TAG, "[onDestroy]"); } if (db != null) { db.close(); } super.onDestroy(); } Loading app/src/main/java/net/fabiszewski/ulogger/WebSyncService.java +10 −4 Original line number Diff line number Diff line Loading @@ -56,6 +56,16 @@ public class WebSyncService extends IntentService { super("WebSyncService"); } @Override public void onCreate() { super.onCreate(); if (Logger.DEBUG) { Log.d(TAG, "[websync create]"); } web = new WebHelper(this); db = DbAccess.getInstance(); db.open(this); } /** * Handle synchronization intent * @param intent Intent Loading @@ -72,10 +82,6 @@ public class WebSyncService extends IntentService { pi = null; } web = new WebHelper(this); db = DbAccess.getInstance(); db.open(this); if (!isAuthorized) { try { web.authorize(); Loading Loading
app/src/main/java/net/fabiszewski/ulogger/DbAccess.java +2 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ class DbAccess { mDbHelper = DbHelper.getInstance(context.getApplicationContext()); db = mDbHelper.getWritableDatabase(); } if (Logger.DEBUG) { Log.d(TAG, "[+openCount = " + openCount + "]"); } } } Loading Loading @@ -335,6 +336,7 @@ class DbAccess { mDbHelper.close(); } } if (Logger.DEBUG) { Log.d(TAG, "[-openCount = " + openCount + "]"); } } } Loading
app/src/main/java/net/fabiszewski/ulogger/MainActivity.java +10 −11 Original line number Diff line number Diff line Loading @@ -91,14 +91,6 @@ public class MainActivity extends AppCompatActivity { locLabel = (TextView) findViewById(R.id.location_status); locLed = (TextView) findViewById(R.id.loc_led); db = DbAccess.getInstance(); db.open(this); String trackName = db.getTrackName(); if (trackName != null) { updateTrackLabel(trackName); } registerBroadcastReceiver(); updateStatus(); } /** Loading @@ -109,6 +101,13 @@ public class MainActivity extends AppCompatActivity { super.onResume(); if (Logger.DEBUG) { Log.d(TAG, "[onResume]"); } db = DbAccess.getInstance(); db.open(this); String trackName = db.getTrackName(); if (trackName != null) { updateTrackLabel(trackName); } if (LoggerService.isRunning()) { toggleButton.setText(TXT_STOP); setLocLed(LED_GREEN); Loading @@ -127,6 +126,9 @@ public class MainActivity extends AppCompatActivity { protected void onPause() { if (Logger.DEBUG) { Log.d(TAG, "[onPause]"); } unregisterReceiver(mBroadcastReceiver); if (db != null) { db.close(); } super.onPause(); } Loading @@ -136,9 +138,6 @@ public class MainActivity extends AppCompatActivity { @Override protected void onDestroy() { if (Logger.DEBUG) { Log.d(TAG, "[onDestroy]"); } if (db != null) { db.close(); } super.onDestroy(); } Loading
app/src/main/java/net/fabiszewski/ulogger/WebSyncService.java +10 −4 Original line number Diff line number Diff line Loading @@ -56,6 +56,16 @@ public class WebSyncService extends IntentService { super("WebSyncService"); } @Override public void onCreate() { super.onCreate(); if (Logger.DEBUG) { Log.d(TAG, "[websync create]"); } web = new WebHelper(this); db = DbAccess.getInstance(); db.open(this); } /** * Handle synchronization intent * @param intent Intent Loading @@ -72,10 +82,6 @@ public class WebSyncService extends IntentService { pi = null; } web = new WebHelper(this); db = DbAccess.getInstance(); db.open(this); if (!isAuthorized) { try { web.authorize(); Loading