Removed dev settings
Closes #111 Signed-off-by: Ricky Barrette <rickbarrette@gmail.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
package com.TwentyCodes.android.LocationRinger.debug;
|
||||
|
||||
import android.app.AlarmManager;
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
@@ -21,15 +22,6 @@ public class Debug {
|
||||
|
||||
public static final int SHARED_PREFS_MODE;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
/*
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 <ringer name>"
|
||||
*/
|
||||
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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user