Added Legal Activty, and made a lot of tweaks

Signed-off-by: Ricky Barrette <rickbarrette@gmail.com>
This commit is contained in:
2012-10-11 10:59:29 -04:00
parent 33b5da7bce
commit 2d85541638
29 changed files with 686 additions and 274 deletions

View File

@@ -0,0 +1,121 @@
/**
* Constraints.java
* @date Sep 13, 2012
* @author ricky barrette
*
* Copyright 2012 Richard Barrette
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
package com.TwentyCodes.android.LocationRinger;
import android.app.AlarmManager;
import android.content.Context;
/**
* This class will be used to house the constraints of this application
*
* @author ricky barrette
*/
public class Constraints {
/**
* Set this boolean to true to use the test server
*/
public static final boolean TESTING = true;
/**
* Set this boolean to true to enable debug logging
*/
public static final boolean DEBUG = true;
/**
* Set this boolean to true to enable error logging
*/
public static final boolean ERROR = true;
/**
* Set this boolean to true to enable info logging
*/
public static final boolean INFO = true;
/**
* Set this boolean to true to enable verbose logging
*/
public static final boolean VERBOSE = true;
/**
* Set this boolean to true to enable warning logging
*/
public static final boolean WARNING = true;
/**
* Set this boolean to true to enable wtf logging
*/
public static final boolean WTF = true;
/**
* Clears the database everytime it is initialized
*/
public static final boolean DROP_TABLES_EVERY_TIME = false;
public static final boolean SUPPORTS_GINGERBREAD;
public static final boolean SUPPORTS_HONEYCOMB;
public static final boolean SUPPORTS_FROYO;
public static final int SHARED_PREFS_MODE;
/**
* The amount of intersecting that is needed between a users accuracy radius
* and a ringers location radius
*/
public static final float FUDGE_FACTOR = .002f;
/**
* Drops the ringer database table every time the database is created
*/
public static boolean DROP_TABLE_EVERY_TIME = false;
/**
* 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;
}
}

View File

@@ -0,0 +1,41 @@
/**
* LegalActivity.java
* @date Sep 16, 2012
* @author ricky barrette
*
* Copyright 2012 Richard Barrette
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
package com.TwentyCodes.android.LocationRinger;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
/**
* This is a super simple web activity to display legal information to the user
*
* @author ricky barrette
*/
public class LegalActivity extends Activity {
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.leagal_activity);
final WebView wv = (WebView) findViewById(R.id.webview);
wv.loadUrl("file:///android_asset/legal.html");
}
}

View File

@@ -0,0 +1,178 @@
/**
* Log.java
* @date Sep 14, 2012
* @author ricky barrette
*
* Copyright 2012 Richard Barrette
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
package com.TwentyCodes.android.LocationRinger;
/**
* A convince class for logging with log level constraints
*
* @author ricky barrette
*/
public class Log {
/**
* Send a DEBUG log message
*
* @param tag
* @param log
* @author ricky barrette
*/
public static void d(final String tag, final String log) {
if (Constraints.DEBUG)
android.util.Log.d(tag, log);
}
/**
* Send a DEBUG log message and log the exception.
*
* @param tag
* @param log
* @param e
* @author ricky barrette
*/
public static void d(final String tag, final String log, final Throwable e) {
if (Constraints.DEBUG)
android.util.Log.d(tag, log, e);
}
/**
* Send a ERROR log message
*
* @param tag
* @param log
* @author ricky barrette
*/
public static void e(final String tag, final String log) {
if (Constraints.ERROR)
android.util.Log.e(tag, log);
}
/**
* Send a ERROR log message and log the exception.
*
* @param tag
* @param log
* @param e
* @author ricky barrette
*/
public static void e(final String tag, final String log, final Throwable e) {
if (Constraints.ERROR)
android.util.Log.e(tag, log, e);
}
/**
* Send a INFO log message
*
* @param tag
* @param log
* @author ricky barrette
*/
public static void i(final String tag, final String log) {
if (Constraints.INFO)
android.util.Log.i(tag, log);
}
/**
* Send a INFO log message and log the exception.
*
* @param tag
* @param log
* @param e
* @author ricky barrette
*/
public static void i(final String tag, final String log, final Throwable e) {
if (Constraints.INFO)
android.util.Log.i(tag, log, e);
}
/**
* Send a VERBOSE log message
*
* @param tag
* @param log
* @author ricky barrette
*/
public static void v(final String tag, final String log) {
if (Constraints.VERBOSE)
android.util.Log.v(tag, log);
}
/**
* Send a VERBOSE log message and log the exception.
*
* @param tag
* @param log
* @param e
* @author ricky barrette
*/
public static void v(final String tag, final String log, final Throwable e) {
if (Constraints.VERBOSE)
android.util.Log.v(tag, log, e);
}
/**
* Send a WARNING log message
*
* @param tag
* @param log
* @author ricky barrette
*/
public static void w(final String tag, final String log) {
if (Constraints.WARNING)
android.util.Log.w(tag, log);
}
/**
* Send a WARNING log message and log the exception.
*
* @param tag
* @param log
* @param e
* @author ricky barrette
*/
public static void w(final String tag, final String log, final Throwable e) {
if (Constraints.WARNING)
android.util.Log.w(tag, log, e);
}
/**
* Send a WTF log message
*
* @param tag
* @param log
* @author ricky barrette
*/
public static void wtf(final String tag, final String log) {
if (Constraints.WTF)
android.util.Log.wtf(tag, log);
}
/**
* Send a WTF log message and log the exception.
*
* @param tag
* @param log
* @param e
* @author ricky barrette
*/
public static void wtf(final String tag, final String log, final Throwable e) {
if (Constraints.WTF)
android.util.Log.wtf(tag, log, e);
}
}

View File

