diff --git a/LocationRinger/.settings/org.eclipse.core.resources.prefs b/LocationRinger/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..3d14e08
--- /dev/null
+++ b/LocationRinger/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding//assets/legal.html=UTF-8
diff --git a/LocationRinger/AndroidManifest.xml b/LocationRinger/AndroidManifest.xml
index 0579f87..b247469 100644
--- a/LocationRinger/AndroidManifest.xml
+++ b/LocationRinger/AndroidManifest.xml
@@ -2,8 +2,8 @@
+ android:versionCode="176"
+ android:versionName="33b5da7" >
@@ -50,7 +50,7 @@
+ android:label="@string/app_name" android:noHistory="true" android:excludeFromRecents="true">
@@ -114,7 +114,7 @@
+ android:configChanges="keyboard|orientation" android:excludeFromRecents="true" android:noHistory="true"/>
@@ -131,6 +131,7 @@
+
diff --git a/LocationRinger/assets/legal.html b/LocationRinger/assets/legal.html
new file mode 100644
index 0000000..09e62bd
--- /dev/null
+++ b/LocationRinger/assets/legal.html
@@ -0,0 +1,172 @@
+Location Ringer
+
+
+ Copyright © 2012 Rick Barrette
+
+
+
+
Location Ringer by Rick Barrette is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
+
+
+
+Location Ringer uses the following open source libraries licensed under the Apache Software License 2.0.
+
+
+- Android-ViewPagerIndicator - Paging indicator widgets compatible with the ViewPager from the Android Support Library and ActionBarSherlock.
+
+
+
+Apache License
Version 2.0, January 2004
+http://www.apache.org/licenses/
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+1. Definitions.
+"License" shall mean the terms and conditions for use, reproduction, and
+distribution as defined by Sections 1 through 9 of this document.
+"Licensor" shall mean the copyright owner or entity authorized by the
+copyright owner that is granting the License.
+"Legal Entity" shall mean the union of the acting entity and all other
+entities that control, are controlled by, or are under common control with
+that entity. For the purposes of this definition, "control" means (i) the
+power, direct or indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (ii) ownership of fifty
+percent (50%) or more of the outstanding shares, or (iii) beneficial
+ownership of such entity.
+"You" (or "Your") shall mean an individual or Legal Entity exercising
+permissions granted by this License.
+"Source" form shall mean the preferred form for making modifications,
+including but not limited to software source code, documentation source,
+and configuration files.
+"Object" form shall mean any form resulting from mechanical transformation
+or translation of a Source form, including but not limited to compiled
+object code, generated documentation, and conversions to other media types.
+"Work" shall mean the work of authorship, whether in Source or Object form,
+made available under the License, as indicated by a copyright notice that
+is included in or attached to the work (an example is provided in the
+Appendix below).
+"Derivative Works" shall mean any work, whether in Source or Object form,
+that is based on (or derived from) the Work and for which the editorial
+revisions, annotations, elaborations, or other modifications represent, as
+a whole, an original work of authorship. For the purposes of this License,
+Derivative Works shall not include works that remain separable from, or
+merely link (or bind by name) to the interfaces of, the Work and Derivative
+Works thereof.
+"Contribution" shall mean any work of authorship, including the original
+version of the Work and any modifications or additions to that Work or
+Derivative Works thereof, that is intentionally submitted to Licensor for
+inclusion in the Work by the copyright owner or by an individual or Legal
+Entity authorized to submit on behalf of the copyright owner. For the
+purposes of this definition, "submitted" means any form of electronic,
+verbal, or written communication sent to the Licensor or its
+representatives, including but not limited to communication on electronic
+mailing lists, source code control systems, and issue tracking systems that
+are managed by, or on behalf of, the Licensor for the purpose of discussing
+and improving the Work, but excluding communication that is conspicuously
+marked or otherwise designated in writing by the copyright owner as "Not a
+Contribution."
+"Contributor" shall mean Licensor and any individual or Legal Entity on
+behalf of whom a Contribution has been received by Licensor and
+subsequently incorporated within the Work.
+2. Grant of Copyright License. Subject to the
+terms and conditions of this License, each Contributor hereby grants to You
+a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+copyright license to reproduce, prepare Derivative Works of, publicly
+display, publicly perform, sublicense, and distribute the Work and such
+Derivative Works in Source or Object form.
+3. Grant of Patent License. Subject to the terms
+and conditions of this License, each Contributor hereby grants to You a
+perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+(except as stated in this section) patent license to make, have made, use,
+offer to sell, sell, import, and otherwise transfer the Work, where such
+license applies only to those patent claims licensable by such Contributor
+that are necessarily infringed by their Contribution(s) alone or by
+combination of their Contribution(s) with the Work to which such
+Contribution(s) was submitted. If You institute patent litigation against
+any entity (including a cross-claim or counterclaim in a lawsuit) alleging
+that the Work or a Contribution incorporated within the Work constitutes
+direct or contributory patent infringement, then any patent licenses
+granted to You under this License for that Work shall terminate as of the
+date such litigation is filed.
+4. Redistribution. You may reproduce and
+distribute copies of the Work or Derivative Works thereof in any medium,
+with or without modifications, and in Source or Object form, provided that
+You meet the following conditions:
+
+-
+
You must give any other recipients of the Work or Derivative Works a
+copy of this License; and
+
+-
+
You must cause any modified files to carry prominent notices stating
+that You changed the files; and
+
+-
+
You must retain, in the Source form of any Derivative Works that You
+distribute, all copyright, patent, trademark, and attribution notices from
+the Source form of the Work, excluding those notices that do not pertain to
+any part of the Derivative Works; and
+
+-
+
If the Work includes a "NOTICE" text file as part of its distribution,
+then any Derivative Works that You distribute must include a readable copy
+of the attribution notices contained within such NOTICE file, excluding
+those notices that do not pertain to any part of the Derivative Works, in
+at least one of the following places: within a NOTICE text file distributed
+as part of the Derivative Works; within the Source form or documentation,
+if provided along with the Derivative Works; or, within a display generated
+by the Derivative Works, if and wherever such third-party notices normally
+appear. The contents of the NOTICE file are for informational purposes only
+and do not modify the License. You may add Your own attribution notices
+within Derivative Works that You distribute, alongside or as an addendum to
+the NOTICE text from the Work, provided that such additional attribution
+notices cannot be construed as modifying the License.
+You may add Your own copyright statement to Your modifications and may
+provide additional or different license terms and conditions for use,
+reproduction, or distribution of Your modifications, or for any such
+Derivative Works as a whole, provided Your use, reproduction, and
+distribution of the Work otherwise complies with the conditions stated in
+this License.
+
+
+5. Submission of Contributions. Unless You
+explicitly state otherwise, any Contribution intentionally submitted for
+inclusion in the Work by You to the Licensor shall be under the terms and
+conditions of this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify the
+terms of any separate license agreement you may have executed with Licensor
+regarding such Contributions.
+6. Trademarks. This License does not grant
+permission to use the trade names, trademarks, service marks, or product
+names of the Licensor, except as required for reasonable and customary use
+in describing the origin of the Work and reproducing the content of the
+NOTICE file.
+7. Disclaimer of Warranty. Unless required by
+applicable law or agreed to in writing, Licensor provides the Work (and
+each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including,
+without limitation, any warranties or conditions of TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You
+are solely responsible for determining the appropriateness of using or
+redistributing the Work and assume any risks associated with Your exercise
+of permissions under this License.
+8. Limitation of Liability. In no event and
+under no legal theory, whether in tort (including negligence), contract, or
+otherwise, unless required by applicable law (such as deliberate and
+grossly negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special,
+incidental, or consequential damages of any character arising as a result
+of this License or out of the use or inability to use the Work (including
+but not limited to damages for loss of goodwill, work stoppage, computer
+failure or malfunction, or any and all other commercial damages or losses),
+even if such Contributor has been advised of the possibility of such
+damages.
+9. Accepting Warranty or Additional Liability.
+While redistributing the Work or Derivative Works thereof, You may choose
+to offer, and charge a fee for, acceptance of support, warranty, indemnity,
+or other liability obligations and/or rights consistent with this License.
+However, in accepting such obligations, You may act only on Your own behalf
+and on Your sole responsibility, not on behalf of any other Contributor,
+and only if You agree to indemnify, defend, and hold each Contributor
+harmless for any liability incurred by, or claims asserted against, such
+Contributor by reason of your accepting any such warranty or additional
+liability.
+END OF TERMS AND CONDITIONS
diff --git a/LocationRinger/res/layout/leagal_activity.xml b/LocationRinger/res/layout/leagal_activity.xml
new file mode 100644
index 0000000..06a6416
--- /dev/null
+++ b/LocationRinger/res/layout/leagal_activity.xml
@@ -0,0 +1,6 @@
+
+
+
\ No newline at end of file
diff --git a/LocationRinger/res/values/strings.xml b/LocationRinger/res/values/strings.xml
index cd4f427..96146af 100644
--- a/LocationRinger/res/values/strings.xml
+++ b/LocationRinger/res/values/strings.xml
@@ -95,5 +95,6 @@
Current Ringer:
Prepearing New Ringer
Airplane Mode
+ Legal
\ No newline at end of file
diff --git a/LocationRinger/res/xml/setings.xml b/LocationRinger/res/xml/setings.xml
index 278e19a..4770d3a 100644
--- a/LocationRinger/res/xml/setings.xml
+++ b/LocationRinger/res/xml/setings.xml
@@ -1,12 +1,12 @@
-
-
+
+
+
+
+
+
@@ -21,6 +21,10 @@
+
+
\ No newline at end of file
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/Constraints.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/Constraints.java
new file mode 100644
index 0000000..8040f54
--- /dev/null
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/Constraints.java
@@ -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;
+ }
+}
\ No newline at end of file
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/LegalActivity.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/LegalActivity.java
new file mode 100644
index 0000000..3c1a0bd
--- /dev/null
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/LegalActivity.java
@@ -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");
+ }
+
+}
\ No newline at end of file
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/Log.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/Log.java
new file mode 100644
index 0000000..3039953
--- /dev/null
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/Log.java
@@ -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);
+ }
+}
\ No newline at end of file
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/db/DatabaseListener.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/db/DatabaseListener.java
index b91433a..567a208 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/db/DatabaseListener.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/db/DatabaseListener.java
@@ -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();
-
+
}
\ No newline at end of file
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/db/RingerDatabase.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/db/RingerDatabase.java
index 193f3cc..0981cb9 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/db/RingerDatabase.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/db/RingerDatabase.java
@@ -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);
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/debug/Debug.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/debug/Debug.java
deleted file mode 100644
index 55d0d0e..0000000
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/debug/Debug.java
+++ /dev/null
@@ -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;
- }
-}
\ 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 1422565..95359bc 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/GetLocationWidget.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/GetLocationWidget.java
@@ -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
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/LocationChangedReceiver.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/LocationChangedReceiver.java
index 962a70f..1ef64ec 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/LocationChangedReceiver.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/LocationChangedReceiver.java
@@ -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");
}
}
\ No newline at end of file
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/SystemReceiver.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/SystemReceiver.java
index 511716f..f2bd549 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/SystemReceiver.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/SystemReceiver.java
@@ -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
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/LocationService.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/LocationService.java
index 9ad5322..f45d7fa 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/LocationService.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/LocationService.java
@@ -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);
}
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/RingerProcessingService.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/RingerProcessingService.java
index 6f68379..2e6f584 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/RingerProcessingService.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/RingerProcessingService.java
@@ -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 item : ringer.valueSet())
- Log.d(TAG, item.getKey());
+ for (final Entry 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();
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/FirstBootDialog.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/FirstBootDialog.java
index 193cb87..8f5f694 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/FirstBootDialog.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/FirstBootDialog.java
@@ -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();
}
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/ListActivity.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/ListActivity.java
index 21865d6..9dbf7c5 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/ListActivity.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/ListActivity.java
@@ -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();
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/RingerInformationActivity.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/RingerInformationActivity.java
index e1d3904..93276bb 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/RingerInformationActivity.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/RingerInformationActivity.java
@@ -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);
}
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/RingerListAdapter.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/RingerListAdapter.java
index a7abbf0..d6a0c3d 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/RingerListAdapter.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/RingerListAdapter.java
@@ -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
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SearchDialog.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SearchDialog.java
index e951a3f..83431c0 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SearchDialog.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SearchDialog.java
@@ -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 getAddress() {
- if (Debug.DEBUG)
- Log.d(TAG, "getAddress()");
+ Log.d(TAG, "getAddress()");
final ArrayList list = new ArrayList();
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(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");
}
});
}
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SettingsActivity.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SettingsActivity.java
index 3bc0d03..00bbfac 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SettingsActivity.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SettingsActivity.java
@@ -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;
}
}
\ No newline at end of file
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/AboutRingerFragment.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/AboutRingerFragment.java
index c9c5374..03dda59 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/AboutRingerFragment.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/AboutRingerFragment.java
@@ -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 item : mInfo.valueSet())
- Log.d(TAG, item.getKey() + " = " + item.getValue());
+ for (final Entry item : mInfo.valueSet())
+ Log.d(TAG, item.getKey() + " = " + item.getValue());
- for (final Entry item : mRinger.valueSet())
- Log.d(TAG, item.getKey() + " = " + item.getValue());
- }
+ for (final Entry item : mRinger.valueSet())
+ Log.d(TAG, item.getKey() + " = " + item.getValue());
/*
* ringer name
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/BaseFragmentListFragment.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/BaseFragmentListFragment.java
index b955221..492a149 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/BaseFragmentListFragment.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/BaseFragmentListFragment.java
@@ -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();
}
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/FeatureListFragment.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/FeatureListFragment.java
index 7ddeaab..cb71a88 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/FeatureListFragment.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/FeatureListFragment.java
@@ -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;
}
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/LocationInfomationFragment.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/LocationInfomationFragment.java
index ec27b24..a452a1a 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/LocationInfomationFragment.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/LocationInfomationFragment.java
@@ -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) {
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/RingtoneFragment.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/RingtoneFragment.java
index fd8fbe4..3e91e7e 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/RingtoneFragment.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/RingtoneFragment.java
@@ -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 item : mInfo.valueSet())
- Log.d(TAG, item.getKey() + " = " + item.getValue());
+ for (final Entry item : mInfo.valueSet())
+ Log.d(TAG, item.getKey() + " = " + item.getValue());
/*
* initialize the views
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/VolumeFragment.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/VolumeFragment.java
index 0d090f4..9d8a839 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/VolumeFragment.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/VolumeFragment.java
@@ -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 item : mInfo.valueSet())
- Log.d(TAG, item.getKey() + " = " + item.getValue());
+ for (final Entry 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);