Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: jwf/Humansense-Android-App
base: db151af2a3
...
head fork: jwf/Humansense-Android-App
compare: 4fa13828ba
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 11 files changed
  • 0 commit comments
  • 1 contributor
Commits on Mar 14, 2012
@jwf Set sensible defaults for logging data. 2cf7b6b
@jwf Fixed some bugs with starting the application on boot, and loading pl…
…ugins before the preference windows have ever been opened.
4fa1382
View
8 res/xml/preferences.xml
@@ -12,7 +12,7 @@
/>
<CheckBoxPreference
android:title="@string/auto_start_at_phone_boot_pref_title"
- android:defaultValue="false"
+ android:defaultValue="true"
android:key="autoStartAtPhoneBoot"
android:summary="@string/auto_start_at_phone_boot_pref"
/>
@@ -61,13 +61,13 @@
/>
<CheckBoxPreference
android:title="@string/notification_sounds_title"
- android:defaultValue="true"
+ android:defaultValue="false"
android:key="notificationSoundPref"
android:summary="@string/notification_sounds_summary"
/>
<CheckBoxPreference
android:title="@string/notification_vibrate_title"
- android:defaultValue="true"
+ android:defaultValue="false"
android:key="notificationVibratePref"
android:summary="@string/notification_vibrate_summary"
/>
@@ -78,12 +78,14 @@
<CheckBoxPreference
android:title="@string/uploader_auto_upload_title"
android:key="autoUploadData"
+ android:defaultValue="true"
android:summary="@string/uploader_auto_upload_desc"
/>
<CheckBoxPreference
android:title="@string/uploader_only_use_wifi_title"
android:key="uploadWifiOnly"
+ android:defaultValue="true"
android:summary="@string/uploader_only_use_wifi_desc"
/>
View
4 src/ca/mcgill/hs/HSAndroid.java
@@ -165,7 +165,6 @@ public void onCreate(final Bundle savedInstanceState) {
// Buttons
serviceSwitch = (Button) findViewById(R.id.button);
- serviceSwitch.setText(R.string.start_label);
serviceSwitch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
@@ -183,8 +182,9 @@ public void onClick(final View v) {
updateButton();
}
});
+ updateButton();
- if (autoStartAppStart) {
+ if (autoStartAppStart && !HSService.isRunning()) {
// Start the service on application start.
startService(serviceIntent);
}
View
16 src/ca/mcgill/hs/plugin/BluetoothLogger.java
@@ -43,8 +43,8 @@ public BluetoothDiscoveryListener() {
public void onReceive(final Context c, final Intent intent) {
c.unregisterReceiver(this);
if (names.size() > 0 && addresses.size() > 0) {
- write(new BluetoothPacket(System.currentTimeMillis(), names
- .size(), names, addresses));
+ write(new BluetoothPacket(System.currentTimeMillis(),
+ names.size(), names, addresses));
names.clear();
addresses.clear();
}
@@ -143,14 +143,14 @@ public String getInputPluginName() {
R.string.bluetoothlogger_enable_pref_label,
R.string.bluetoothlogger_enable_pref_summary,
R.string.bluetoothlogger_enable_pref_on,
- R.string.bluetoothlogger_enable_pref_off, false);
+ R.string.bluetoothlogger_enable_pref_off, true);
prefs[1] = PreferenceFactory.getCheckBoxPreference(activity,
FORCE_BLUETOOTH_ON_PREF,
R.string.bluetoothlogger_autoenable_pref_label,
R.string.bluetoothlogger_autoenable_pref_summary,
R.string.bluetoothlogger_autoenable_pref_on,
- R.string.bluetoothlogger_autoenable_pref_off, false);
+ R.string.bluetoothlogger_autoenable_pref_off, true);
prefs[2] = PreferenceFactory.getListPreference(activity,
R.array.bluetoothlogger_pref_interval_strings,
@@ -242,7 +242,7 @@ public BluetoothLogger(final Context context) {
prefs = PreferenceFactory.getSharedPreferences(context);
forceBluetoothActivation = prefs.getBoolean(FORCE_BLUETOOTH_ON_PREF,
- false);
+ true);
timeBetweenDiscoveries = Integer.parseInt(prefs.getString(
BLUETOOTH_LOGGER_TIME_INTERVAL_PREF,
@@ -306,7 +306,7 @@ private void onDeviceFound(final BluetoothDevice device) {
@Override
protected void onPluginStart() {
- pluginEnabled = prefs.getBoolean(BLUETOOTH_LOGGER_ENABLE_PREF, false);
+ pluginEnabled = prefs.getBoolean(BLUETOOTH_LOGGER_ENABLE_PREF, true);
if (!pluginEnabled) {
return;
}
@@ -379,10 +379,10 @@ public void onPreferenceChanged() {
BLUETOOTH_DEFAULT_SCAN_INTERVAL));
forceBluetoothActivation = prefs.getBoolean(FORCE_BLUETOOTH_ON_PREF,
- false);
+ true);
final boolean pluginEnabledNew = prefs.getBoolean(
- BLUETOOTH_LOGGER_ENABLE_PREF, false);
+ BLUETOOTH_LOGGER_ENABLE_PREF, true);
super.changePluginEnabledStatus(pluginEnabledNew);
}
}
View
13 src/ca/mcgill/hs/plugin/FileOutput.java
@@ -46,7 +46,7 @@
.toString(12 * 60 * 60 * 1000);
// in bytes = 4K
- private static final String BUFFER_SIZE_DEFAULT = "4096";
+ private static final String BUFFER_SIZE_DEFAULT = "8192";
private static final String PLUGIN_NAME = "FileOutput";
@@ -242,7 +242,7 @@ private static String getFileExtension(final DataPacket packet) {
R.string.fileoutput_enable_pref_label,
R.string.fileoutput_enable_pref_summary,
R.string.fileoutput_enable_pref_on,
- R.string.fileoutput_enable_pref_off, false);
+ R.string.fileoutput_enable_pref_off, true);
prefs[1] = PreferenceFactory.getListPreference(activity,
R.array.fileoutput_pref_buffer_size_strings,
R.array.fileoutput_pref_buffer_size_values,
@@ -260,7 +260,7 @@ private static String getFileExtension(final DataPacket packet) {
R.string.fileoutput_log_sensor_data_pref_label,
R.string.fileoutput_log_sensor_data_pref_summary,
R.string.fileoutput_log_sensor_data_pref_on,
- R.string.fileoutput_log_sensor_data_pref_off, true);
+ R.string.fileoutput_log_sensor_data_pref_off, false);
return prefs;
}
@@ -515,6 +515,9 @@ protected void onPluginStart() {
rolloverInterval = Integer.parseInt(prefs.getString(
ROLLOVER_INTERVAL_KEY, FILE_ROLLOVER_INTERVAL_DEFAULT));
logSensorData = prefs.getBoolean(FILE_OUTPUT_LOG_SENSOR_DATA, true);
+ if (pluginEnabled) {
+ Log.d(PLUGIN_NAME, "Plugin enabled.");
+ }
}
@Override
@@ -536,13 +539,13 @@ protected void onPluginStop() {
@Override
public void onPreferenceChanged() {
final boolean pluginEnabledNew = prefs.getBoolean(
- FILE_OUTPUT_ENABLED_PREF, false);
+ FILE_OUTPUT_ENABLED_PREF, true);
rolloverInterval = Integer.parseInt(prefs.getString(
ROLLOVER_INTERVAL_KEY, FILE_ROLLOVER_INTERVAL_DEFAULT));
rolloverTimestamp = initialTimestamp + rolloverInterval;
bufferSize = Integer.parseInt(prefs.getString(BUFFER_SIZE_KEY,
BUFFER_SIZE_DEFAULT));
- logSensorData = prefs.getBoolean(FILE_OUTPUT_LOG_SENSOR_DATA, true);
+ logSensorData = prefs.getBoolean(FILE_OUTPUT_LOG_SENSOR_DATA, false);
super.changePluginEnabledStatus(pluginEnabledNew);
}
View
26 src/ca/mcgill/hs/plugin/GPSLogger.java
@@ -136,7 +136,7 @@ public String getInputPluginName() {
private static final String GPS_LOGGER_INTERVAL_PREF = "gpsLoggerIntervalPreference";
private static final String GPS_LOGGER_INTERVAL_DEFAULT = "30000";
private static final String GPS_LOGGER_TIMEOUT_PREF = "gpsLoggerTimeoutPreference";
- private static final String GPS_LOGGER_TIMEOUT_DEFAULT = "-1";
+ private static final String GPS_LOGGER_TIMEOUT_DEFAULT = "10000";
private static Handler gpsTimeoutHandler = new Handler();
@@ -157,7 +157,7 @@ public String getInputPluginName() {
private static boolean listeningForLocationUpdates = false;
- private static int gpsTimeoutInMillis = -1;
+ private static int gpsTimeoutInMillis = 10000;
/**
* Used to check if a request has timed out and act appropriately.
@@ -181,9 +181,8 @@ public void run() {
}
if (!remotelyDisabled) {
// Start up again in minUpdateFrequency milliseconds.
- Log
- .d(PLUGIN_NAME,
- "GPS Has timed out, disabling and sleeping for a bit.");
+ Log.d(PLUGIN_NAME,
+ "GPS Has timed out, disabling and sleeping for a bit.");
gpsTimeoutHandler.postDelayed(restartGPSUpdates,
minUpdateFrequency);
}
@@ -238,7 +237,7 @@ public void run() {
GPS_LOGGER_ENABLE_PREF, R.string.gpslogger_enable_pref_label,
R.string.gpslogger_enable_pref_summary,
R.string.gpslogger_enable_pref_on,
- R.string.gpslogger_enable_pref_off, false);
+ R.string.gpslogger_enable_pref_off, true);
prefs[1] = PreferenceFactory.getListPreference(activity,
R.array.bluetoothlogger_pref_interval_strings,
@@ -295,9 +294,8 @@ public GPSLogger(final Context context) {
* has completed.
*/
public void disableAfterNextScan() {
- Log
- .d(PLUGIN_NAME,
- "We have been asked to stop scanning after the next scan completes.");
+ Log.d(PLUGIN_NAME,
+ "We have been asked to stop scanning after the next scan completes.");
pendingRemoteDisable = true;
}
@@ -336,14 +334,14 @@ protected void logLocation(final Location location) {
}
}
write(new GPSPacket(location.getTime(), location.getAccuracy(),
- location.getBearing(), location.getSpeed(), location
- .getAltitude(), location.getLatitude(), location
- .getLongitude()));
+ location.getBearing(), location.getSpeed(),
+ location.getAltitude(), location.getLatitude(),
+ location.getLongitude()));
}
@Override
protected void onPluginStart() {
- pluginEnabled = prefs.getBoolean(GPS_LOGGER_ENABLE_PREF, false);
+ pluginEnabled = prefs.getBoolean(GPS_LOGGER_ENABLE_PREF, true);
minUpdateDistance = Integer.parseInt(prefs.getString(
GPS_LOGGER_DISTANCE_PREF, GPS_LOGGER_DISTANCE_DEFAULT));
minUpdateFrequency = Integer.parseInt(prefs.getString(
@@ -367,7 +365,7 @@ protected void onPluginStop() {
@Override
public void onPreferenceChanged() {
final boolean pluginEnabledNew = prefs.getBoolean(
- GPS_LOGGER_ENABLE_PREF, false);
+ GPS_LOGGER_ENABLE_PREF, true);
if (pluginEnabled && pluginEnabledNew) {
stopListeningForLocationUpdates();
minUpdateDistance = Integer.parseInt(prefs.getString(
View
11 src/ca/mcgill/hs/plugin/GSMLogger.java
@@ -98,7 +98,7 @@ public String getInputPluginName() {
GSM_LOGGER_ENABLE_PREF, R.string.gsmlogger_enable_pref_label,
R.string.gsmlogger_enable_pref_summary,
R.string.gsmlogger_enable_pref_on,
- R.string.gsmlogger_enable_pref_off, false);
+ R.string.gsmlogger_enable_pref_off, true);
return prefs;
}
@@ -134,7 +134,7 @@ public GSMLogger(final Context context) {
@Override
protected void onPluginStart() {
- pluginEnabled = prefs.getBoolean(GSM_LOGGER_ENABLE_PREF, false);
+ pluginEnabled = prefs.getBoolean(GSM_LOGGER_ENABLE_PREF, true);
if (!pluginEnabled) {
return;
}
@@ -238,9 +238,8 @@ public void onSignalStrengthsChanged(
| PhoneStateListener.LISTEN_CELL_LOCATION
| PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
} else {
- Log
- .i(PLUGIN_NAME,
- "GSM Location Logging Unavailable! Wrong phone type or SIM card not present!");
+ Log.i(PLUGIN_NAME,
+ "GSM Location Logging Unavailable! Wrong phone type or SIM card not present!");
}
}
@@ -258,7 +257,7 @@ protected void onPluginStop() {
@Override
public void onPreferenceChanged() {
final boolean pluginEnabledNew = prefs.getBoolean(
- GSM_LOGGER_ENABLE_PREF, false);
+ GSM_LOGGER_ENABLE_PREF, true);
super.changePluginEnabledStatus(pluginEnabledNew);
}
View
32 src/ca/mcgill/hs/plugin/SensorLogger.java
@@ -199,13 +199,14 @@ protected void onPluginStart() {
// TODO: Should check to see if the sensors actually exist.
Log.i(PLUGIN_NAME, "Registered Sensor Listener");
- sensorManager.registerListener(this, sensorManager
- .getDefaultSensor(Sensor.TYPE_ACCELEROMETER), loggingSpeed);
- sensorManager.registerListener(this, sensorManager
- .getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD),
+ sensorManager.registerListener(this,
+ sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
+ loggingSpeed);
+ sensorManager.registerListener(this,
+ sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD),
SensorManager.SENSOR_DELAY_UI);
- sensorManager.registerListener(this, sensorManager
- .getDefaultSensor(Sensor.TYPE_TEMPERATURE),
+ sensorManager.registerListener(this,
+ sensorManager.getDefaultSensor(Sensor.TYPE_TEMPERATURE),
SensorManager.SENSOR_DELAY_UI);
logging = true;
}
@@ -216,12 +217,12 @@ protected void onPluginStop() {
return;
}
Log.i(PLUGIN_NAME, "Unregistered Sensor Listener.");
- sensorManager.unregisterListener(this, sensorManager
- .getDefaultSensor(Sensor.TYPE_ACCELEROMETER));
- sensorManager.unregisterListener(this, sensorManager
- .getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD));
- sensorManager.unregisterListener(this, sensorManager
- .getDefaultSensor(Sensor.TYPE_TEMPERATURE));
+ sensorManager.unregisterListener(this,
+ sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER));
+ sensorManager.unregisterListener(this,
+ sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD));
+ sensorManager.unregisterListener(this,
+ sensorManager.getDefaultSensor(Sensor.TYPE_TEMPERATURE));
logging = false;
}
@@ -234,7 +235,7 @@ public void onPreferenceChanged() {
changed = true;
}
final boolean newCalculateOrientation = prefs.getBoolean(
- SENSOR_LOGGER_CALCULATE_ORIENTATION, false);
+ SENSOR_LOGGER_CALCULATE_ORIENTATION, true);
if (!newCalculateOrientation) {
orientation[0] = 0.0f;
orientation[1] = 0.0f;
@@ -260,6 +261,7 @@ public void onPreferenceChanged() {
* @param event
* the SensorEvent detailing the change in sensor data.
*/
+ @Override
public void onSensorChanged(final SensorEvent event) {
if (logging) {
final Sensor sensor = event.sensor;
@@ -304,8 +306,8 @@ public void onSensorChanged(final SensorEvent event) {
private void printSensorSummary(final Sensor s) {
if (s != null) {
- Log.i(PLUGIN_NAME, " Sensor: " + s.getVendor() + " "
- + s.getName());
+ Log.i(PLUGIN_NAME,
+ " Sensor: " + s.getVendor() + " " + s.getName());
Log.i(PLUGIN_NAME, " Max Range : " + s.getMaximumRange());
// Requires API Level 9
// Log.i(PLUGIN_NAME, " Min Delay : " + s.getMinDelay());
View
12 src/ca/mcgill/hs/plugin/WifiLogger.java
@@ -160,7 +160,7 @@ public String getInputPluginName() {
WIFI_LOGGER_ENABLE_PREF, R.string.wifilogger_enable_pref_label,
R.string.wifilogger_enable_pref_summary,
R.string.wifilogger_enable_pref_on,
- R.string.wifilogger_enable_pref_off, false);
+ R.string.wifilogger_enable_pref_off, true);
prefs[1] = PreferenceFactory.getListPreference(activity,
R.array.wifilogger_pref_interval_strings,
@@ -264,9 +264,8 @@ public void run() {
* necessary.
*/
if (!wifiManager.pingSupplicant()) {
- Log
- .d(PLUGIN_NAME,
- "Uh-Oh, Supplicant isn't responding to requests.");
+ Log.d(PLUGIN_NAME,
+ "Uh-Oh, Supplicant isn't responding to requests.");
}
wifiManager.startScan();
// if (!scanning) {
@@ -285,9 +284,8 @@ public void run() {
Log.d(PLUGIN_NAME,
"Scanning loop complete, thread terminating.");
} catch (final InterruptedException e) {
- Log
- .e(PLUGIN_NAME,
- "Logging thread terminated due to InterruptedException.");
+ Log.e(PLUGIN_NAME,
+ "Logging thread terminated due to InterruptedException.");
}
}
}.start();
View
22 src/ca/mcgill/hs/prefs/DeleteUnUploadedFileManager.java
@@ -27,14 +27,14 @@
*/
public class DeleteUnUploadedFileManager extends FileManager {
/** Directory where unuploaded files live. */
- public static final File RECENT_FILES_DIRECTORY = new File(Environment
- .getExternalStorageDirectory(), HSAndroid
- .getAppString(R.string.recent_file_path));
+ public static final File RECENT_FILES_DIRECTORY = new File(
+ Environment.getExternalStorageDirectory(),
+ HSAndroid.getAppString(R.string.recent_file_path));
/** Directory where uploaded files should go. */
- public static final File UPLOADED_FILES_DIRECTORY = new File(Environment
- .getExternalStorageDirectory()
- + HSAndroid.getAppString(R.string.uploaded_file_path));
+ public static final File UPLOADED_FILES_DIRECTORY = new File(
+ Environment.getExternalStorageDirectory(),
+ HSAndroid.getAppString(R.string.uploaded_file_path));
@Override
protected CheckListEntry[] getCheckListEntries(final File path) {
@@ -72,8 +72,8 @@ public void onClick(final DialogInterface dialog, final int which) {
for (final String fname : filesToDelete) {
final File f = new File(fname);
if (f.exists()) {
- Log.d("HSFileManager", "Deleting file "
- + f.getName());
+ Log.d("HSFileManager",
+ "Deleting file " + f.getName());
f.delete();
}
}
@@ -115,8 +115,10 @@ public void onClick(final DialogInterface dialog, final int which) {
public void onClick(final View v) {
final String[] filesToDelete = checkList.getCheckedFiles();
if (filesToDelete.length == 0) {
- makeToast(getResources().getString(
- R.string.no_files_to_delete), Toast.LENGTH_SHORT);
+ makeToast(
+ getResources().getString(
+ R.string.no_files_to_delete),
+ Toast.LENGTH_SHORT);
return;
}
deletePrompt.show();
View
75 src/ca/mcgill/hs/prefs/HSAndroidPreferences.java
@@ -14,9 +14,9 @@
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
-import android.preference.PreferenceActivity;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.Preference.OnPreferenceClickListener;
+import android.preference.PreferenceActivity;
import android.widget.Toast;
import ca.mcgill.hs.R;
import ca.mcgill.hs.serv.LogFileUploaderService;
@@ -31,6 +31,8 @@
*/
public class HSAndroidPreferences extends PreferenceActivity {
+ private static final String TAG = "HSAndroidPreferences";
+
public static final String UPLOAD_OVER_WIFI_ONLY_PREF = "uploadWifiOnly";
public static final String AUTO_UPLOAD_DATA_PREF = "autoUploadData";
public static final String DELETE_UNUPLOADED_PREF = "deleteUnuploaded";
@@ -39,6 +41,7 @@
public static final String OUTPUT_PLUGIN_PREFS = "outputPluginPrefs";
public static final String INPUT_PLUGIN_PREFS = "inputPluginPrefs";
public static final String AUTO_START_AT_APP_START_PREF = "autoStartAtAppStart";
+ public static final String AUTO_START_AT_BOOT_PREF = "autoStartAtPhoneBoot";
public static final String WATCH_FOR_LOW_BATTERY_PREF = "watchForLowBatteryPref";
public static final String LOG_TO_FILE_PREF = "logToFilePref";
@@ -81,6 +84,7 @@ private int getFilesUnuploaded() {
* @return the number of uploaded files.
*/
private int getFilesUploaded() {
+ Log.d(TAG, path.toString());
if (path.isDirectory()) {
return path.listFiles().length;
} else {
@@ -111,8 +115,8 @@ private long getFilesUploadedBytes() {
*/
private void makeToast(final String message, final int duration) {
final Toast slice = Toast.makeText(getBaseContext(), message, duration);
- slice.setGravity(slice.getGravity(), slice.getXOffset(), slice
- .getYOffset() + 100);
+ slice.setGravity(slice.getGravity(), slice.getXOffset(),
+ slice.getYOffset() + 100);
slice.show();
}
@@ -196,9 +200,9 @@ public void onClick(final DialogInterface dialog, final int which) {
}
};
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setMessage(R.string.delete_files_warning).setPositiveButton(
- R.string.yes, dialogClickListener).setNegativeButton(
- R.string.no, dialogClickListener);
+ builder.setMessage(R.string.delete_files_warning)
+ .setPositiveButton(R.string.yes, dialogClickListener)
+ .setNegativeButton(R.string.no, dialogClickListener);
manualClearData
.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@@ -234,12 +238,13 @@ public void onClick(final DialogInterface dialog, final int which) {
for (final File f : recent.listFiles()) {
f.delete();
}
- makeToast(unuploadedFilesToDelete
- + " "
- + (unuploadedFilesToDelete == 1 ? getResources()
- .getString(R.string.file_deleted)
- : getResources().getString(
- R.string.files_deleted)),
+ makeToast(
+ unuploadedFilesToDelete
+ + " "
+ + (unuploadedFilesToDelete == 1 ? getResources()
+ .getString(R.string.file_deleted)
+ : getResources().getString(
+ R.string.files_deleted)),
Toast.LENGTH_SHORT);
unuploadedFilesToDelete = getFilesUnuploaded();
break;
@@ -272,16 +277,18 @@ public void onClick(final DialogInterface dialog, final int which) {
final AlertDialog.Builder unuploadedBuilder = new AlertDialog.Builder(
this);
- unuploadedBuilder.setMessage(
- getResources().getString(R.string.Delete)
- + " "
- + getFilesUnuploaded()
- + " "
- + getResources().getString(R.string.unuploaded)
- + " "
- + (getFilesUnuploaded() == 1 ? getResources()
- .getString(R.string.file) : getResources()
- .getString(R.string.files)) + "?")
+ unuploadedBuilder
+ .setMessage(
+ getResources().getString(R.string.Delete)
+ + " "
+ + getFilesUnuploaded()
+ + " "
+ + getResources().getString(R.string.unuploaded)
+ + " "
+ + (getFilesUnuploaded() == 1 ? getResources()
+ .getString(R.string.file)
+ : getResources().getString(
+ R.string.files)) + "?")
.setPositiveButton(R.string.yes, aggressiveClickListener)
.setNegativeButton(R.string.no, aggressiveClickListener);
@@ -294,8 +301,9 @@ public boolean onPreferenceClick(final Preference preference) {
if (unuploadedFilesToDelete > 0) {
unuploadedBuilder.show();
} else {
- makeToast(getResources().getString(
- R.string.no_files_to_delete),
+ makeToast(
+ getResources().getString(
+ R.string.no_files_to_delete),
Toast.LENGTH_SHORT);
}
return true;
@@ -322,15 +330,14 @@ public boolean onPreferenceChange(
});
final CheckBoxPreference wifiOnly = (CheckBoxPreference) findPreference(UPLOAD_OVER_WIFI_ONLY_PREF);
- wifiOnly
- .setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(
- final Preference preference, final Object newValue) {
- wifiOnly.setChecked((Boolean) newValue);
- broadcastWifiUploaderIntent(c);
- return false;
- }
- });
+ wifiOnly.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
+ @Override
+ public boolean onPreferenceChange(final Preference preference,
+ final Object newValue) {
+ wifiOnly.setChecked((Boolean) newValue);
+ broadcastWifiUploaderIntent(c);
+ return false;
+ }
+ });
}
}
View
8 src/ca/mcgill/hs/serv/HSServAutoStart.java
@@ -32,14 +32,16 @@ public void onReceive(final Context context, final Intent intent) {
final SharedPreferences prefs = PreferenceFactory
.getSharedPreferences(context);
- if (prefs.getBoolean(HSAndroidPreferences.AUTO_START_AT_APP_START_PREF,
- false)) {
+ if (prefs
+ .getBoolean(HSAndroidPreferences.AUTO_START_AT_BOOT_PREF, true)) {
// check if the received intent is BOOT_COMPLETED
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
+ context.startActivity(new Intent(context,
+ ca.mcgill.hs.HSAndroid.class)
+ .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
comp = new ComponentName(context.getPackageName(),
HSService.class.getName());
svc = context.startService(new Intent().setComponent(comp));
-
if (svc == null) {
Log.e("HSServAutoStart", "Could not start HSService "
+ comp.toString());

No commit comments for this range

Something went wrong with that request. Please try again.