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,2 @@
eclipse.preferences.version=1
encoding//assets/legal.html=UTF-8

View File

@@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.TwentyCodes.android.LocationRinger"
android:installLocation="internalOnly"
android:versionCode="166"
android:versionName="ee943ea" >
android:versionCode="176"
android:versionName="33b5da7" >
<uses-sdk android:minSdkVersion="7"/>
@@ -50,7 +50,7 @@
<activity
android:name=".ui.ListActivity"
android:configChanges="keyboard|orientation"
android:label="@string/app_name" >
android:label="@string/app_name" android:noHistory="true" android:excludeFromRecents="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -114,7 +114,7 @@
<activity
android:name="com.TwentyCodes.android.exception.ExceptionReportActivity"
android:configChanges="keyboard|orientation" />
android:configChanges="keyboard|orientation" android:excludeFromRecents="true" android:noHistory="true"/>
<service android:name="com.TwentyCodes.android.exception.ReportPostingService" />
@@ -131,6 +131,7 @@
<action android:name="android.intent.action.CREATE_SHORTCUT" />
</intent-filter>
</activity>
<activity android:name="LegalActivity"></activity>
</application>
</manifest>

View File

@@ -0,0 +1,172 @@
<strong>Location Ringer</strong>
<br/>
<pre>
Copyright &copy; 2012 <a href="mailto:rickbarrette@gmail.com?subject=Location+Ringer">Rick Barrette</a>
</pre>
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/deed.en_US"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc-nd/3.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">Location Ringer</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://rickbarrette.org" property="cc:attributionName" rel="cc:attributionURL">Rick Barrette</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/deed.en_US">Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License</a>.
<hr/>
Location Ringer uses the following open source libraries licensed under the <a href="#apachelicense">Apache Software License 2.0</a>.
<ul>
<li> <a href="https://github.com/JakeWharton/Android-ViewPagerIndicator">Android-ViewPagerIndicator</a> - Paging indicator widgets compatible with the ViewPager from the Android Support Library and ActionBarSherlock.
</ul>
<hr/>
<a name="apachelicense"/><p>Apache License<br></br>Version 2.0, January 2004<br></br>
<a href="http://www.apache.org/licenses/">http://www.apache.org/licenses/</a> </p>
<p>TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION</p>
<p><strong><a name="definitions">1. Definitions</a></strong>.</p>
<p>"License" shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.</p>
<p>"Licensor" shall mean the copyright owner or entity authorized by the
copyright owner that is granting the License.</p>
<p>"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.</p>
<p>"You" (or "Your") shall mean an individual or Legal Entity exercising
permissions granted by this License.</p>
<p>"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation source,
and configuration files.</p>
<p>"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.</p>
<p>"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).</p>
<p>"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.</p>
<p>"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."</p>
<p>"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.</p>
<p><strong><a name="copyright">2. Grant of Copyright License</a></strong>. 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.</p>
<p><strong><a name="patent">3. Grant of Patent License</a></strong>. 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.</p>
<p><strong><a name="redistribution">4. Redistribution</a></strong>. 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:</p>
<ol>
<li>
<p>You must give any other recipients of the Work or Derivative Works a
copy of this License; and</p>
</li>
<li>
<p>You must cause any modified files to carry prominent notices stating
that You changed the files; and</p>
</li>
<li>
<p>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</p>
</li>
<li>
<p>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.</p>
</li>
</ol>
<p><strong><a name="contributions">5. Submission of Contributions</a></strong>. 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.</p>
<p><strong><a name="trademarks">6. Trademarks</a></strong>. 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.</p>
<p><strong><a name="no-warranty">7. Disclaimer of Warranty</a></strong>. 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.</p>
<p><strong><a name="no-liability">8. Limitation of Liability</a></strong>. 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.</p>
<p><strong><a name="additional">9. Accepting Warranty or Additional Liability</a></strong>.
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.</p>
<p>END OF TERMS AND CONDITIONS</p>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webview" >
</WebView>

View File

@@ -95,5 +95,6 @@
<string name="current_ringer">Current Ringer:</string>
<string name="preparing_ringer">Prepearing New Ringer</string>
<string name="airplane_mode">Airplane Mode</string>
<string name="legal">Legal</string>
</resources>

View File

@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<CheckBoxPreference
android:defaultValue="false"
android:key="start_on_boot"
android:summary="@string/start_on_boot_about"
android:title="@string/start_on_boot" >
</CheckBoxPreference>
<!-- <CheckBoxPreference -->
<!-- android:defaultValue="false" -->
<!-- android:key="start_on_boot" -->
<!-- android:summary="@string/start_on_boot_about" -->
<!-- android:title="@string/start_on_boot" > -->
<!-- </CheckBoxPreference> -->
<PreferenceScreen android:title="@string/about" >
<com.TwentyCodes.android.LocationRinger.ui.TextViewPreference android:title="@string/hello" />
@@ -21,6 +21,10 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/version_info" >
<com.TwentyCodes.android.exception.VersionInformationPreference />
<Preference
android:key="legal"
android:title="@string/legal" >
</Preference>
</PreferenceCategory>
</PreferenceScreen>

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