@@ -13,7 +13,7 @@ package com.TwentyCodes.android.LocationRinger.db;
* @author ricky barrette
*/
public interface DatabaseListener {
public void onDatabaseCreate();
public void onDatabaseUpgrade();
@@ -23,5 +23,5 @@ public interface DatabaseListener {
public void onRestoreComplete();
public void onRingerDeletionComplete();
}

View File

@@ -26,10 +26,10 @@ import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import com.TwentyCodes.android.LocationRinger.Constraints;
import com.TwentyCodes.android.LocationRinger.Log;
import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
/**
* This class will be the main interface between location ringer and it's
@@ -76,11 +76,9 @@ public class RingerDatabase {
if (cursor.moveToFirst())
do {
final ContentValues ringer = new ContentValues();
if (Debug.DEBUG)
Log.v(TAG, "Converting: " + cursor.getString(0));
Log.v(TAG, "Converting: " + cursor.getString(0));
for (int i = 0; i < count; i++) {
if (Debug.DEBUG)
Log.v(TAG, i + " = " + cursor.getColumnName(i) + " ~ " + cursor.getString(i));
Log.v(TAG, i + " = " + cursor.getColumnName(i) + " ~ " + cursor.getString(i));
switch (i) {
case 0: // ringer name
ringer.put(cursor.getColumnName(i), cursor.getString(0));
@@ -131,14 +129,14 @@ public class RingerDatabase {
*/
@Override
public void onCreate(final SQLiteDatabase db) {
if (Debug.DROP_TABLE_EVERY_TIME)
if (Constraints.DROP_TABLE_EVERY_TIME)
db.execSQL("DROP TABLE IF EXISTS " + RINGER_TABLE);
createDatabase(db);
// insert the default ringer into this table
db.execSQL("insert into " + RINGER_TABLE + "(" + KEY_RINGER_NAME + ") values ('" + mContext.getString(R.string.default_ringer) + "')");
db.execSQL("insert into " + RINGER_INFO_TABLE + "(" + KEY_RINGER_NAME + ", " + KEY + ", " + KEY_VALUE + ") values ('"
+ mContext.getString(R.string.default_ringer) + "', '" + KEY_RINGER_DESCRIPTION + "', '" + mContext.getString(R.string.about_default_ringer) + "')");
if(mListener != null)
if (mListener != null)
mListener.onDatabaseCreate();
}
@@ -183,8 +181,7 @@ public class RingerDatabase {
c.moveToFirst();
if (c.moveToFirst())
do {
if (Debug.DEBUG)
Log.d(TAG, "Moving: " + c.getInt(0) + " " + c.getString(1) + " " + c.getInt(2) + ", " + c.getInt(3) + " @ " + c.getInt(4) + "m");
Log.d(TAG, "Moving: " + c.getInt(0) + " " + c.getString(1) + " " + c.getInt(2) + ", " + c.getInt(3) + " @ " + c.getInt(4) + "m");
final ContentValues ringer = new ContentValues();
final ContentValues info = new ContentValues();
ringer.put(KEY_RINGER_NAME, c.getString(1));
@@ -260,7 +257,7 @@ public class RingerDatabase {
public final static String KEY_RINGTONE_IS_SILENT = "ringtone_is_silent";
@Deprecated
public final static String KEY_NOTIFICATION_IS_SILENT = "notification_is_silent";
public final static String KEY_IS_ENABLED = "is_enabled";
public final static String KEY_RADIUS = "radius";
public final static String KEY_RINGER_NAME = "ringer_name";
@@ -569,8 +566,7 @@ public class RingerDatabase {
public boolean isRingerEnabled(final long id) {
final Cursor cursor = mDb.query(RINGER_TABLE, new String[] { KEY_IS_ENABLED }, "id = " + id, null, null, null, null);
if (cursor.moveToFirst()) {
if (Debug.DEBUG)
Log.d(TAG, "isRingerEnabled(" + id + ") = " + cursor.getString(0));
Log.d(TAG, "isRingerEnabled(" + id + ") = " + cursor.getString(0));
return parseBoolean(cursor.getString(0));
}
return false;
@@ -608,8 +604,7 @@ public class RingerDatabase {
}
public int setRingerEnabled(final long id, final boolean enabled) {
if (Debug.DEBUG)
Log.d(TAG, "setRingerEnabled(" + id + ") = " + enabled);
Log.d(TAG, "setRingerEnabled(" + id + ") = " + enabled);
final ContentValues values = new ContentValues();
values.put(KEY_IS_ENABLED, enabled);
return mDb.update(RINGER_TABLE, values, "id" + "= " + id, null);

View File

@@ -1,73 +0,0 @@
/**
* Debug.java
* @date Apr 29, 2011
* @author Twenty Codes, LLC
* @author ricky barrette
*/
package com.TwentyCodes.android.LocationRinger.debug;
import android.app.AlarmManager;
import android.content.Context;
/**
* A convince class containing debugging variables
*
* @author ricky barrette
*/
public class Debug {
public static final boolean SUPPORTS_FROYO;
public static final boolean SUPPORTS_GINGERBREAD;
public static final boolean SUPPORTS_HONEYCOMB;
public static final int SHARED_PREFS_MODE;
/**
* Sets the logging output of this application
*/
public static final boolean DEBUG = true;
/**
* The amount of intersecting that is needed between a users accuracy radius
* and a ringers location radius
*/
public static final float FUDGE_FACTOR = .002f;
/**
* Drops the ringer database table every time the database is created
*/
public static boolean DROP_TABLE_EVERY_TIME = false;
/**
* 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;
}
}

View File

@@ -12,11 +12,11 @@ import android.appwidget.AppWidgetProvider;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.RemoteViews;
import com.TwentyCodes.android.LocationRinger.Constraints;
import com.TwentyCodes.android.LocationRinger.Log;
import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
import com.TwentyCodes.android.LocationRinger.services.LocationService;
import com.TwentyCodes.android.LocationRinger.ui.SettingsActivity;
@@ -45,8 +45,7 @@ public class GetLocationWidget extends AppWidgetProvider {
*/
@Override
public void onDeleted(final Context context, final int[] appWidgetIds) {
if (Debug.DEBUG)
Log.v(TAG, "onDelete()");
Log.v(TAG, "onDelete()");
super.onDeleted(context, appWidgetIds);
}
@@ -63,8 +62,7 @@ public class GetLocationWidget extends AppWidgetProvider {
*/
@Override
public void onReceive(final Context context, final Intent intent) {
if (Debug.DEBUG)
Log.v(TAG, "onReceive");
Log.v(TAG, "onReceive");
// v1.5 fix that doesn't call onDelete Action
final String action = intent.getAction();
@@ -96,8 +94,7 @@ public class GetLocationWidget extends AppWidgetProvider {
*/
@Override
public void onUpdate(final Context context, final AppWidgetManager appWidgetManager, final int[] appWidgetIds) {
if (Debug.DEBUG)
Log.v(TAG, "onUpdate()");
Log.v(TAG, "onUpdate()");
final int N = appWidgetIds.length;
// Perform this loop procedure for each App Widget that belongs to this
@@ -117,7 +114,7 @@ public class GetLocationWidget extends AppWidgetProvider {
views.setTextViewText(
R.id.widget_label,
context.getSharedPreferences(SettingsActivity.SETTINGS, Debug.SHARED_PREFS_MODE).getString(SettingsActivity.CURRENT,
context.getSharedPreferences(SettingsActivity.SETTINGS, Constraints.SHARED_PREFS_MODE).getString(SettingsActivity.CURRENT,
context.getString(R.string.default_ringer)));
// Tell the AppWidgetManager to perform an update on the current App

View File

@@ -8,9 +8,9 @@ package com.TwentyCodes.android.LocationRinger.receivers;
import android.content.Intent;
import android.location.Location;
import android.util.Log;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
import com.TwentyCodes.android.LocationRinger.Constraints;
import com.TwentyCodes.android.LocationRinger.Log;
import com.TwentyCodes.android.LocationRinger.services.RingerProcessingService;
import com.TwentyCodes.android.debug.LocationLibraryConstants;
import com.TwentyCodes.android.location.BaseLocationReceiver;
@@ -28,11 +28,9 @@ public class LocationChangedReceiver extends BaseLocationReceiver {
@Override
public void onLocationUpdate(final Location location) {
if (location != null)
if (location.getAccuracy() <= Debug.IGNORE)
if (location.getAccuracy() <= Constraints.IGNORE)
mContext.startService(new Intent(mContext, RingerProcessingService.class).putExtra(LocationLibraryConstants.INTENT_EXTRA_LOCATION_CHANGED, location));
else if (Debug.DEBUG)
Log.d(TAG, "location accuracy = " + location.getAccuracy() + " ignoring");
else if (Debug.DEBUG)
Log.d(TAG, "location was null");
Log.d(TAG, "location accuracy = " + location.getAccuracy() + " ignoring");
Log.d(TAG, "location was null");
}
}

View File

@@ -11,11 +11,10 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Handler;
import android.util.Log;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
import com.TwentyCodes.android.LocationRinger.Constraints;
import com.TwentyCodes.android.LocationRinger.Log;
import com.TwentyCodes.android.LocationRinger.services.LocationService;
import com.TwentyCodes.android.LocationRinger.ui.SettingsActivity;
import com.TwentyCodes.android.location.PassiveLocationListener;
/**
@@ -42,19 +41,20 @@ public class SystemReceiver extends BroadcastReceiver {
*/
@Override
public void onReceive(final Context context, final Intent intent) {
if (Debug.DEBUG)
Log.d(TAG, "onReceive() ~" + intent.getAction());
final SharedPreferences systemEventHistory = context.getSharedPreferences(TAG, Debug.SHARED_PREFS_MODE);
Log.d(TAG, "onReceive() ~" + intent.getAction());
final SharedPreferences systemEventHistory = context.getSharedPreferences(TAG, Constraints.SHARED_PREFS_MODE);
/*
* if the phone finishes booting, then start the service if the user
* enabled it
*/
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED))
if (context.getSharedPreferences(SettingsActivity.SETTINGS, Debug.SHARED_PREFS_MODE).getBoolean(SettingsActivity.START_ON_BOOT, false)) {
LocationService.startMultiShotService(context);
PassiveLocationListener.requestPassiveLocationUpdates(context, new Intent(context, PassiveLocationChangedReceiver.class));
}
// if (context.getSharedPreferences(SettingsActivity.SETTINGS,
// Constraints.SHARED_PREFS_MODE).getBoolean(SettingsActivity.START_ON_BOOT,
// false)) {
LocationService.startMultiShotService(context);
PassiveLocationListener.requestPassiveLocationUpdates(context, new Intent(context, PassiveLocationChangedReceiver.class));
// }
/*
* if the battery is reported to be low then stop the service, and

View File

@@ -14,8 +14,8 @@ import android.content.Intent;
import android.content.SharedPreferences;
import anroid.v4.compat.NotificationCompat;
import com.TwentyCodes.android.LocationRinger.Constraints;
import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
import com.TwentyCodes.android.LocationRinger.ui.ListActivity;
import com.TwentyCodes.android.LocationRinger.ui.SettingsActivity;
import com.TwentyCodes.android.debug.LocationLibraryConstants;
@@ -36,7 +36,7 @@ public class LocationService extends com.TwentyCodes.android.location.LocationSe
* @author ricky barrette
*/
public static Intent getSingleShotServiceIntent(final Context context) {
return new Intent(context, LocationService.class).putExtra(LocationLibraryConstants.INTENT_EXTRA_REQUIRED_ACCURACY, Debug.ACCURACY).setAction(
return new Intent(context, LocationService.class).putExtra(LocationLibraryConstants.INTENT_EXTRA_REQUIRED_ACCURACY, Constraints.ACCURACY).setAction(
LocationLibraryConstants.INTENT_ACTION_UPDATE);
}
@@ -48,7 +48,7 @@ public class LocationService extends com.TwentyCodes.android.location.LocationSe
* @author ricky barrette
*/
public static ComponentName startMultiShotService(final Context context) {
final Intent i = getSingleShotServiceIntent(context).putExtra(LocationLibraryConstants.INTENT_EXTRA_PERIOD_BETWEEN_UPDATES, Debug.UPDATE_INTERVAL);
final Intent i = getSingleShotServiceIntent(context).putExtra(LocationLibraryConstants.INTENT_EXTRA_PERIOD_BETWEEN_UPDATES, Constraints.UPDATE_INTERVAL);
return context.startService(i);
}
@@ -79,7 +79,7 @@ public class LocationService extends com.TwentyCodes.android.location.LocationSe
@Override
public void onCreate() {
Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(this));
mSettings = getSharedPreferences(SettingsActivity.SETTINGS, Debug.SHARED_PREFS_MODE);
mSettings = getSharedPreferences(SettingsActivity.SETTINGS, Constraints.SHARED_PREFS_MODE);
mSettings.edit().putBoolean(SettingsActivity.IS_SERVICE_STARTED, true).commit();
startOnGoingNotification();
super.onCreate();
@@ -110,7 +110,7 @@ public class LocationService extends com.TwentyCodes.android.location.LocationSe
*/
@Override
public int onStartCommand(final Intent intent, final int flags, final int startId) {
mPeriod = Debug.UPDATE_INTERVAL;
mPeriod = Constraints.UPDATE_INTERVAL;
return super.onStartCommand(intent, flags, startId);
}

View File

@@ -24,10 +24,10 @@ import android.os.IBinder;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.provider.Settings;
import android.util.Log;
import com.TwentyCodes.android.LocationRinger.Constraints;
import com.TwentyCodes.android.LocationRinger.Log;
import com.TwentyCodes.android.LocationRinger.db.RingerDatabase;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
import com.TwentyCodes.android.LocationRinger.receivers.GetLocationWidget;
import com.TwentyCodes.android.LocationRinger.ui.SettingsActivity;
import com.TwentyCodes.android.debug.LocationLibraryConstants;
@@ -59,12 +59,11 @@ public class RingerProcessingService extends Service {
* @author ricky barrette
*/
private void applyRinger(final ContentValues values) {
if (Debug.DEBUG)
Log.d(TAG, "applyRigner()");
Log.d(TAG, "applyRigner()");
final String name = values.getAsString(RingerDatabase.KEY_RINGER_NAME);
getSharedPreferences(SettingsActivity.SETTINGS, Debug.SHARED_PREFS_MODE).edit().putString(SettingsActivity.CURRENT, name).commit();
getSharedPreferences(SettingsActivity.SETTINGS, Constraints.SHARED_PREFS_MODE).edit().putString(SettingsActivity.CURRENT, name).commit();
this.sendBroadcast(new Intent(this, GetLocationWidget.class).setAction(GetLocationWidget.ACTION_UPDATE));
@@ -84,10 +83,8 @@ public class RingerProcessingService extends Service {
if (values.containsKey(RingerDatabase.KEY_NOTIFICATION_RINGTONE_VOLUME))
setStreamVolume(values.getAsInteger(RingerDatabase.KEY_NOTIFICATION_RINGTONE_VOLUME), AudioManager.STREAM_NOTIFICATION);
if (Debug.DEBUG) {
Log.d(TAG, "Music " + (mAudioManager.isMusicActive() ? "is playing " : "is not playing"));
Log.d(TAG, "Wired Headset " + (mAudioManager.isWiredHeadsetOn() ? "is on " : "is off"));
}
Log.d(TAG, "Music " + (mAudioManager.isMusicActive() ? "is playing " : "is not playing"));
Log.d(TAG, "Wired Headset " + (mAudioManager.isWiredHeadsetOn() ? "is on " : "is off"));
/*
* music volume we will set the music volume only if music is not
@@ -119,18 +116,17 @@ public class RingerProcessingService extends Service {
mBluetoothAdapter.enable();
else
mBluetoothAdapter.disable();
/*
* airplane mode
*/
if(values.containsKey(RingerDatabase.KEY_AIRPLANE_MODE)){
if (values.containsKey(RingerDatabase.KEY_AIRPLANE_MODE)) {
final boolean airplaneModeEnabled = !RingerDatabase.parseBoolean(values.getAsString(RingerDatabase.KEY_AIRPLANE_MODE));
// toggle airplane mode
Log.d(TAG, "airplane mode has be set "+ Settings.System.putInt(
this.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, airplaneModeEnabled ? 0 : 1));
Log.d(TAG, "airplane mode has be set " + Settings.System.putInt(getContentResolver(), Settings.System.AIRPLANE_MODE_ON, airplaneModeEnabled ? 0 : 1));
// Post an intent to reload
Intent changeMode = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
final Intent changeMode = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
changeMode.putExtra("state", !airplaneModeEnabled);
this.sendBroadcast(changeMode);
}
@@ -201,11 +197,10 @@ public class RingerProcessingService extends Service {
@Override
public void onCreate() {
Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(this));
if (Debug.DEBUG)
Log.d(TAG, "onCreate()");
Log.d(TAG, "onCreate()");
super.onCreate();
mDb = new RingerDatabase(this);
mSettings = getSharedPreferences(SettingsActivity.SETTINGS, Debug.SHARED_PREFS_MODE);
mSettings = getSharedPreferences(SettingsActivity.SETTINGS, Constraints.SHARED_PREFS_MODE);
final PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
@@ -233,8 +228,7 @@ public class RingerProcessingService extends Service {
*/
@Override
public int onStartCommand(final Intent intent, final int flags, final int startId) {
if (Debug.DEBUG)
Log.d(TAG, "onStartCommand: " + startId);
Log.d(TAG, "onStartCommand: " + startId);
mStartId = startId;
/*
@@ -246,17 +240,14 @@ public class RingerProcessingService extends Service {
e.printStackTrace();
}
if(intent == null)
if (intent == null)
stopSelf(startId);
else if (intent.getParcelableExtra(LocationLibraryConstants.INTENT_EXTRA_LOCATION_CHANGED) != null) {
mLocation = intent.getParcelableExtra(LocationLibraryConstants.INTENT_EXTRA_LOCATION_CHANGED);
processRingers();
} else {
Log.w(TAG, "Location was null");
stopSelf(startId);
else {
if (intent.getParcelableExtra(LocationLibraryConstants.INTENT_EXTRA_LOCATION_CHANGED) != null) {
mLocation = intent.getParcelableExtra(LocationLibraryConstants.INTENT_EXTRA_LOCATION_CHANGED);
processRingers();
} else {
if (Debug.DEBUG)
Log.d(TAG, "Location was null");
stopSelf(startId);
}
}
return super.onStartCommand(intent, flags, startId);
}
@@ -276,19 +267,16 @@ public class RingerProcessingService extends Service {
final ContentValues ringer = getRinger(1);
final GeoPoint point = new GeoPoint((int) (mLocation.getLatitude() * 1E6), (int) (mLocation.getLongitude() * 1E6));
if (Debug.DEBUG) {
Log.d(TAG, "Processing ringers");
Log.d(TAG,
"Current location " + (int) (mLocation.getLatitude() * 1E6) + ", " + (int) (mLocation.getLongitude() * 1E6) + " @ "
+ Float.valueOf(mLocation.getAccuracy()) / 1000 + "km");
}
Log.d(TAG, "Processing ringers");
Log.d(TAG,
"Current location " + (int) (mLocation.getLatitude() * 1E6) + ", " + (int) (mLocation.getLongitude() * 1E6) + " @ "
+ Float.valueOf(mLocation.getAccuracy()) / 1000 + "km");
final Cursor c = mDb.getAllRingers();
c.moveToFirst();
if (c.moveToFirst())
do {
if (Debug.DEBUG)
Log.d(TAG, "Checking ringer " + c.getString(0));
Log.d(TAG, "Checking ringer " + c.getString(0));
if (RingerDatabase.parseBoolean(c.getString(1))) {
final ContentValues info = mDb.getRingerInfo(c.getString(0));
@@ -296,7 +284,7 @@ public class RingerProcessingService extends Service {
final String[] pointInfo = info.getAsString(RingerDatabase.KEY_LOCATION).split(",");
if (GeoUtils.isIntersecting(point, Float.valueOf(mLocation.getAccuracy()) / 1000,
new GeoPoint(Integer.parseInt(pointInfo[0]), Integer.parseInt(pointInfo[1])),
Float.valueOf(info.getAsInteger(RingerDatabase.KEY_RADIUS)) / 1000, Debug.FUDGE_FACTOR)) {
Float.valueOf(info.getAsInteger(RingerDatabase.KEY_RADIUS)) / 1000, Constraints.FUDGE_FACTOR)) {
c.close();
getRinger(ringer, index);
isDeafult = false;
@@ -311,14 +299,12 @@ public class RingerProcessingService extends Service {
c.close();
if (Debug.DEBUG)
for (final Entry<String, Object> item : ringer.valueSet())
Log.d(TAG, item.getKey());
for (final Entry<String, Object> item : ringer.valueSet())
Log.d(TAG, item.getKey());
applyRinger(ringer);
if (Debug.DEBUG)
Log.d(TAG, "Finished processing ringers");
Log.d(TAG, "Finished processing ringers");
// store is default
mSettings.edit().putBoolean(SettingsActivity.IS_DEFAULT, isDeafult).commit();

View File

@@ -11,8 +11,8 @@ import android.content.Context;
import android.view.View;
import android.view.Window;
import com.TwentyCodes.android.LocationRinger.Constraints;
import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
/**
* This class will be used to display the first boot dialog
@@ -76,7 +76,7 @@ public class FirstBootDialog extends Dialog implements android.view.View.OnClick
*/
@Override
public void onClick(final View arg0) {
getContext().getSharedPreferences(SettingsActivity.SETTINGS, Debug.SHARED_PREFS_MODE).edit().putBoolean(SettingsActivity.IS_FIRST_BOOT, false).commit();
getContext().getSharedPreferences(SettingsActivity.SETTINGS, Constraints.SHARED_PREFS_MODE).edit().putBoolean(SettingsActivity.IS_FIRST_BOOT, false).commit();
dismiss();
}

View File

@@ -38,10 +38,10 @@ import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.Toast;
import com.TwentyCodes.android.LocationRinger.Constraints;
import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.db.DatabaseListener;
import com.TwentyCodes.android.LocationRinger.db.RingerDatabase;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
import com.TwentyCodes.android.LocationRinger.receivers.PassiveLocationChangedReceiver;
import com.TwentyCodes.android.LocationRinger.services.LocationService;
import com.TwentyCodes.android.location.PassiveLocationListener;
@@ -73,7 +73,7 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
@Override
public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
if(mProgress != null)
if (mProgress != null)
mProgress.dismiss();
if (resultCode == RESULT_OK) {
@@ -171,7 +171,7 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
mListView.setEmptyView(findViewById(android.R.id.empty));
findViewById(R.id.add_ringer_button).setOnClickListener(this);
populate();
mSettings = getSharedPreferences(SettingsActivity.SETTINGS, Debug.SHARED_PREFS_MODE);
mSettings = getSharedPreferences(SettingsActivity.SETTINGS, Constraints.SHARED_PREFS_MODE);
if (mSettings.getBoolean(SettingsActivity.IS_FIRST_BOOT, true))
new FirstBootDialog(this).show();
@@ -213,18 +213,18 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
}
/**
* Called when the database is first created.
* Here we want to populate the populate the default ringr
* Called when the database is first created. Here we want to populate the
* populate the default ringr
*/
@Override
public void onDatabaseCreate() {
final AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
final WifiManager wifi= (WifiManager) getSystemService(WIFI_SERVICE);
final BluetoothAdapter bt= BluetoothAdapter.getDefaultAdapter();
final WifiManager wifi = (WifiManager) getSystemService(WIFI_SERVICE);
final BluetoothAdapter bt = BluetoothAdapter.getDefaultAdapter();
final ContentValues ringer = new ContentValues();
final ContentValues info = new ContentValues();
ringer.put(RingerDatabase.KEY_RINGER_NAME, getString(R.string.default_ringer));
info.put(RingerDatabase.KEY_RINGER_DESCRIPTION, getString(R.string.about_default_ringer));
info.put(RingerDatabase.KEY_RINGER_DESCRIPTION, getString(R.string.about_default_ringer));
info.put(RingerDatabase.KEY_ALARM_VOLUME, am.getStreamVolume(AudioManager.STREAM_ALARM));
info.put(RingerDatabase.KEY_MUSIC_VOLUME, am.getStreamVolume(AudioManager.STREAM_MUSIC));
info.put(RingerDatabase.KEY_NOTIFICATION_RINGTONE_URI, RingtoneManager.getActualDefaultRingtoneUri(this, RingtoneManager.TYPE_NOTIFICATION).toString());
@@ -233,10 +233,11 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
info.put(RingerDatabase.KEY_RINGTONE_VOLUME, am.getStreamVolume(AudioManager.STREAM_RING));
info.put(RingerDatabase.KEY_BT, bt.isEnabled());
info.put(RingerDatabase.KEY_WIFI, wifi.isWifiEnabled());
info.put(RingerDatabase.KEY_AIRPLANE_MODE, Settings.System.getInt(this.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) != 0);
new Handler().post(new Runnable(){
public void run(){
info.put(RingerDatabase.KEY_AIRPLANE_MODE, Settings.System.getInt(getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) != 0);
new Handler().post(new Runnable() {
@Override
public void run() {
mDb.updateRinger(1, ringer, info);
}
});
@@ -408,7 +409,7 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
* @author ricky barrette
*/
private void restartService() {
final SharedPreferences sharedPrefs = getSharedPreferences(SettingsActivity.SETTINGS, Debug.SHARED_PREFS_MODE);
final SharedPreferences sharedPrefs = getSharedPreferences(SettingsActivity.SETTINGS, Constraints.SHARED_PREFS_MODE);
if (!sharedPrefs.getBoolean(SettingsActivity.IS_SERVICE_STARTED, false)) {
// cancel the previous service
com.TwentyCodes.android.location.LocationService.stopService(this).run();

View File

@@ -20,17 +20,17 @@ import android.os.Looper;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.inputmethod.InputMethodManager;
import com.TwentyCodes.android.LocationRinger.Constraints;
import com.TwentyCodes.android.LocationRinger.EnableScrollingListener;
import com.TwentyCodes.android.LocationRinger.Log;
import com.TwentyCodes.android.LocationRinger.OnContentChangedListener;
import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.db.RingerDatabase;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
import com.TwentyCodes.android.LocationRinger.ui.fragments.AboutRingerFragment;
import com.TwentyCodes.android.LocationRinger.ui.fragments.FeatureListFragment;
import com.TwentyCodes.android.LocationRinger.ui.fragments.LocationInfomationFragment;
@@ -81,7 +81,7 @@ public class RingerInformationActivity extends FragmentActivity implements OnCon
/*
* Set up the action bar if required
*/
if (Debug.SUPPORTS_HONEYCOMB)
if (Constraints.SUPPORTS_HONEYCOMB)
getActionBar().setDisplayHomeAsUpEnabled(true);
mData = new Intent().putExtras(intent);
@@ -157,10 +157,8 @@ public class RingerInformationActivity extends FragmentActivity implements OnCon
*/
@Override
public void onInfoContentChanged(final ContentValues values) {
if (Debug.DEBUG) {
Log.v(TAG, "onInfoContentChanged()");
logContentValues(values);
}
Log.v(TAG, "onInfoContentChanged()");
logContentValues(values);
mInfo.putAll(values);
}
@@ -225,10 +223,8 @@ public class RingerInformationActivity extends FragmentActivity implements OnCon
*/
@Override
public void onRingerContentChanged(final ContentValues values) {
if (Debug.DEBUG) {
Log.v(TAG, "onRingerContentChanged()");
logContentValues(values);
}
Log.v(TAG, "onRingerContentChanged()");
logContentValues(values);
mRinger.putAll(values);
}

View File

@@ -9,7 +9,6 @@ package com.TwentyCodes.android.LocationRinger.ui;
import java.util.List;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -19,9 +18,9 @@ import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.TextView;
import com.TwentyCodes.android.LocationRinger.Log;
import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.db.RingerDatabase;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
/**
* This adapter will be used to populate the list view with all the ringers
@@ -106,21 +105,19 @@ public class RingerListAdapter extends BaseAdapter {
// and the ImageView.
holder = (ViewHolder) convertView.getTag();
if (Debug.DEBUG) {
Log.d(TAG, "postion = " + position);
Log.d(TAG, "postion = " + position);
if (convertView == null)
Log.e(TAG, "convertview is null!!!");
if (convertView == null)
Log.e(TAG, "convertview is null!!!");
if (holder == null)
Log.e(TAG, "holder is null!!!");
if (holder == null)
Log.e(TAG, "holder is null!!!");
if (holder.title == null)
Log.e(TAG, "holder.text is null!!!");
if (holder.title == null)
Log.e(TAG, "holder.text is null!!!");
if (holder.checkbox == null)
Log.e(TAG, "holder.checkbox is null!!!");
}
if (holder.checkbox == null)
Log.e(TAG, "holder.checkbox is null!!!");
/*
* Bind the data efficiently with the holder. Remember that you should

View File

@@ -15,7 +15,6 @@ import org.json.JSONException;
import android.app.Dialog;
import android.content.Context;
import android.os.Handler;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager.LayoutParams;
@@ -29,8 +28,8 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
import com.TwentyCodes.android.LocationRinger.Log;
import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
import com.TwentyCodes.android.location.OnLocationSelectedListener;
import com.TwentyCodes.android.location.ReverseGeocoder;
import com.google.android.maps.GeoPoint;
@@ -81,8 +80,7 @@ public class SearchDialog extends Dialog implements android.view.View.OnClickLis
* @author ricky barrette
*/
private ArrayList<String> getAddress() {
if (Debug.DEBUG)
Log.d(TAG, "getAddress()");
Log.d(TAG, "getAddress()");
final ArrayList<String> list = new ArrayList<String>();
try {
for (int i = 0; i < mResults.length(); i++)
@@ -103,12 +101,10 @@ public class SearchDialog extends Dialog implements android.view.View.OnClickLis
* @author ricky barrette
*/
private GeoPoint getCoords(final int index) {
if (Debug.DEBUG)
Log.d(TAG, "getCoords()");
Log.d(TAG, "getCoords()");
try {
final JSONArray coords = mResults.getJSONObject(index).getJSONObject("Point").getJSONArray("coordinates");
if (Debug.DEBUG)
Log.d(TAG, "creating geopoint: " + new GeoPoint((int) (coords.getDouble(1) * 1E6), (int) (coords.getDouble(0) * 1E6)).toString());
Log.d(TAG, "creating geopoint: " + new GeoPoint((int) (coords.getDouble(1) * 1E6), (int) (coords.getDouble(0) * 1E6)).toString());
return new GeoPoint((int) (coords.getDouble(1) * 1E6), (int) (coords.getDouble(0) * 1E6));
} catch (final JSONException e) {
e.printStackTrace();
@@ -151,8 +147,7 @@ public class SearchDialog extends Dialog implements android.view.View.OnClickLis
*/
@Override
public void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id) {
if (Debug.DEBUG)
Log.d(TAG, "slected " + (int) id);
Log.d(TAG, "slected " + (int) id);
mListener.onLocationSelected(getCoords((int) id));
dismiss();
}
@@ -167,8 +162,7 @@ public class SearchDialog extends Dialog implements android.view.View.OnClickLis
new Thread(new Runnable() {
@Override
public void run() {
if (Debug.DEBUG)
Log.d(TAG, "strarting search and parsing");
Log.d(TAG, "strarting search and parsing");
try {
mResults = ReverseGeocoder.addressSearch(mAddress.getText().toString());
} catch (final IOException e) {
@@ -177,20 +171,17 @@ public class SearchDialog extends Dialog implements android.view.View.OnClickLis
e.printStackTrace();
}
if (mResults != null) {
if (Debug.DEBUG)
Log.d(TAG, "finished searching and parsing");
Log.d(TAG, "finished searching and parsing");
// update UI
mHandler.post(new Runnable() {
@Override
public void run() {
if (Debug.DEBUG)
Log.d(TAG, "populating list");
Log.d(TAG, "populating list");
mAddressList.setAdapter(new ArrayAdapter<String>(mContext, android.R.layout.simple_list_item_1, getAddress()));
v.setEnabled(true);
mProgress.setVisibility(View.INVISIBLE);
mProgress.setIndeterminate(false);
if (Debug.DEBUG)
Log.d(TAG, "finished");
Log.d(TAG, "finished");
}
});
} else
@@ -201,8 +192,7 @@ public class SearchDialog extends Dialog implements android.view.View.OnClickLis
v.setEnabled(true);
mProgress.setVisibility(View.INVISIBLE);
mProgress.setIndeterminate(false);
if (Debug.DEBUG)
Log.d(TAG, "failed");
Log.d(TAG, "failed");
}
});
}

View File

@@ -26,8 +26,9 @@ import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.view.MenuItem;
import com.TwentyCodes.android.LocationRinger.Constraints;
import com.TwentyCodes.android.LocationRinger.LegalActivity;
import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
/**
* This is the settings activity for location ringer
@@ -47,6 +48,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
public static final String RESTORE = "restore";
public static final String BACKUP = "backup";
public static final String CURRENT = "current";
private static final String LEGAL = "legal";
/**
* Backs up the database
@@ -123,7 +125,8 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
e.printStackTrace();
}
context.getSharedPreferences(SETTINGS, Debug.SHARED_PREFS_MODE).edit().remove(IS_FIRST_RINGER_PROCESSING).remove(IS_DEFAULT).remove(IS_SERVICE_STARTED).commit();
context.getSharedPreferences(SETTINGS, Constraints.SHARED_PREFS_MODE).edit().remove(IS_FIRST_RINGER_PROCESSING).remove(IS_DEFAULT).remove(IS_SERVICE_STARTED)
.commit();
}
/**
@@ -163,15 +166,16 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getPreferenceManager().setSharedPreferencesMode(Debug.SHARED_PREFS_MODE);
getPreferenceManager().setSharedPreferencesMode(Constraints.SHARED_PREFS_MODE);
getPreferenceManager().setSharedPreferencesName(SETTINGS);
addPreferencesFromResource(R.xml.setings);
findPreference(EMAIL).setOnPreferenceClickListener(this);
findPreference(LEGAL).setOnPreferenceClickListener(this);
/*
* Set up the action bar if required
*/
if (Debug.SUPPORTS_HONEYCOMB)
if (Constraints.SUPPORTS_HONEYCOMB)
getActionBar().setDisplayHomeAsUpEnabled(true);
}
@@ -197,7 +201,10 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
*/
@Override
public boolean onPreferenceClick(final Preference preference) {
this.startActivity(generateEmailIntent());
if (preference.getKey().equals(EMAIL))
this.startActivity(generateEmailIntent());
if (preference.getKey().equals(LEGAL))
this.startActivity(new Intent(this, LegalActivity.class));
return false;
}
}

View File

@@ -15,7 +15,6 @@ import android.graphics.Canvas;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -25,10 +24,10 @@ import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.ToggleButton;
import com.TwentyCodes.android.LocationRinger.Log;
import com.TwentyCodes.android.LocationRinger.OnContentChangedListener;
import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.db.RingerDatabase;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
/**
* This fragment will used to allow the user to enter/edit ringer information
@@ -156,13 +155,11 @@ public class AboutRingerFragment extends Fragment implements OnCheckedChangeList
final View view = inflater.inflate(R.layout.ringer_about_fragment, container, false);
if (Debug.DEBUG) {
for (final Entry<String, Object> item : mInfo.valueSet())
Log.d(TAG, item.getKey() + " = " + item.getValue());
for (final Entry<String, Object> item : mInfo.valueSet())
Log.d(TAG, item.getKey() + " = " + item.getValue());
for (final Entry<String, Object> item : mRinger.valueSet())
Log.d(TAG, item.getKey() + " = " + item.getValue());
}
for (final Entry<String, Object> item : mRinger.valueSet())
Log.d(TAG, item.getKey() + " = " + item.getValue());
/*
* ringer name

View File

@@ -13,12 +13,11 @@ import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
import com.TwentyCodes.android.LocationRinger.Log;
/**
* This fragment will be used to display a list of fragments
@@ -157,8 +156,7 @@ public abstract class BaseFragmentListFragment extends Fragment {
*/
@Override
public void onResume() {
if (Debug.DEBUG)
Log.v(TAG, "onResume()");
Log.v(TAG, "onResume()");
loadFragments();
super.onResume();
}

View File

@@ -117,9 +117,10 @@ public class FeatureListFragment extends BaseFragmentListFragment implements OnC
f = new ToggleButtonFragment(R.drawable.ic_action_wifi, this.getString(R.string.wifi), RingerDatabase.KEY_WIFI, mInfo, mListener, this, KEY_ADDED_WIFI);
mAdded.add(KEY_ADDED_WIFI);
break;
case KEY_ADDED_AIRPLANE_MODE:
f = new ToggleButtonFragment(R.drawable.ic_action_airplane, this.getString(R.string.airplane_mode), RingerDatabase.KEY_AIRPLANE_MODE, mInfo, mListener, this, KEY_ADDED_AIRPLANE_MODE);
f = new ToggleButtonFragment(R.drawable.ic_action_airplane, this.getString(R.string.airplane_mode), RingerDatabase.KEY_AIRPLANE_MODE, mInfo, mListener, this,
KEY_ADDED_AIRPLANE_MODE);
mAdded.add(KEY_ADDED_AIRPLANE_MODE);
break;
}
@@ -151,10 +152,10 @@ public class FeatureListFragment extends BaseFragmentListFragment implements OnC
if (mInfo.containsKey(RingerDatabase.KEY_WIFI))
what.add(initFeatureFragment(KEY_ADDED_WIFI));
if (mInfo.containsKey(RingerDatabase.KEY_AIRPLANE_MODE))
what.add(initFeatureFragment(KEY_ADDED_AIRPLANE_MODE));
return what;
}

View File

@@ -10,7 +10,6 @@ import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
@@ -23,12 +22,13 @@ import android.widget.TextView;
import android.widget.Toast;
import android.widget.ToggleButton;
import com.TwentyCodes.android.LocationRinger.Constraints;
import com.TwentyCodes.android.LocationRinger.EnableScrollingListener;
import com.TwentyCodes.android.LocationRinger.Log;
import com.TwentyCodes.android.LocationRinger.OnContentChangedListener;
import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.SearchRequestedListener;
import com.TwentyCodes.android.LocationRinger.db.RingerDatabase;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
import com.TwentyCodes.android.LocationRinger.ui.SearchDialog;
import com.TwentyCodes.android.location.AndroidGPS;
import com.TwentyCodes.android.location.GeoPointLocationListener;
@@ -134,7 +134,7 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca
mMap = (MapFragment) getFragmentManager().findFragmentById(R.id.mapview);
mRadius = (SeekBar) view.findViewById(R.id.radius);
mRadiusTextView = (TextView) view.findViewById(R.id.radius_textview);
mRadius.setMax(Debug.MAX_RADIUS_IN_METERS);
mRadius.setMax(Constraints.MAX_RADIUS_IN_METERS);
mMap.setClickable(false);
mMapEditToggle = (ToggleButton) view.findViewById(R.id.map_edit_toggle);
mMapEditToggle.setChecked(false);
@@ -175,7 +175,7 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca
*/
@Override
public void onFirstFix(final boolean isFirstFix) {
if (mPoint != null){
if (mPoint != null) {
/*
* if this is the first fix and the radius overlay does not have a
* point specified then pan the map, and zoom in to the users
@@ -211,8 +211,7 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca
@Override
public void onLocationSelected(final GeoPoint point) {
if (point != null) {
if (Debug.DEBUG)
Log.d(TAG, "onLocationSelected() " + point.toString());
Log.d(TAG, "onLocationSelected() " + point.toString());
if (mRadiusOverlay != null)
mRadiusOverlay.setLocation(point);
@@ -225,7 +224,7 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca
info.put(RingerDatabase.KEY_LOCATION, point.toString());
mListener.onInfoContentChanged(info);
}
} else if (Debug.DEBUG)
} else
Log.d(TAG, "onLocationSelected() Location was null");
}
@@ -249,7 +248,7 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca
public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) {
switch (seekBar.getId()) {
case R.id.radius:
mRadiusTextView.setText(GeoUtils.distanceToString((Float.valueOf(progress) / 1000) , true));
mRadiusTextView.setText(GeoUtils.distanceToString(Float.valueOf(progress) / 1000, true));
mRadiusOverlay.setRadius(progress);
mMap.invalidate();
if (mListener != null) {

View File

@@ -18,7 +18,6 @@ import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
@@ -29,10 +28,10 @@ import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import com.TwentyCodes.android.LocationRinger.FeatureRemovedListener;
import com.TwentyCodes.android.LocationRinger.Log;
import com.TwentyCodes.android.LocationRinger.OnContentChangedListener;
import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.db.RingerDatabase;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
/**
* This fragment will be for ringtone settings
@@ -54,7 +53,8 @@ public class RingtoneFragment extends BaseFeatureFragment implements OnClickList
private Uri mRingtoneURI;
private SeekBar mVolume;
public RingtoneFragment(final ContentValues info, final OnContentChangedListener changedListener, final FeatureRemovedListener removedListener, final int stream, final int id) {
public RingtoneFragment(final ContentValues info, final OnContentChangedListener changedListener, final FeatureRemovedListener removedListener, final int stream,
final int id) {
super(id, R.layout.ringtone_fragment, removedListener);
if (info == null)
@@ -179,9 +179,8 @@ public class RingtoneFragment extends BaseFeatureFragment implements OnClickList
final View view = super.onCreateView(inflater, container, savedInstanceState);
final AudioManager audioManager = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE);
if (Debug.DEBUG)
for (final Entry<String, Object> item : mInfo.valueSet())
Log.d(TAG, item.getKey() + " = " + item.getValue());
for (final Entry<String, Object> item : mInfo.valueSet())
Log.d(TAG, item.getKey() + " = " + item.getValue());
/*
* initialize the views

View File

@@ -13,7 +13,6 @@ import android.content.ContentValues;
import android.content.Context;
import android.media.AudioManager;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -22,10 +21,10 @@ import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import com.TwentyCodes.android.LocationRinger.FeatureRemovedListener;
import com.TwentyCodes.android.LocationRinger.Log;
import com.TwentyCodes.android.LocationRinger.OnContentChangedListener;
import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.db.RingerDatabase;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
/**
* This fragment will represent the volume fragments
@@ -127,9 +126,8 @@ public class VolumeFragment extends BaseFeatureFragment implements OnSeekBarChan
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
if (Debug.DEBUG)
for (final Entry<String, Object> item : mInfo.valueSet())
Log.d(TAG, item.getKey() + " = " + item.getValue());
for (final Entry<String, Object> item : mInfo.valueSet())
Log.d(TAG, item.getKey() + " = " + item.getValue());
final View view = super.onCreateView(inflater, container, savedInstanceState);
final TextView label = (TextView) view.findViewById(R.id.title);