From 1e45d7911a943c76a51f609e62b8c74a7f9e5df2 Mon Sep 17 00:00:00 2001 From: Ricky Barrette Date: Mon, 23 Jul 2012 00:52:54 -0400 Subject: [PATCH] Updated Shortcut icons to use new launcher icon. removed skyhook location services from mapview fixed map progress wheel --- LocationRinger/AndroidManifest.xml | 4 +- .../ui/CheckLocationShortcut.java | 2 +- .../LocationRinger/ui/ListActivity.java | 61 +------------------ .../ui/RingerInformationActivity.java | 2 +- .../LocationRinger/ui/SettingsActivity.java | 2 +- .../fragments/LocationInfomationFragment.java | 37 +++++------ 6 files changed, 26 insertions(+), 82 deletions(-) diff --git a/LocationRinger/AndroidManifest.xml b/LocationRinger/AndroidManifest.xml index 945ff39..3bf6cbf 100644 --- a/LocationRinger/AndroidManifest.xml +++ b/LocationRinger/AndroidManifest.xml @@ -2,8 +2,8 @@ + android:versionCode="80" + android:versionName="79873c8" > diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/CheckLocationShortcut.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/CheckLocationShortcut.java index a45e525..36ae8cb 100644 --- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/CheckLocationShortcut.java +++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/CheckLocationShortcut.java @@ -131,7 +131,7 @@ public class CheckLocationShortcut extends Activity { final Intent intent = new Intent(); intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.start_location_service)); - final Parcelable iconResource = Intent.ShortcutIconResource.fromContext(this, R.drawable.icon); + final Parcelable iconResource = Intent.ShortcutIconResource.fromContext(this, R.drawable.ic_launcher); intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource); // Now, return the result to the launcher diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/ListActivity.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/ListActivity.java index f972e10..4559544 100644 --- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/ListActivity.java +++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/ListActivity.java @@ -37,14 +37,10 @@ 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.SkyHook.SkyHookRegistration; 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 { +public class ListActivity extends Activity implements OnItemClickListener, OnClickListener, DatabaseListener { private RingerDatabase mDb; private ListView mListView; @@ -52,7 +48,6 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli private ProgressDialog mProgress; private Dialog mSplashDialog; - public static final String NO_SPLASH = "no splash"; public static final String KEY_RINGER = "key_ringer"; public static final String KEY_INFO = "key_info"; public static final String KEY_IS_DEFAULT = "key_is_default"; @@ -61,22 +56,6 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli private static final String KEY_ROWID = "key_row_id"; public static final String ACTION_NEW_RINGER = "action_new_ringer"; - @Override - public void done() { - } - - @Override - public WPSContinuation handleError(final WPSReturnCode arg0) { - Toast.makeText(this, R.string.skyhook_error_registration, Toast.LENGTH_SHORT).show(); - return WPSContinuation.WPS_CONTINUE; - } - - @Override - public void handleSuccess() { - Toast.makeText(this, R.string.registered, Toast.LENGTH_SHORT).show(); - mSettings.edit().putBoolean(SettingsActivity.IS_REGISTERED, true).commit(); - } - /** * called when the note edit activity finishes (non-Javadoc) * @@ -187,12 +166,6 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli if (mSettings.getBoolean(SettingsActivity.IS_FIRST_BOOT, true)) new FirstBootDialog(this).show(); - if (!mSettings.getBoolean(SettingsActivity.IS_REGISTERED, false)) - new SkyHookRegistration(this).registerNewUser(this); - - // if(!this.getIntent().hasExtra(NO_SPLASH)) - // showSplashScreen(); - if (action != null) if (action.equals(ACTION_NEW_RINGER)) startActivityForResult(new Intent(this, RingerInformationActivity.class), ACTIVITY_CREATE); @@ -418,38 +391,8 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli final Intent intent = new Intent(); intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.new_ringer)); - final Parcelable iconResource = Intent.ShortcutIconResource.fromContext(this, R.drawable.icon); + final Parcelable iconResource = Intent.ShortcutIconResource.fromContext(this, R.drawable.ic_launcher); intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource); setResult(RESULT_OK, intent); } - - // /** - // * 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); - // } } \ No newline at end of file diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/RingerInformationActivity.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/RingerInformationActivity.java index 72f98a2..e1d3904 100644 --- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/RingerInformationActivity.java +++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/RingerInformationActivity.java @@ -190,7 +190,7 @@ public class RingerInformationActivity extends FragmentActivity implements OnCon save(); break; case android.R.id.home: - final Intent intent = new Intent(this, this.getClass()).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP).putExtra(ListActivity.NO_SPLASH, ListActivity.NO_SPLASH); + final Intent intent = new Intent(this, ListActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); return true; } diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SettingsActivity.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SettingsActivity.java index dd7b388..3bc0d03 100644 --- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SettingsActivity.java +++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SettingsActivity.java @@ -185,7 +185,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference public boolean onOptionsItemSelected(final MenuItem item) { switch (item.getItemId()) { case android.R.id.home: - final Intent intent = new Intent(this, ListActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP).putExtra(ListActivity.NO_SPLASH, ListActivity.NO_SPLASH); + final Intent intent = new Intent(this, ListActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); return true; } 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 9cb9e0d..f497187 100644 --- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/LocationInfomationFragment.java +++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/LocationInfomationFragment.java @@ -29,7 +29,7 @@ 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.SkyHook.SkyHook; +import com.TwentyCodes.android.location.AndroidGPS; import com.TwentyCodes.android.location.GeoPointLocationListener; import com.TwentyCodes.android.location.OnLocationSelectedListener; import com.TwentyCodes.android.overlays.RadiusOverlay; @@ -54,7 +54,7 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca private ToggleButton mMapEditToggle; private RadiusOverlay mRadiusOverlay; private GeoPoint mPoint; - private SkyHook mSkyHook; + private AndroidGPS mGPS; private View view; /** @@ -81,10 +81,13 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca if (mEnableScrollingListener != null) mEnableScrollingListener.setScrollEnabled(!isChecked); - if (isChecked) - mSkyHook.getUpdates(); - else - mSkyHook.removeUpdates(); + if (isChecked) { + mGPS.enableLocationUpdates(this); + mMap.enableGPSProgess(); + } else { + mGPS.disableLocationUpdates(); + mMap.disableGPSProgess(); + } mMap.setDoubleTapZoonEnabled(isChecked); // buttons @@ -123,8 +126,7 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { view = inflater.inflate(R.layout.map_info_fragment, container, false); - mSkyHook = new SkyHook(getActivity()); - mSkyHook.setLocationListener(this); + mGPS = new AndroidGPS(getActivity()); mMap = (MapFragment) getFragmentManager().findFragmentById(R.id.mapview); mRadius = (SeekBar) view.findViewById(R.id.radius); @@ -169,23 +171,22 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca */ @Override public void onFirstFix(final boolean isFirstFix) { - if (isFirstFix) - mMap.enableGPSProgess(); - else - mMap.disableGPSProgess(); - - 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 * current location */ - if (isFirstFix) + if (isFirstFix) { + mMap.disableGPSProgess(); if (mRadiusOverlay.getLocation() == null) if (mMap != null) { mMap.setMapCenter(mPoint); mMap.setZoom(mMap.getMap().getMaxZoomLevel() - 5); } + } + } else + mMap.enableGPSProgess(); } /** @@ -231,7 +232,7 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca */ @Override public void onPause() { - mSkyHook.removeUpdates(); + mGPS.disableLocationUpdates(); super.onPause(); } @@ -263,7 +264,7 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca @Override public void onResume() { if (mMapEditToggle.isChecked()) - mSkyHook.getUpdates(); + mGPS.enableLocationUpdates(this); super.onResume(); } @@ -291,7 +292,7 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca */ @Override public void onStop() { - mSkyHook.removeUpdates(); + mGPS.disableLocationUpdates(); super.onDestroy(); }