Import to intelij, started updating to use maps v2

This commit is contained in:
2014-08-30 11:29:50 -04:00
parent 8cc52de5f6
commit bf157e9008
18 changed files with 313 additions and 139 deletions

View File

@@ -3,6 +3,7 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View File

@@ -2,10 +2,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.RickBarrette.android.LocationRinger"
android:installLocation="internalOnly"
android:versionCode="236"
android:versionName="ff72f9d" >
android:versionCode="248"
android:versionName="8cc52de" >
<uses-sdk android:minSdkVersion="8" />
<uses-sdk android:minSdkVersion="11" />
<uses-feature
android:name="android.hardware.location"
@@ -42,9 +42,6 @@
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Custom" >
<uses-library
android:name="com.google.android.maps"
android:required="true" />
<activity
android:name=".ui.ListActivity"
@@ -60,8 +57,6 @@
</intent-filter>
</activity>
<uses-library android:name="com.google.android.maps" />
<activity
android:name=".ui.RingerInformationActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize" />
@@ -140,6 +135,26 @@
<action android:name="android.bluetooth.device.action.ACL_DISCONNECTED"/>
</intent-filter>
</receiver>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<!--
Maps V1
ricky beta release 0rKmsWMM0D-IRAEgcSZEqwZCs_8AUwxjYjj0bnA
ricky 0rKmsWMM0D-LWOndcfwrmW-S0OXlnQl2SJCMeTg
TWENTYCODES 0rKmsWMM0D-K15bEM_kwabPbNhsn4dp4rcq2q5Q
-->
<!--
Maps v2
Debug AIzaSyCSqR3sQvE957QUuSfrIgLdhmneB__ljXQ
-->
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyCSqR3sQvE957QUuSfrIgLdhmneB__ljXQ"/>
</application>
</manifest>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="EclipseModuleManager" forced_jdk="true">
<conelement value="com.android.ide.eclipse.adt.DEPENDENCIES" />
<src_description expected_position="1">
<src_folder value="file://$MODULE_DIR$/src" expected_position="0" />
<src_folder value="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK" expected_position="1" />
<src_folder value="file://$MODULE_DIR$/gen" expected_position="2" />
<src_folder value="com.android.ide.eclipse.adt.LIBRARIES" expected_position="3" />
</src_description>
</component>
<component name="FacetManager">
<facet type="android" name="Android">
<configuration>
<option name="UPDATE_PROPERTY_FILES" value="true" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/bin/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$" type="java-resource" />
</content>
<orderEntry type="jdk" jdkName="Android 4.3 Google APIs" jdkType="Android SDK" />
<orderEntry type="module" module-name="ExceptionHandlerLib" />
<orderEntry type="module" module-name="LocationLib" />
<orderEntry type="module" module-name="google-play-services_lib" />
<orderEntry type="library" name="google-play-services" level="project" />
<orderEntry type="library" name="android-support-v13" level="project" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

Binary file not shown.

View File

@@ -7,9 +7,10 @@
# "ant.properties", and override values to adapt the script to your
# project structure.
android.library.reference.1=../exception_handler_library/ExceptionHandlerLib
android.library.reference.2=../location_library/LocationLib
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard.cfg
# Project target.
target=Google Inc.:Google APIs:17
target=Google Inc.:Google APIs:18
android.library.reference.1=../exception_handler_library/ExceptionHandlerLib
android.library.reference.2=../location_library/LocationLib
android.library.reference.3=../google-play-services_lib

View File

