tidying up log messages on main activity, and got rid of spurious directory creating error in osdUtil
This commit is contained in:
@@ -152,7 +152,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
Log.v(TAG, "onCreateOptionsMenu()");
|
Log.i(TAG, "onCreateOptionsMenu()");
|
||||||
getMenuInflater().inflate(R.menu.main_activity_actions, menu);
|
getMenuInflater().inflate(R.menu.main_activity_actions, menu);
|
||||||
mOptionsMenu = menu;
|
mOptionsMenu = menu;
|
||||||
return true;
|
return true;
|
||||||
@@ -160,31 +160,31 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
Log.v(TAG, "onOptionsItemSelected() : " + item.getItemId() + " selected");
|
Log.i(TAG, "onOptionsItemSelected() : " + item.getItemId() + " selected");
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.action_launch_pebble_app:
|
case R.id.action_launch_pebble_app:
|
||||||
Log.v(TAG, "action_launch_pebble_app");
|
Log.i(TAG, "action_launch_pebble_app");
|
||||||
mConnection.mSdServer.mSdDataSource.startPebbleApp();
|
mConnection.mSdServer.mSdDataSource.startPebbleApp();
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_instal_watch_app:
|
case R.id.action_instal_watch_app:
|
||||||
Log.v(TAG, "action_install_watch_app");
|
Log.i(TAG, "action_install_watch_app");
|
||||||
mConnection.mSdServer.mSdDataSource.installWatchApp();
|
mConnection.mSdServer.mSdDataSource.installWatchApp();
|
||||||
|
|
||||||
case R.id.action_accept_alarm:
|
case R.id.action_accept_alarm:
|
||||||
Log.v(TAG, "action_accept_alarm");
|
Log.i(TAG, "action_accept_alarm");
|
||||||
if (mConnection.mBound) {
|
if (mConnection.mBound) {
|
||||||
mConnection.mSdServer.acceptAlarm();
|
mConnection.mSdServer.acceptAlarm();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_start_stop:
|
case R.id.action_start_stop:
|
||||||
// Respond to the start/stop server menu item.
|
// Respond to the start/stop server menu item.
|
||||||
Log.v(TAG, "action_sart_stop");
|
Log.i(TAG, "action_sart_stop");
|
||||||
if (mConnection.mBound) {
|
if (mConnection.mBound) {
|
||||||
Log.v(TAG, "Stopping Server");
|
Log.i(TAG, "Stopping Server");
|
||||||
mUtil.unbindFromServer(this, mConnection);
|
mUtil.unbindFromServer(this, mConnection);
|
||||||
stopServer();
|
stopServer();
|
||||||
} else {
|
} else {
|
||||||
Log.v(TAG, "Starting Server");
|
Log.i(TAG, "Starting Server");
|
||||||
startServer();
|
startServer();
|
||||||
// and bind to it so we can see its data
|
// and bind to it so we can see its data
|
||||||
mUtil.bindToServer(this, mConnection);
|
mUtil.bindToServer(this, mConnection);
|
||||||
@@ -192,32 +192,32 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
return true;
|
return true;
|
||||||
/* fault beep test does not work with fault timer, so disable test option.
|
/* fault beep test does not work with fault timer, so disable test option.
|
||||||
case R.id.action_test_fault_beep:
|
case R.id.action_test_fault_beep:
|
||||||
Log.v(TAG, "action_test_fault_beep");
|
Log.i(TAG, "action_test_fault_beep");
|
||||||
if (mConnection.mBound) {
|
if (mConnection.mBound) {
|
||||||
mConnection.mSdServer.faultWarningBeep();
|
mConnection.mSdServer.faultWarningBeep();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
*/
|
*/
|
||||||
case R.id.action_test_alarm_beep:
|
case R.id.action_test_alarm_beep:
|
||||||
Log.v(TAG, "action_test_alarm_beep");
|
Log.i(TAG, "action_test_alarm_beep");
|
||||||
if (mConnection.mBound) {
|
if (mConnection.mBound) {
|
||||||
mConnection.mSdServer.alarmBeep();
|
mConnection.mSdServer.alarmBeep();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_test_warning_beep:
|
case R.id.action_test_warning_beep:
|
||||||
Log.v(TAG, "action_test_warning_beep");
|
Log.i(TAG, "action_test_warning_beep");
|
||||||
if (mConnection.mBound) {
|
if (mConnection.mBound) {
|
||||||
mConnection.mSdServer.warningBeep();
|
mConnection.mSdServer.warningBeep();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_test_sms_alarm:
|
case R.id.action_test_sms_alarm:
|
||||||
Log.v(TAG, "action_test_sms_alarm");
|
Log.i(TAG, "action_test_sms_alarm");
|
||||||
if (mConnection.mBound) {
|
if (mConnection.mBound) {
|
||||||
mConnection.mSdServer.sendSMSAlarm();
|
mConnection.mSdServer.sendSMSAlarm();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_logs:
|
case R.id.action_logs:
|
||||||
Log.v(TAG, "action_logs");
|
Log.i(TAG, "action_logs");
|
||||||
try {
|
try {
|
||||||
String url = "http://"
|
String url = "http://"
|
||||||
+ mUtil.getLocalIpAddress()
|
+ mUtil.getLocalIpAddress()
|
||||||
@@ -230,22 +230,22 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
// LogManagerActivity.class);
|
// LogManagerActivity.class);
|
||||||
//this.startActivity(prefsIntent);
|
//this.startActivity(prefsIntent);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Log.v(TAG, "exception starting log manager activity " + ex.toString());
|
Log.i(TAG, "exception starting log manager activity " + ex.toString());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_settings:
|
case R.id.action_settings:
|
||||||
Log.v(TAG, "action_settings");
|
Log.i(TAG, "action_settings");
|
||||||
try {
|
try {
|
||||||
Intent prefsIntent = new Intent(
|
Intent prefsIntent = new Intent(
|
||||||
MainActivity.this,
|
MainActivity.this,
|
||||||
PrefActivity.class);
|
PrefActivity.class);
|
||||||
this.startActivity(prefsIntent);
|
this.startActivity(prefsIntent);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Log.v(TAG, "exception starting settings activity " + ex.toString());
|
Log.i(TAG, "exception starting settings activity " + ex.toString());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_about:
|
case R.id.action_about:
|
||||||
Log.v(TAG, "action_about");
|
Log.i(TAG, "action_about");
|
||||||
showAbout();
|
showAbout();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -257,7 +257,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
Log.v(TAG,"onCStart()");
|
Log.i(TAG,"onStart()");
|
||||||
mUtil.writeToSysLogFile("MainActivity.onStart()");
|
mUtil.writeToSysLogFile("MainActivity.onStart()");
|
||||||
SharedPreferences SP = PreferenceManager
|
SharedPreferences SP = PreferenceManager
|
||||||
.getDefaultSharedPreferences(getBaseContext());
|
.getDefaultSharedPreferences(getBaseContext());
|
||||||
@@ -288,7 +288,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
super.onStop();
|
super.onStop();
|
||||||
Log.v(TAG,"onStop() - unbinding from server");
|
Log.i(TAG,"onStop() - unbinding from server");
|
||||||
mUtil.writeToSysLogFile("MainActivity.onStop()");
|
mUtil.writeToSysLogFile("MainActivity.onStop()");
|
||||||
mUtil.unbindFromServer(this, mConnection);
|
mUtil.unbindFromServer(this, mConnection);
|
||||||
mUiTimer.cancel();
|
mUiTimer.cancel();
|
||||||
@@ -297,7 +297,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private void startServer() {
|
private void startServer() {
|
||||||
mUtil.writeToSysLogFile("MainActivity.startServer()");
|
mUtil.writeToSysLogFile("MainActivity.startServer()");
|
||||||
Log.v(TAG, "startServer(): starting Server...");
|
Log.i(TAG, "startServer(): starting Server...");
|
||||||
mUtil.startServer();
|
mUtil.startServer();
|
||||||
// Change the action bar icon to show the option to stop the service.
|
// Change the action bar icon to show the option to stop the service.
|
||||||
if (mOptionsMenu != null) {
|
if (mOptionsMenu != null) {
|
||||||
@@ -312,7 +312,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private void stopServer() {
|
private void stopServer() {
|
||||||
mUtil.writeToSysLogFile("MainActivity.stopServer()");
|
mUtil.writeToSysLogFile("MainActivity.stopServer()");
|
||||||
Log.v(TAG, "stopServer(): stopping Server...");
|
Log.i(TAG, "stopServer(): stopping Server...");
|
||||||
mUtil.stopServer();
|
mUtil.stopServer();
|
||||||
// Change the action bar icon to show the option to start the service.
|
// Change the action bar icon to show the option to start the service.
|
||||||
if (mOptionsMenu != null) {
|
if (mOptionsMenu != null) {
|
||||||
@@ -511,7 +511,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.v(TAG, "ServerStatusRunnable: Exception - ");
|
Log.e(TAG, "ServerStatusRunnable: Exception - ");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -577,7 +577,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
barDataSet.setColors(barColours);
|
barDataSet.setColors(barColours);
|
||||||
} catch (NullPointerException e){
|
} catch (NullPointerException e){
|
||||||
Log.v(TAG,"Null pointer exception setting bar colours");
|
Log.e(TAG,"Null pointer exception setting bar colours");
|
||||||
}
|
}
|
||||||
barDataSet.setBarSpacePercent(20f);
|
barDataSet.setBarSpacePercent(20f);
|
||||||
barDataSet.setBarShadowColor(Color.WHITE);
|
barDataSet.setBarShadowColor(Color.WHITE);
|
||||||
@@ -622,7 +622,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
try {
|
try {
|
||||||
mChart.getLegend().setEnabled(false);
|
mChart.getLegend().setEnabled(false);
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
Log.v(TAG,"Null Pointer Exception setting legend");
|
Log.e(TAG,"Null Pointer Exception setting legend");
|
||||||
}
|
}
|
||||||
|
|
||||||
mChart.invalidate();
|
mChart.invalidate();
|
||||||
@@ -633,14 +633,14 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
Log.v(TAG,"onPause()");
|
Log.i(TAG,"onPause()");
|
||||||
mUtil.writeToSysLogFile("MainActivity.onPause()");
|
mUtil.writeToSysLogFile("MainActivity.onPause()");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
Log.v(TAG,"onResume()");
|
Log.i(TAG,"onResume()");
|
||||||
mUtil.writeToSysLogFile("MainActivity.onResume()");
|
mUtil.writeToSysLogFile("MainActivity.onResume()");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -649,7 +649,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
mUtil.writeToSysLogFile("MainActivity.showAbout()");
|
mUtil.writeToSysLogFile("MainActivity.showAbout()");
|
||||||
View aboutView = getLayoutInflater().inflate(R.layout.about_layout, null, false);
|
View aboutView = getLayoutInflater().inflate(R.layout.about_layout, null, false);
|
||||||
String versionName = mUtil.getAppVersionName();
|
String versionName = mUtil.getAppVersionName();
|
||||||
Log.v(TAG, "showAbout() - version name = " + versionName);
|
Log.i(TAG, "showAbout() - version name = " + versionName);
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setIcon(R.drawable.icon_24x24);
|
builder.setIcon(R.drawable.icon_24x24);
|
||||||
builder.setTitle("OpenSeizureDetector V" + versionName);
|
builder.setTitle("OpenSeizureDetector V" + versionName);
|
||||||
@@ -661,7 +661,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
static class ResponseHandler extends Handler {
|
static class ResponseHandler extends Handler {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message message) {
|
public void handleMessage(Message message) {
|
||||||
Log.v(TAG, "Message=" + message.toString());
|
Log.i(TAG, "Message=" + message.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -357,8 +357,11 @@ public class OsdUtil {
|
|||||||
File file =
|
File file =
|
||||||
new File(Environment.getExternalStorageDirectory()
|
new File(Environment.getExternalStorageDirectory()
|
||||||
, "OpenSeizureDetector");
|
, "OpenSeizureDetector");
|
||||||
if (!file.mkdirs()) {
|
if (!file.isDirectory()) {
|
||||||
Log.e(TAG, "Directory not created");
|
Log.i(TAG,"getDataStorageDir() - creating directory");
|
||||||
|
if (!file.mkdirs()) {
|
||||||
|
Log.e(TAG, "Failed to create directory");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user