Fixed some lint errors

Signed-off-by: Ricky Barrette <rickbarrette@gmail.com>
This commit is contained in:
2012-06-03 11:36:32 -04:00
parent 8bbecd3fc9
commit d887272068
11 changed files with 122 additions and 76 deletions

View File

@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6

View File

@@ -7,26 +7,14 @@
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="14" />
android:targetSdkVersion="11" />
<uses-feature
android:name="android.hardware.location"
android:required="true" />
<uses-feature
android:name="android.hardware.location.gps"
android:required="false" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
@@ -36,7 +24,7 @@
android:theme="@style/Theme.Custom" >
<activity
android:name="LocationRinger"
android:configChanges="keyboard|orientation"
android:configChanges="keyboard|keyboardHidden|orientation"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -44,12 +32,9 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="com.google.android.maps" />
<activity
android:name=".ui.RingerInformationActivity"
android:configChanges="keyboard|orientation" />
android:configChanges="keyboard|keyboardHidden|orientation" />
<receiver
android:name=".receivers.SystemReceiver"
@@ -96,17 +81,6 @@
android:name="android.appwidget.provider"
android:resource="@xml/updatelocationwidgetinfo" />
</receiver>
<activity
android:name="com.TwentyCodes.android.exception.ExceptionReportActivity"
android:configChanges="keyboard|orientation" />
<activity
android:name="com.TwentyCodes.android.SkyHook.Splash"
android:configChanges="keyboard|orientation"
android:screenOrientation="portrait" />
<service android:name="com.TwentyCodes.android.exception.ReportPostingService" />
<receiver
android:name=".receivers.PassiveLocationChangedReceiver"
android:enabled="true"

View File

@@ -12,3 +12,4 @@ android.library.reference.2=../../location_library/LocationLib
#proguard.config=proguard.cfg
# Project target.
target=Google Inc.:Google APIs:15
manifestmerger.enabled=true

View File