@@ -296,7 +296,7 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
@Override
public void onItemClick(final AdapterView<?> arg0, final View v, final int postion, final long id) {
final ProgressDialog progress = ProgressDialog.show(this, "", getText(R.string.loading), true, true);
final ProgressDialog progress = null; //ProgressDialog.show(this.getParent(), "", getText(R.string.loading), true, true);
new Thread(new Runnable() {
@Override

View File

@@ -67,7 +67,6 @@ public class RingerInformationActivity extends FragmentActivity implements OnCon
/**
* Called when the activity is first created (non-Javadoc)
*
* @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle)
*/
@SuppressLint("NewApi")
@Override

View File

@@ -6,13 +6,6 @@
*/
package org.RickBarrette.android.LocationRinger.ui.fragments;
import java.util.Map.Entry;
import org.RickBarrette.android.LocationRinger.Log;
import org.RickBarrette.android.LocationRinger.OnContentChangedListener;
import org.RickBarrette.android.LocationRinger.R;
import org.RickBarrette.android.LocationRinger.db.RingerDatabase;
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.Context;
@@ -28,6 +21,12 @@ import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.ToggleButton;
import org.RickBarrette.android.LocationRinger.Log;
import org.RickBarrette.android.LocationRinger.OnContentChangedListener;
import org.RickBarrette.android.LocationRinger.R;
import org.RickBarrette.android.LocationRinger.db.RingerDatabase;
import java.util.Map.Entry;
/**
* This fragment will used to allow the user to enter/edit ringer information

View File

@@ -6,17 +6,16 @@
*/
package org.RickBarrette.android.LocationRinger.ui.fragments;
import org.RickBarrette.android.LocationRinger.FeatureRemovedListener;
import org.RickBarrette.android.LocationRinger.R;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import org.RickBarrette.android.LocationRinger.FeatureRemovedListener;
import org.RickBarrette.android.LocationRinger.R;
/**
* This is a simple extention of a fragment that will allow for storage of an id

View File

@@ -111,7 +111,7 @@ public abstract class BaseFragmentListFragment extends Fragment {
/**
* (non-Javadoc)
*
*
* @see android.support.v4.app.Fragment#onActivityResult(int, int,
* android.content.Intent)
*/
@@ -124,7 +124,7 @@ public abstract class BaseFragmentListFragment extends Fragment {
/**
* (non-Javadoc)
*
*
* @see android.support.v4.app.ListFragment#onCreateView(android.view.LayoutInflater,
* android.view.ViewGroup, android.os.Bundle)
*/

View File

@@ -6,13 +6,6 @@
*/
package org.RickBarrette.android.LocationRinger.ui.fragments;
import java.util.ArrayList;
import org.RickBarrette.android.LocationRinger.FeatureRemovedListener;
import org.RickBarrette.android.LocationRinger.OnContentChangedListener;
import org.RickBarrette.android.LocationRinger.R;
import org.RickBarrette.android.LocationRinger.db.RingerDatabase;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.ContentValues;
@@ -27,6 +20,12 @@ import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import org.RickBarrette.android.LocationRinger.FeatureRemovedListener;
import org.RickBarrette.android.LocationRinger.OnContentChangedListener;
import org.RickBarrette.android.LocationRinger.R;
import org.RickBarrette.android.LocationRinger.db.RingerDatabase;
import java.util.ArrayList;
/**
* This fragment will be used to display a list of features
@@ -48,7 +47,7 @@ public class FeatureListFragment extends BaseFragmentListFragment implements OnC
private final ArrayList<Integer> mAdded;
/**
* Creates a new empty feature list fragment
* Creates a new .gitkeep feature list fragment
*
* @param info
* @param listener
@@ -228,7 +227,7 @@ public class FeatureListFragment extends BaseFragmentListFragment implements OnC
/**
* Called when the activity is first created (non-Javadoc)
*
*
* @see android.support.v4.app.Fragment#onCreate(android.os.Bundle)
*/
@Override
@@ -252,7 +251,7 @@ public class FeatureListFragment extends BaseFragmentListFragment implements OnC
/**
* Called when a fragment needs to be removed (non-Javadoc)
*
*
* @see org.RickBarrette.android.LocationRinger.FeatureRemovedListener#onFeatureRemoved(android.support.v4.app.Fragment)
*/
@Override

View File

@@ -6,15 +6,6 @@
*/
package org.RickBarrette.android.LocationRinger.ui.fragments;
import org.RickBarrette.android.LocationRinger.Constraints;
import org.RickBarrette.android.LocationRinger.EnableScrollingListener;
import org.RickBarrette.android.LocationRinger.Log;
import org.RickBarrette.android.LocationRinger.OnContentChangedListener;
import org.RickBarrette.android.LocationRinger.R;
import org.RickBarrette.android.LocationRinger.SearchRequestedListener;
import org.RickBarrette.android.LocationRinger.db.RingerDatabase;
import org.RickBarrette.android.LocationRinger.ui.SearchDialog;
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.os.Bundle;
@@ -23,20 +14,21 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.*;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ToggleButton;
import com.TwentyCodes.android.location.AndroidGPS;
import com.TwentyCodes.android.location.GeoPointLocationListener;
import com.TwentyCodes.android.location.GeoUtils;
import com.TwentyCodes.android.location.LatLngListener;
import com.TwentyCodes.android.location.OnLocationSelectedListener;
import com.TwentyCodes.android.overlays.RadiusOverlay;
import com.google.android.maps.GeoPoint;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
import org.RickBarrette.android.LocationRinger.*;
import org.RickBarrette.android.LocationRinger.db.RingerDatabase;
import org.RickBarrette.android.LocationRinger.ui.SearchDialog;
/**
* This fragment will be used to display and allow the user to edit the ringers
@@ -45,7 +37,7 @@ import com.google.android.maps.GeoPoint;
* @author ricky
*/
@SuppressLint("ValidFragment")
public class LocationInfomationFragment extends Fragment implements GeoPointLocationListener, OnClickListener, OnCheckedChangeListener, OnSeekBarChangeListener,
public class LocationInfomationFragment extends Fragment implements LatLngListener, OnClickListener, OnCheckedChangeListener, OnSeekBarChangeListener,
OnLocationSelectedListener, SearchRequestedListener {
private static final String TAG = "RingerInformationHowActivity";
@@ -56,7 +48,7 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca
private MapFragment mMap;
private ToggleButton mMapEditToggle;
private RadiusOverlay mRadiusOverlay;
private GeoPoint mPoint;
private LatLng mPoint;
private AndroidGPS mGPS;
private View view;
private TextView mRadiusTextView;
@@ -65,7 +57,6 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca
* Creates a new MapFragment
*
* @author ricky barrette
* @param ringerInformationActivity
*/
public LocationInfomationFragment(final ContentValues info, final OnContentChangedListener listener, final EnableScrollingListener enabledListener) {
mInfo = info;
@@ -85,18 +76,18 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca
if (mEnableScrollingListener != null)
mEnableScrollingListener.setScrollEnabled(!isChecked);
if (isChecked) {
mGPS.enableLocationUpdates(this);
mMap.enableGPSProgess();
} else {
mGPS.disableLocationUpdates();
mMap.disableGPSProgess();
}
mMap.setDoubleTapZoonEnabled(isChecked);
// buttons
mMap.setBuiltInZoomControls(isChecked);
mMap.setClickable(isChecked);
// /*if (isChecked) {
// mGPS.enableLocationUpdates(this);
// mMap.enableGPSProgess();
// } else {
// mGPS.disableLocationUpdates();
// mMap.disableGPSProgess();
// }
//
// mMap.setDoubleTapZoonEnabled(isChecked);
// // buttons
// mMap.setBuiltInZoomControls(isChecked);
// mMap.setClickable(isChecked);*/
mRadius.setEnabled(isChecked);
Toast.makeText(getActivity(), isChecked ? getString(R.string.map_editing_enabled) : getString(R.string.map_editiing_disabled), Toast.LENGTH_SHORT).show();
}
@@ -115,10 +106,10 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca
break;
case R.id.my_location:
if (mPoint != null)
mMap.setMapCenter(mPoint);
mMap.getMap().moveCamera(CameraUpdateFactory.newLatLng(mPoint));
break;
case R.id.map_mode:
mMap.setSatellite(mMap.isSatellite() ? false : true);
mMap.getMap().setMapType(mMap.getMap().getMapType() == GoogleMap.MAP_TYPE_NORMAL ? GoogleMap.MAP_TYPE_NORMAL : GoogleMap.MAP_TYPE_SATELLITE);
break;
case R.id.search:
new SearchDialog(getActivity(), this).show();
@@ -132,34 +123,39 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca
mGPS = new AndroidGPS(getActivity());
mMap = (MapFragment) getFragmentManager().findFragmentById(R.id.mapview);
// mMap = (MapFragment) getFragmentManager().findFragmentById(R.id.mapview);
mRadius = (SeekBar) view.findViewById(R.id.radius);
mRadiusTextView = (TextView) view.findViewById(R.id.radius_textview);
mRadius.setMax(Constraints.MAX_RADIUS_IN_METERS);
mMap.setClickable(false);
//TODO extend GoogleMap to intercept clicks
// mMap.setClickable(false);
mMapEditToggle = (ToggleButton) view.findViewById(R.id.map_edit_toggle);
mMapEditToggle.setChecked(false);
mMapEditToggle.setOnCheckedChangeListener(this);
mRadiusOverlay = new RadiusOverlay();
mRadiusOverlay.setLocationSelectedListener(this);
mRadius.setOnSeekBarChangeListener(this);
mMap.addOverlay(mRadiusOverlay);
mMap.getMap().addCircle(mRadiusOverlay.getCircleOptions());
mRadius.setEnabled(false);
if (mInfo.get(RingerDatabase.KEY_LOCATION) != null) {
final String[] point = mInfo.getAsString(RingerDatabase.KEY_LOCATION).split(",");
mRadiusOverlay.setLocation(new GeoPoint(Integer.parseInt(point[0]), Integer.parseInt(point[1])));
mRadiusOverlay.setLocation(new LatLng(Integer.parseInt(point[0]), Integer.parseInt(point[1])));
}
if (mInfo.get(RingerDatabase.KEY_RADIUS) != null)
mRadius.setProgress(mInfo.getAsInteger(RingerDatabase.KEY_RADIUS));
if (mRadiusOverlay.getLocation() != null) {
mMap.setMapCenter(mRadiusOverlay.getLocation());
mMap.setZoom(16);
mMap.getMap().moveCamera(CameraUpdateFactory.newLatLng(mRadiusOverlay.getLocation()));
//todo zoom
// mMap.setZoom(16);
}
mMap.setDoubleTapZoonEnabled(false);
//
// mMap.setDoubleTapZoonEnabled(false);
view.findViewById(R.id.my_location).setOnClickListener(this);
view.findViewById(R.id.mark_my_location).setOnClickListener(this);
@@ -171,27 +167,29 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca
/**
* Called when the location is a first fix (non-Javadoc)
*
* todo fix this
*
* @see com.TwentyCodes.android.location.GeoPointLocationListener#onFirstFix(boolean)
* @see com.TwentyCodes.android.location.LatLngListener#onFirstFix(boolean)
*/
@Override
public void onFirstFix(final boolean isFirstFix) {
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) {
mMap.disableGPSProgess();
if (mRadiusOverlay.getLocation() == null)
if (mMap != null) {
mMap.setMapCenter(mPoint);
mMap.setZoom(mMap.getMap().getMaxZoomLevel() - 5);
}
}
} else
mMap.enableGPSProgess();
// 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) {
// mMap.disableGPSProgess();
// if (mRadiusOverlay.getLocation() == null)
// if (mMap != null) {
// mMap.setMapCenter(mPoint);
// mMap.setZoom(mMap.getMap().getMaxZoomLevel() - 5);
// }
// }
// } else
// mMap.enableGPSProgess();
}
/**
@@ -200,17 +198,17 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca
* @author ricky barrette
*/
@Override
public void onLocationChanged(final GeoPoint point, final int accuracy) {
public void onLocationChanged(final LatLng point, final int accuracy) {
mPoint = point;
}
/**
* Called when a location has been selected (non-Javadoc)
*
* @see com.TwentyCodes.android.location.OnLocationSelectedListener#onLocationSelected(com.google.android.maps.GeoPoint)
// * @see com.TwentyCodes.android.location.OnLocationSelectedListener#onLocationSelected(com.google.android.maps.GeoPoint)
*/
@Override
public void onLocationSelected(final GeoPoint point) {
public void onLocationSelected(final LatLng point) {
if (point != null) {
Log.d(TAG, "onLocationSelected() " + point.toString());
@@ -218,7 +216,7 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca
mRadiusOverlay.setLocation(point);
if (mMap != null)
mMap.setMapCenter(point);
mMap.getMap().moveCamera(CameraUpdateFactory.newLatLng(point));
if (mListener != null) {
final ContentValues info = new ContentValues();
@@ -232,7 +230,6 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca
/**
* (non-Javadoc)
*
* @see android.support.v4.app.Fragment#onPause()
*/
@Override
public void onPause() {
@@ -251,7 +248,8 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca
case R.id.radius:
mRadiusTextView.setText(GeoUtils.distanceToString(Float.valueOf(progress) / 1000, true));
mRadiusOverlay.setRadius(progress);
mMap.invalidate();
//todo invalidate this shit
// mMap.invalidate();
if (mListener != null) {
final ContentValues info = new ContentValues();
info.put(RingerDatabase.KEY_RADIUS, progress);
@@ -264,7 +262,6 @@ public class LocationInfomationFragment extends Fragment implements GeoPointLoca
/**
* (non-Javadoc)
*
* @see android.support.v4.app.Fragment#onResume()
*/
@Override
public void onResume() {

View File

@@ -1,36 +0,0 @@
/**
* MapFragment.java
* @date May 12, 2012
* @author ricky barrette
* @author Twenty Codes, LLC
*/
package org.RickBarrette.android.LocationRinger.ui.fragments;
import com.TwentyCodes.android.fragments.BaseMapFragment;
import com.TwentyCodes.android.location.MapView;
/**
* @author ricky barrette
*/
public class MapFragment extends BaseMapFragment {
/**
*
* @author ricky barrette
*/
public MapFragment() {
// TODO Auto-generated constructor stub
}
/**
* (non-Javadoc)
*
* @see com.TwentyCodes.android.fragments.BaseMapFragment#onMapViewCreate(com.TwentyCodes.android.location.MapView)
*/
@Override
public void onMapViewCreate(final MapView map) {
// TODO Auto-generated method stub
}
}