From 4d3dd96e268ccaaf46438915d9ccad9f3e1d5340 Mon Sep 17 00:00:00 2001 From: Ricky Barrette Date: Mon, 18 Jun 2012 11:34:19 -0400 Subject: [PATCH] Removed dev settings Closes #111 Signed-off-by: Ricky Barrette --- LocationRinger/AndroidManifest.xml | 4 +-- LocationRinger/res/xml/setings.xml | 26 -------------- .../android/LocationRinger/debug/Debug.java | 35 ++++++++++++++----- .../receivers/GetLocationWidget.java | 2 +- .../receivers/LocationChangedReceiver.java | 4 +-- .../receivers/SystemReceiver.java | 2 +- .../services/LocationService.java | 2 +- .../services/RingerProcessingService.java | 10 +----- .../ui/CheckLocationShortcut.java | 2 +- .../LocationRinger/ui/ListActivity.java | 2 +- .../LocationRinger/ui/SettingsActivity.java | 4 --- 11 files changed, 35 insertions(+), 58 deletions(-) diff --git a/LocationRinger/AndroidManifest.xml b/LocationRinger/AndroidManifest.xml index 9169254..edd9d3f 100644 --- a/LocationRinger/AndroidManifest.xml +++ b/LocationRinger/AndroidManifest.xml @@ -2,8 +2,8 @@ + android:versionCode="29" + android:versionName="b71dc8a" > diff --git a/LocationRinger/res/xml/setings.xml b/LocationRinger/res/xml/setings.xml index 7481959..278e19a 100644 --- a/LocationRinger/res/xml/setings.xml +++ b/LocationRinger/res/xml/setings.xml @@ -1,32 +1,6 @@ - - - - - - - - = android.os.Build.VERSION_CODES.FROYO; - - SUPPORTS_GINGERBREAD = android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD; - - SUPPORTS_HONEYCOMB = android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB; - - SHARED_PREFS_MODE = SUPPORTS_HONEYCOMB ? Context.MODE_MULTI_PROCESS : Context.MODE_PRIVATE; - } /** * Sets the logging output of this application @@ -50,4 +42,29 @@ public class Debug { * Max radius that can be set by a ringer */ public static final int MAX_RADIUS_IN_METERS = 600; + + /** + * the update interval in ms + */ + public static final long UPDATE_INTERVAL = AlarmManager.INTERVAL_FIFTEEN_MINUTES; + + /** + * minum accracy required to report in meters + */ + public static final int ACCURACY = 100; + + /** + * all lolcations with an accuracy greater then this will be ignored. in meters + */ + public static final int IGNORE = 500; + + static{ + SUPPORTS_FROYO = android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.FROYO; + + SUPPORTS_GINGERBREAD = android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD; + + SUPPORTS_HONEYCOMB = android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB; + + SHARED_PREFS_MODE = SUPPORTS_HONEYCOMB ? Context.MODE_MULTI_PROCESS : Context.MODE_PRIVATE; + } } \ No newline at end of file diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/GetLocationWidget.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/GetLocationWidget.java index 9d35b31..ca400d1 100644 --- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/GetLocationWidget.java +++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/GetLocationWidget.java @@ -51,7 +51,7 @@ public class GetLocationWidget extends AppWidgetProvider { int appWidgetId = appWidgetIds[i]; Intent intent = new Intent(context, LocationService.class) - .putExtra(LocationService.INTENT_EXTRA_REQUIRED_ACCURACY, Integer.parseInt(context.getSharedPreferences(SettingsActivity.SETTINGS, Debug.SHARED_PREFS_MODE).getString(SettingsActivity.ACCURACY , "50"))) + .putExtra(LocationService.INTENT_EXTRA_REQUIRED_ACCURACY, Debug.ACCURACY) .setAction(LocationLibraryConstants.INTENT_ACTION_UPDATE); //create a pending intent to start the post activity diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/LocationChangedReceiver.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/LocationChangedReceiver.java index be9cae1..118f3dc 100644 --- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/LocationChangedReceiver.java +++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/LocationChangedReceiver.java @@ -6,14 +6,12 @@ */ package com.TwentyCodes.android.LocationRinger.receivers; -import android.content.Context; import android.content.Intent; import android.location.Location; import android.util.Log; import com.TwentyCodes.android.LocationRinger.debug.Debug; import com.TwentyCodes.android.LocationRinger.services.RingerProcessingService; -import com.TwentyCodes.android.LocationRinger.ui.SettingsActivity; import com.TwentyCodes.android.debug.LocationLibraryConstants; import com.TwentyCodes.android.location.BaseLocationReceiver; @@ -28,7 +26,7 @@ public class LocationChangedReceiver extends BaseLocationReceiver { @Override public void onLocationUpdate(Location location) { if(location != null) - if(location.getAccuracy()<= Integer.parseInt(mContext.getSharedPreferences(SettingsActivity.SETTINGS, Context.MODE_PRIVATE).getString(SettingsActivity.IGNORE_LOCATION, "1000"))) + if(location.getAccuracy()<= Debug.IGNORE) mContext.startService(new Intent(mContext, RingerProcessingService.class).putExtra(LocationLibraryConstants.INTENT_EXTRA_LOCATION_CHANGED, location)); else if(Debug.DEBUG) diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/SystemReceiver.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/SystemReceiver.java index ce8d090..9cd951b 100644 --- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/SystemReceiver.java +++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/SystemReceiver.java @@ -45,7 +45,7 @@ public class SystemReceiver extends BroadcastReceiver { final SharedPreferences systemEventHistory = context.getSharedPreferences(TAG, Debug.SHARED_PREFS_MODE); Intent i = new Intent(context, LocationService.class) // .putExtra(LocationService.INTENT_EXTRA_PERIOD_BETWEEN_UPDATES, (long) (60000 * Integer.parseInt(context.getSharedPreferences(SettingsActivity.SETTINGS, 2).getString(SettingsActivity.UPDATE_INTVERVAL , "10")))) - .putExtra(LocationService.INTENT_EXTRA_REQUIRED_ACCURACY, Integer.parseInt(context.getSharedPreferences(SettingsActivity.SETTINGS, 2).getString(SettingsActivity.ACCURACY , "50"))) + .putExtra(LocationService.INTENT_EXTRA_REQUIRED_ACCURACY, Debug.ACCURACY) .setAction(LocationLibraryConstants.INTENT_ACTION_UPDATE); /* diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/LocationService.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/LocationService.java index 733db0f..b80d0a5 100644 --- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/LocationService.java +++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/LocationService.java @@ -36,7 +36,7 @@ public class LocationService extends SkyHookService { */ @Override public int onStartCommand(Intent intent, int flags, int startId) { - this.mPeriod = (long) (60000 * Integer.parseInt(this.mSettings.getString(SettingsActivity.UPDATE_INTVERVAL , "10"))); + this.mPeriod = Debug.UPDATE_INTERVAL; return super.onStartCommand(intent, flags, startId); } diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/RingerProcessingService.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/RingerProcessingService.java index 3200613..0efdfc1 100644 --- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/RingerProcessingService.java +++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/RingerProcessingService.java @@ -27,7 +27,6 @@ import android.os.IBinder; import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.util.Log; -import android.widget.Toast; import com.TwentyCodes.android.LocationRinger.db.RingerDatabase; import com.TwentyCodes.android.LocationRinger.debug.Debug; @@ -69,13 +68,6 @@ public class RingerProcessingService extends Service { this.sendBroadcast(new Intent(this, GetLocationWidget.class).setAction(GetLocationWidget.ACTION_UPDATE)); - /* - * Make it toasty if the user wants to be notified. - * This will display a toast msg "Applying " - */ - if(this.getSharedPreferences(SettingsActivity.SETTINGS, Debug.SHARED_PREFS_MODE).getBoolean(SettingsActivity.TOASTY, false)) - Toast.makeText(this.getApplicationContext(), "Applying "+ name, Toast.LENGTH_SHORT).show(); - /* * ringtone & volume */ @@ -134,7 +126,7 @@ public class RingerProcessingService extends Service { if(values.containsKey(RingerDatabase.KEY_UPDATE_INTERVAL)) if (values.get(RingerDatabase.KEY_UPDATE_INTERVAL) != null){ Intent i = new Intent(this, LocationService.class) - .putExtra(LocationService.INTENT_EXTRA_REQUIRED_ACCURACY, Integer.parseInt(this.getSharedPreferences(SettingsActivity.SETTINGS, 2).getString(SettingsActivity.ACCURACY , "50"))) + .putExtra(LocationService.INTENT_EXTRA_REQUIRED_ACCURACY, Debug.ACCURACY) .setAction(LocationLibraryConstants.INTENT_ACTION_UPDATE); PendingIntent pi = PendingIntent.getService(this, LocationService.REQUEST_CODE, i, 0); diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/CheckLocationShortcut.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/CheckLocationShortcut.java index 47df4c4..0f04ae6 100644 --- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/CheckLocationShortcut.java +++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/CheckLocationShortcut.java @@ -78,7 +78,7 @@ public class CheckLocationShortcut extends Activity { * start the location service in single shot mode */ Intent service = new Intent(this, LocationService.class) - .putExtra(LocationService.INTENT_EXTRA_REQUIRED_ACCURACY, Integer.parseInt(this.getSharedPreferences(SettingsActivity.SETTINGS, Debug.SHARED_PREFS_MODE).getString(SettingsActivity.ACCURACY , "50"))) + .putExtra(LocationService.INTENT_EXTRA_REQUIRED_ACCURACY, Debug.ACCURACY) .setAction(LocationLibraryConstants.INTENT_ACTION_UPDATE); this.startService(service); diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/ListActivity.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/ListActivity.java index c251332..82cc35a 100644 --- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/ListActivity.java +++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/ListActivity.java @@ -390,7 +390,7 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli LocationService.stopService(this).run(); //start the new service Intent i = new Intent(this, LocationService.class) - .putExtra(LocationService.INTENT_EXTRA_REQUIRED_ACCURACY, Integer.parseInt(sharedPrefs.getString(SettingsActivity.ACCURACY , "50"))) + .putExtra(LocationService.INTENT_EXTRA_REQUIRED_ACCURACY, Debug.ACCURACY) .setAction(LocationLibraryConstants.INTENT_ACTION_UPDATE); this.startService(i); } diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SettingsActivity.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SettingsActivity.java index cf8655c..308aecd 100644 --- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SettingsActivity.java +++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SettingsActivity.java @@ -36,10 +36,6 @@ import com.TwentyCodes.android.LocationRinger.debug.Debug; public class SettingsActivity extends PreferenceActivity implements OnPreferenceClickListener { public static final String SETTINGS = "settings"; - public static final String UPDATE_INTVERVAL = "update_interval"; - public static final String IGNORE_LOCATION = "ignore_location"; - public static final String ACCURACY = "accuracy"; - public static final String TOASTY = "toasty"; public static final String EMAIL = "email"; public static final String START_ON_BOOT = "start_on_boot"; public static final String IS_SERVICE_STARTED = "is_service_started";