@@ -40,8 +40,28 @@ public class RingerDatabase {
private static final String TAG = "RingerDatabase";
private final Context mContext;
private SQLiteDatabase mDb;
private final DatabaseListener mListener;
private static DatabaseListener mListener;
public boolean isUpgrading = false;
private final static Handler mHandler;
protected static final int DELETIONCOMPLETE = 0;
protected static final int DATABASEUPGRADECOMPLETE = 1;
static{
mHandler = new Handler(){
@Override
public void handleMessage(Message msg) {
if(mListener != null)
switch(msg.what){
case DELETIONCOMPLETE:
mListener.onRingerDeletionComplete();
break;
case DATABASEUPGRADECOMPLETE:
mListener.onDatabaseUpgradeComplete();
break;
}
}
};
}
/*
* database information values
@@ -212,19 +232,11 @@ public class RingerDatabase {
public void onUpgrade(final SQLiteDatabase db, final int oldVersion, int newVersion) {
Log.w(TAG, "Upgrading database from version "+oldVersion+" to "+newVersion);
if(RingerDatabase.this.mListener != null)
RingerDatabase.this.mListener.onDatabaseUpgrade();
if(mListener != null)
mListener.onDatabaseUpgrade();
RingerDatabase.this.isUpgrading = true;
final Handler handler = new Handler(){
@Override
public void handleMessage(Message msg) {
if(RingerDatabase.this.mListener != null)
RingerDatabase.this.mListener.onDatabaseUpgradeComplete();
}
};
//upgrade thread
new Thread( new Runnable(){
@Override
@@ -269,7 +281,7 @@ public class RingerDatabase {
db.execSQL("ALTER TABLE ringers_new RENAME TO "+ RINGER_TABLE);
}
handler.sendEmptyMessage(0);
mHandler.sendEmptyMessage(DATABASEUPGRADECOMPLETE);
RingerDatabase.this.isUpgrading = false;
}
}).start();
@@ -292,7 +304,7 @@ public class RingerDatabase {
* @author ricky barrette
*/
public RingerDatabase(Context context, DatabaseListener listener){
this.mListener = listener;
mListener = listener;
this.mContext = context;
this.mDb = new OpenHelper(this.mContext).getWritableDatabase();
}
@@ -385,14 +397,6 @@ public class RingerDatabase {
final ProgressDialog progress = ProgressDialog.show(RingerDatabase.this.mContext, "", RingerDatabase.this.mContext.getText(R.string.deleteing), true, true);
final Handler handler = new Handler(){
@Override
public void handleMessage(Message msg) {
if(RingerDatabase.this.mListener != null)
RingerDatabase.this.mListener.onRingerDeletionComplete();
}
};
//ringer deleting thread
new Thread( new Runnable(){
@Override
@@ -409,7 +413,7 @@ public class RingerDatabase {
*/
RingerDatabase.this.mDb.delete(RINGER_TABLE, "id = "+ id, null);
updateRowIds(id +1);
handler.sendEmptyMessage(0);
mHandler.sendEmptyMessage(DELETIONCOMPLETE);
progress.dismiss();
}
}).start();
@@ -585,8 +589,8 @@ public class RingerDatabase {
this.mDb.close();
this.mDb = new OpenHelper(this.mContext).getWritableDatabase();
if(this.mDb.isOpen() && ! this.isUpgrading)
if(this.mListener != null)
this.mListener.onRestoreComplete();
if(mListener != null)
mListener.onRestoreComplete();
}
public int setRingerEnabled(final long id, final boolean enabled) {
@@ -667,7 +671,7 @@ public class RingerDatabase {
*/
private void updateRowIds(long id) {
long currentRow;
ContentValues values = new ContentValues();
final ContentValues values = new ContentValues();
final Cursor cursor = this.mDb.query(RINGER_TABLE, new String[] { "id" },null, null, null, null, null);
if (cursor.moveToFirst()) {
do {

View File

@@ -48,7 +48,7 @@ public final String TAG = "GetLocationWidget";
int appWidgetId = appWidgetIds[i];
Intent intent = new Intent(context, LocationService.class)
.putExtra(LocationService.INTENT_EXTRA_REQUIRED_ACCURACY, Integer.parseInt(context.getSharedPreferences(SettingsActivity.SETTINGS, Context.MODE_WORLD_READABLE).getString(SettingsActivity.ACCURACY , "50")))
.putExtra(LocationService.INTENT_EXTRA_REQUIRED_ACCURACY, Integer.parseInt(context.getSharedPreferences(SettingsActivity.SETTINGS, Debug.SHARED_PREFS_MODE).getString(SettingsActivity.ACCURACY , "50")))
.setAction(LocationLibraryConstants.INTENT_ACTION_UPDATE);
//create a pending intent to start the post activity

View File

@@ -15,6 +15,7 @@ import android.content.SharedPreferences;
import com.TwentyCodes.android.LocationRinger.LocationRinger;
import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
import com.TwentyCodes.android.LocationRinger.ui.SettingsActivity;
import com.TwentyCodes.android.SkyHook.SkyHookService;
import com.TwentyCodes.android.exception.ExceptionHandler;
@@ -57,7 +58,7 @@ public class LocationService extends SkyHookService {
@Override
public void onCreate() {
Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(this));
this.mSettings = this.getSharedPreferences(SettingsActivity.SETTINGS, Context.MODE_WORLD_WRITEABLE);
this.mSettings = this.getSharedPreferences(SettingsActivity.SETTINGS, Debug.SHARED_PREFS_MODE);
this.mSettings.edit().putBoolean(SettingsActivity.IS_SERVICE_STARTED, true).commit();
startOnGoingNotification();
super.onCreate();

View File

@@ -332,7 +332,7 @@ public class RingerProcessingService extends Service {
final ContentValues info = this.mDb.getRingerInfo(c.getString(0));
if(info.containsKey(RingerDatabase.KEY_LOCATION) && info.containsKey(RingerDatabase.KEY_RADIUS)){
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])), new Float(info.getAsInteger(RingerDatabase.KEY_RADIUS)) / 1000, Debug.FUDGE_FACTOR)){
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)){
c.close();
getRinger(ringer, index);
isDeafult = false;

View File

@@ -7,6 +7,7 @@
package com.TwentyCodes.android.LocationRinger.ui;
import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
import android.app.Dialog;
import android.content.Context;
@@ -71,7 +72,7 @@ public class FirstBootDialog extends Dialog implements android.view.View.OnClick
*/
@Override
public void onClick(View arg0) {
this.getContext().getSharedPreferences(SettingsActivity.SETTINGS, Context.MODE_WORLD_WRITEABLE).edit().putBoolean(SettingsActivity.IS_FIRST_BOOT, false).commit();
this.getContext().getSharedPreferences(SettingsActivity.SETTINGS, Debug.SHARED_PREFS_MODE).edit().putBoolean(SettingsActivity.IS_FIRST_BOOT, false).commit();
this.dismiss();
}

View File

@@ -27,6 +27,7 @@ import android.os.Bundle;
import android.os.Parcelable;
import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
import com.TwentyCodes.android.LocationRinger.services.LocationService;
import com.TwentyCodes.android.debug.LocationLibraryConstants;
@@ -78,7 +79,7 @@ public class LauncherShortcuts extends Activity {
* start the location service in single shot mode
*/
Intent service = new Intent(this, LocationService.class)
.putExtra(LocationService.INTENT_EXTRA_REQUIRED_ACCURACY, Integer.parseInt(this.getSharedPreferences(SettingsActivity.SETTINGS, Context.MODE_WORLD_READABLE).getString(SettingsActivity.ACCURACY , "50")))
.putExtra(LocationService.INTENT_EXTRA_REQUIRED_ACCURACY, Integer.parseInt(this.getSharedPreferences(SettingsActivity.SETTINGS, Debug.SHARED_PREFS_MODE).getString(SettingsActivity.ACCURACY , "50")))
.setAction(LocationLibraryConstants.INTENT_ACTION_UPDATE);
this.startService(service);

View File

@@ -7,14 +7,16 @@
package com.TwentyCodes.android.LocationRinger.ui;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
@@ -36,19 +38,20 @@ 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.SkyHook.SkyHookRegistration;
import com.TwentyCodes.android.SkyHook.Splash;
import com.TwentyCodes.android.debug.LocationLibraryConstants;
import com.TwentyCodes.android.location.PassiveLocationListener;
import com.skyhookwireless.wps.RegistrationCallback;
import com.skyhookwireless.wps.WPSContinuation;
import com.skyhookwireless.wps.WPSReturnCode;
@SuppressLint("Registered")
public class ListActivity extends Activity implements OnItemClickListener, OnClickListener, DatabaseListener, RegistrationCallback {
private RingerDatabase mDb;
private ListView mListView;
private SharedPreferences mSettings;
private ProgressDialog mProgress;
private Dialog mSplashDialog;
public static final String NO_SPLASH = "no splash";
public static final String KEY_RINGER = "key_ringer";
@@ -153,7 +156,7 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
this.mListView.setEmptyView(findViewById(android.R.id.empty));
findViewById(R.id.add_ringer_button).setOnClickListener(this);
populate();
this.mSettings = this.getSharedPreferences(SettingsActivity.SETTINGS, Context.MODE_WORLD_WRITEABLE);
this.mSettings = this.getSharedPreferences(SettingsActivity.SETTINGS, Debug.SHARED_PREFS_MODE);
if(this.mSettings.getBoolean(SettingsActivity.IS_FIRST_BOOT, true))
new FirstBootDialog(this).show();
@@ -163,10 +166,10 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
}
if(!this.getIntent().hasExtra(NO_SPLASH))
this.startActivity(new Intent(this, Splash.class));
showSplashScreen();
}
/**
/**
* called when the activity is first created, creates a context menu
* @param menu
* @param v
@@ -194,7 +197,7 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
}
/**
/**
* Called when a database is being upgraded
* @author ricky barrette
*/
@@ -214,7 +217,7 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
this.mProgress.dismiss();
}
/* (non-Javadoc)
/* (non-Javadoc)
* @see android.app.Activity#onDestroy()
* @author ricky barrette
*/
@@ -225,7 +228,7 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
super.onDestroy();
}
/**
/**
* called when an item in the list view has been clicked,
* this will open the note edit dialog for the selected note
* (non-Javadoc)
@@ -278,7 +281,7 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
}).start();
}
/**
/**
* called when an option is selected form the menu
* (non-Javadoc)
* @see android.app.Activity#onOptionsItemSelected(android.view.MenuItem)
@@ -304,7 +307,17 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
return super.onOptionsItemSelected(item);
}
/**
/**
* (non-Javadoc)
* @see android.app.Activity#onPause()
*/
@Override
protected void onPause() {
removeSplashScreen();
super.onPause();
}
/**
* Called when the database is restored
*/
@Override
@@ -320,7 +333,7 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
populate();
}
/**
/**
* populates the list view from the data base
* @author ricky barrette
*/
@@ -329,6 +342,16 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
mListView.setAdapter(new RingerListAdapter(this, mDb));
}
/**
* Removes the Dialog that displays the splash screen
*/
protected void removeSplashScreen() {
if (mSplashDialog != null) {
mSplashDialog.dismiss();
mSplashDialog = null;
}
}
/**
* Restarts the service if its not already running.
* @author ricky barrette
@@ -345,4 +368,33 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
this.startService(i);
}
}
/**
* Shows the splash screen over the full Activity
*/
protected void showSplashScreen() {
// mMap.setGPSDialogEnabled(false);
mSplashDialog = new Dialog(this, android.R.style.Theme_Translucent);
mSplashDialog.setContentView(R.layout.powered_by_skyhook);
mSplashDialog.setCancelable(false);
mSplashDialog.show();
// Set Runnable to remove splash screen just in case
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
removeSplashScreen();
/*
* uncomment the following to display the eula
*/
// //loads first boot dialog if this is the first boot
// if (! mSettings.getBoolean(Settings.ACCEPTED, false) || Debug.FORCE_FIRSTBOOT_DIALOG)
// eulaAlert();
// else
// update();
}
}, 2000);
}
}

View File

@@ -44,6 +44,7 @@ public class AboutRingerFragment extends Fragment implements OnCheckedChangeList
private final ContentValues mRinger;
public AboutRingerFragment(final ContentValues ringer, final ContentValues info, final OnContentChangedListener listener){
super();
this.mInfo = info;
this.mRinger = ringer;
this.mListener = listener;