@@ -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,10 +76,8 @@ public class RingerDatabase {
if (cursor.moveToFirst())
do {
final ContentValues ringer = new ContentValues();
if (Debug.DEBUG)
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));
switch (i) {
case 0: // ringer name
@@ -131,7 +129,7 @@ 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
@@ -183,7 +181,6 @@ 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");
final ContentValues ringer = new ContentValues();
final ContentValues info = new ContentValues();
@@ -569,7 +566,6 @@ 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));
return parseBoolean(cursor.getString(0));
}
@@ -608,7 +604,6 @@ public class RingerDatabase {
}
public int setRingerEnabled(final long id, final boolean enabled) {
if (Debug.DEBUG)
Log.d(TAG, "setRingerEnabled(" + id + ") = " + enabled);
final ContentValues values = new ContentValues();
values.put(KEY_IS_ENABLED, enabled);

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,7 +45,6 @@ public class GetLocationWidget extends AppWidgetProvider {
*/
@Override
public void onDeleted(final Context context, final int[] appWidgetIds) {
if (Debug.DEBUG)
Log.v(TAG, "onDelete()");
super.onDeleted(context, appWidgetIds);
}
@@ -63,7 +62,6 @@ public class GetLocationWidget extends AppWidgetProvider {
*/
@Override
public void onReceive(final Context context, final Intent intent) {
if (Debug.DEBUG)
Log.v(TAG, "onReceive");
// v1.5 fix that doesn't call onDelete Action
final String action = intent.getAction();
@@ -96,7 +94,6 @@ 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()");
final int N = appWidgetIds.length;
@@ -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");
}
}

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);
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)) {
// 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()");
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"));
}
/*
* music volume we will set the music volume only if music is not
@@ -126,11 +123,10 @@ public class RingerProcessingService extends Service {
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()");
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,7 +228,6 @@ 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);
mStartId = startId;
@@ -248,16 +242,13 @@ public class RingerProcessingService extends Service {
if (intent == null)
stopSelf(startId);
else {
if (intent.getParcelableExtra(LocationLibraryConstants.INTENT_EXTRA_LOCATION_CHANGED) != null) {
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");
Log.w(TAG, "Location was null");
stopSelf(startId);
}
}
return super.onStartCommand(intent, flags, startId);
}
@@ -276,18 +267,15 @@ 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");
}
final Cursor c = mDb.getAllRingers();
c.moveToFirst();
if (c.moveToFirst())
do {
if (Debug.DEBUG)
Log.d(TAG, "Checking ringer " + c.getString(0));
if (RingerDatabase.parseBoolean(c.getString(1))) {
@@ -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,13 +299,11 @@ public class RingerProcessingService extends Service {
c.close();
if (Debug.DEBUG)
for (final Entry<String, Object> item : ringer.valueSet())
Log.d(TAG, item.getKey());
applyRinger(ringer);
if (Debug.DEBUG)
Log.d(TAG, "Finished processing ringers");
// store is default

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;
@@ -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,8 +213,8 @@ 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() {
@@ -233,9 +233,10 @@ 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);
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);
}
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);
}
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,7 +105,6 @@ public class RingerListAdapter extends BaseAdapter {
// and the ImageView.
holder = (ViewHolder) convertView.getTag();
if (Debug.DEBUG) {
Log.d(TAG, "postion = " + position);
if (convertView == null)
@@ -120,7 +118,6 @@ public class RingerListAdapter extends BaseAdapter {
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,7 +80,6 @@ public class SearchDialog extends Dialog implements android.view.View.OnClickLis
* @author ricky barrette
*/
private ArrayList<String> getAddress() {
if (Debug.DEBUG)
Log.d(TAG, "getAddress()");
final ArrayList<String> list = new ArrayList<String>();
try {
@@ -103,11 +101,9 @@ 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()");
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());
return new GeoPoint((int) (coords.getDouble(1) * 1E6), (int) (coords.getDouble(0) * 1E6));
} catch (final JSONException e) {
@@ -151,7 +147,6 @@ 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);
mListener.onLocationSelected(getCoords((int) id));
dismiss();
@@ -167,7 +162,6 @@ 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");
try {
mResults = ReverseGeocoder.addressSearch(mAddress.getText().toString());
@@ -177,19 +171,16 @@ 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");
// update UI
mHandler.post(new Runnable() {
@Override
public void run() {
if (Debug.DEBUG)
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");
}
});
@@ -201,7 +192,6 @@ 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");
}
});

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) {
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 : 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,7 +156,6 @@ public abstract class BaseFragmentListFragment extends Fragment {
*/
@Override
public void onResume() {
if (Debug.DEBUG)
Log.v(TAG, "onResume()");
loadFragments();
super.onResume();

View File

@@ -119,7 +119,8 @@ public class FeatureListFragment extends BaseFragmentListFragment implements OnC
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;
}

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);
@@ -211,7 +211,6 @@ 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());
if (mRadiusOverlay != null)
@@ -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,7 +179,6 @@ 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());

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,7 +126,6 @@ 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());