Skip to content
This repository
Browse code

here is the todo list for the summer

  • Loading branch information...
commit 33cdef2842ba3c3fa8b7843d703858aa98d93dc9 1 parent fb6ec15
Caleb Gomer authored April 28, 2012
BIN  bin/TimeCapsule.apk
Binary file not shown
BIN  bin/classes.dex
Binary file not shown
BIN  bin/classes/com/gvsu/socnet/map/CapsuleActivity$1.class
Binary file not shown
BIN  bin/classes/com/gvsu/socnet/map/CapsuleActivity$2.class
Binary file not shown
BIN  bin/classes/com/gvsu/socnet/map/CapsuleActivity$3.class
Binary file not shown
BIN  bin/classes/com/gvsu/socnet/map/CapsuleActivity$4.class
Binary file not shown
BIN  bin/classes/com/gvsu/socnet/map/CapsuleActivity$5.class
Binary file not shown
BIN  bin/classes/com/gvsu/socnet/map/CapsuleActivity.class
Binary file not shown
BIN  bin/classes/com/gvsu/socnet/map/CapsuleMapActivity$1.class
Binary file not shown
BIN  bin/classes/com/gvsu/socnet/map/CapsuleMapActivity$2.class
Binary file not shown
BIN  bin/classes/com/gvsu/socnet/map/CapsuleMapActivity.class
Binary file not shown
BIN  bin/classes/com/gvsu/socnet/user/LoginActivity.class
Binary file not shown
BIN  bin/resources.ap_
Binary file not shown
89  src/com/gvsu/socnet/map/CapsuleActivity.java
@@ -25,7 +25,8 @@
25 25
 import com.gvsu.socnet.user.SettingsActivity;
26 26
 import com.gvsu.socnet.views.NavigationMenu;
27 27
 
28  
-public class CapsuleActivity extends NavigationMenu implements OnClickListener
  28
+public class CapsuleActivity extends NavigationMenu implements
  29
+    OnClickListener
29 30
 {
30 31
 
31 32
 	/** String YOUTUBE */
@@ -34,6 +35,8 @@
34 35
 	/** String TAB */
35 36
 	private final String TAB = "\t";
36 37
 
  38
+	private String creatorID;
  39
+
37 40
 	@Override
38 41
 	public void onCreate(Bundle savedInstanceState)
39 42
 	{
@@ -44,7 +47,9 @@ public void onCreate(Bundle savedInstanceState)
44 47
 
45 48
 		refresh();
46 49
 
47  
-		this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
  50
+		this.getWindow()
  51
+		    .setSoftInputMode(
  52
+		        WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
48 53
 	}
49 54
 
50 55
 	/****************************************************************
@@ -56,6 +61,7 @@ protected void refresh()
56 61
 	{
57 62
 		Intent intent = this.getIntent();
58 63
 		final String cId = intent.getStringExtra("cID");
  64
+		Log.d("debug", "capid=" + cId);
59 65
 		setCapsuleInfo(cId);
60 66
 		setComments(cId);
61 67
 		setupAddComments(cId);
@@ -74,7 +80,8 @@ public void onClick(View v)
74 80
 		{
75 81
 		case R.id.play_button:
76 82
 			Log.println(3, "debug", "playButtonClicked");
77  
-			startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(YOUTUBE + "RCUBxgdKZ_Y")));
  83
+			startActivity(new Intent(Intent.ACTION_VIEW,
  84
+			    Uri.parse(YOUTUBE + "RCUBxgdKZ_Y")));
78 85
 			break;
79 86
 		default:
80 87
 			super.onClick(v);
@@ -88,16 +95,20 @@ private void setCapsuleInfo(String capsuleId)
88 95
 
89 96
 		TextView title = (TextView) findViewById(R.id.capsule_title);
90 97
 		TextView description = (TextView) findViewById(R.id.description);
  98
+		TextView creator = (TextView) findViewById(R.id.capsule_creator);
91 99
 		TextView leftOn = (TextView) findViewById(R.id.left_on);
92 100
 		RatingBar rating = (RatingBar) findViewById(R.id.capsule_rating_bar);
93 101
 
94 102
 		// TODO make this increment the number of view on the server
95  
-		String[] capsuleInfo = Server.getCapsule(capsuleId).split(TAB);
  103
+		String strCapInfo = Server.getCapsule(capsuleId);
  104
+		String[] capsuleInfo = strCapInfo.split(TAB);
  105
+		Log.d("debug", "capsuleinfo: " + strCapInfo);
96 106
 		title.setText(capsuleInfo[0]);
97 107
 		description.setText(capsuleInfo[3]);
98 108
 
99 109
 		// gets the date capsule was left
100  
-		leftOn.setText("Left on " + capsuleInfo[4].split(" ")[0] + " at " + capsuleInfo[4].split(" ")[1]);
  110
+		leftOn.setText("Left on " + capsuleInfo[4].split(" ")[0]
  111
+		    + " at " + capsuleInfo[4].split(" ")[1]);
101 112
 
102 113
 		String strRating = Server.getRating(capsuleId);
103 114
 		if (!strRating.equals(""))
@@ -108,6 +119,18 @@ private void setCapsuleInfo(String capsuleId)
108 119
 		{
109 120
 			rating.setRating(0);
110 121
 		}
  122
+		creatorID = capsuleInfo[5];
  123
+		creator.setText(capsuleInfo[6]);
  124
+		creator.setOnClickListener(new OnClickListener()
  125
+		{
  126
+
  127
+			public void onClick(View v)
  128
+			{
  129
+				Toast.makeText(getApplicationContext(),
  130
+				    "User Id= " + creatorID, Toast.LENGTH_SHORT)
  131
+				    .show();
  132
+			}
  133
+		});
111 134
 	}
112 135
 
113 136
 	private void setComments(final String capsuleId)
@@ -116,7 +139,8 @@ private void setComments(final String capsuleId)
116 139
 		commentList.removeAllViews();
117 140
 		String commentsFromServer = Server.getComments(capsuleId);
118 141
 
119  
-		Log.d("debug", "Comments on capsule number " + capsuleId + "\n" + commentsFromServer);
  142
+		Log.d("debug", "Comments on capsule number " + capsuleId
  143
+		    + "\n" + commentsFromServer);
120 144
 		String[] strArrayComments = commentsFromServer.split("\n");
121 145
 		if (!strArrayComments[0].equals(""))
122 146
 		{
@@ -125,11 +149,13 @@ private void setComments(final String capsuleId)
125 149
 				if (!s.equals(""))
126 150
 				{
127 151
 					String[] strArrayComment = s.split("\t");
128  
-					String[] strArrayUser = Server.getUser(strArrayComment[0]).split("\t");
  152
+					String[] strArrayUser = Server.getUser(
  153
+					    strArrayComment[0]).split("\t");
129 154
 					TextView t = new TextView(this);
130 155
 					String user = strArrayUser[8];
131 156
 					t.setId(Integer.parseInt(strArrayComment[0]));
132  
-					t.setText(new Comment(user, strArrayComment[2], strArrayComment[1]).toString());
  157
+					t.setText(new Comment(user, strArrayComment[2],
  158
+					    strArrayComment[1]).toString());
133 159
 					t.setPadding(0, 10, 0, 0);
134 160
 					commentList.addView(t);
135 161
 				}
@@ -145,18 +171,22 @@ private void setComments(final String capsuleId)
145 171
 	//
146 172
 	private void setupAddComments(final String capsuleId)
147 173
 	{
148  
-		((Button) findViewById(R.id.button_add_comment)).setOnClickListener(new OnClickListener()
149  
-		{
150  
-
151  
-			@Override
152  
-			public void onClick(View v)
153  
-			{
154  
-				EditText newComment = (EditText) findViewById(R.id.edit_text_new_comment);
155  
-				Server.addComment(getSharedPreferences("profile", 0).getString("player_id", "0"), capsuleId, fixSpaces(newComment.getText().toString()));
156  
-				newComment.setText("");
157  
-				refresh();
158  
-			}
159  
-		});
  174
+		((Button) findViewById(R.id.button_add_comment))
  175
+		    .setOnClickListener(new OnClickListener()
  176
+		    {
  177
+
  178
+			    @Override
  179
+			    public void onClick(View v)
  180
+			    {
  181
+				    EditText newComment = (EditText) findViewById(R.id.edit_text_new_comment);
  182
+				    Server.addComment(
  183
+				        getSharedPreferences("profile", 0).getString(
  184
+				            "player_id", "0"), capsuleId,
  185
+				        fixSpaces(newComment.getText().toString()));
  186
+				    newComment.setText("");
  187
+				    refresh();
  188
+			    }
  189
+		    });
160 190
 	}
161 191
 
162 192
 	private void setupAddRating(final String capsuleId)
@@ -167,7 +197,8 @@ private void setupAddRating(final String capsuleId)
167 197
 		final Button submitButton = ((Button) findViewById(R.id.capsule_rating_submit));
168 198
 		final Button cancelButton = ((Button) findViewById(R.id.capsule_rating_cancel));
169 199
 
170  
-		final float ratingBeforeUserMessedWithIt = ratingBar.getRating();
  200
+		final float ratingBeforeUserMessedWithIt = ratingBar
  201
+		    .getRating();
171 202
 
172 203
 		// listens for ratingbar to be changed
173 204
 		ratingBar.setOnTouchListener(new OnTouchListener()
@@ -189,9 +220,12 @@ public boolean onTouch(View v, MotionEvent event)
189 220
 			public void onClick(View v)
190 221
 			{
191 222
 				submitLayout.setVisibility(View.GONE);
192  
-				Server.addRating(getSharedPreferences("profile", 0).getString("player_id", "0"), capsuleId, Float.toString(ratingBar.getRating()));
  223
+				Server.addRating(getSharedPreferences("profile", 0)
  224
+				    .getString("player_id", "0"), capsuleId, Float
  225
+				    .toString(ratingBar.getRating()));
193 226
 				refresh();
194  
-				Toast.makeText(getApplicationContext(), "Rating Submitted", Toast.LENGTH_SHORT).show();
  227
+				Toast.makeText(getApplicationContext(),
  228
+				    "Rating Submitted", Toast.LENGTH_SHORT).show();
195 229
 			}
196 230
 		});
197 231
 		cancelButton.setOnClickListener(new OnClickListener()
@@ -209,7 +243,8 @@ public void onClick(View v)
209 243
 	@Override
210 244
 	protected boolean gotoMenu()
211 245
 	{
212  
-		Intent i = new Intent(getApplicationContext(), SettingsActivity.class);
  246
+		Intent i = new Intent(getApplicationContext(),
  247
+		    SettingsActivity.class);
213 248
 		startActivity(i);
214 249
 		return true;
215 250
 	}
@@ -217,7 +252,8 @@ protected boolean gotoMenu()
217 252
 	@Override
218 253
 	protected boolean gotoProfile()
219 254
 	{
220  
-		Intent myIntent = new Intent(getBaseContext(), ProfileActivity.class);
  255
+		Intent myIntent = new Intent(getBaseContext(),
  256
+		    ProfileActivity.class);
221 257
 		// TODO profile button from a capsule takes you to the user
222 258
 		// who left that capsule's profile
223 259
 		// myIntent.putExtra("player_id",
@@ -229,7 +265,8 @@ protected boolean gotoProfile()
229 265
 	@Override
230 266
 	protected boolean gotoMap()
231 267
 	{
232  
-		Intent myIntent = new Intent(getBaseContext(), CapsuleMapActivity.class);
  268
+		Intent myIntent = new Intent(getBaseContext(),
  269
+		    CapsuleMapActivity.class);
233 270
 		startActivity(myIntent);
234 271
 		finish();
235 272
 		return true;
214  src/com/gvsu/socnet/map/CapsuleMapActivity.java
@@ -40,7 +40,8 @@
40 40
  * @author Jeremy Dye
41 41
  *
42 42
  */
43  
-public class CapsuleMapActivity extends MapActivity implements LocationListener, OnClickListener
  43
+public class CapsuleMapActivity extends MapActivity implements
  44
+    LocationListener, OnClickListener
44 45
 {
45 46
 
46 47
 	List<Overlay> mapOverlays;
@@ -56,9 +57,10 @@
56 57
 	String lastRetrieve;
57 58
 	LocationManager locationManager;
58 59
 	Criteria crit;
59  
-	long lastTimeMapCentered, lastTimeRedrawn, timeBetweenUpdates = 5000, distBetweenUpdates = 5;
  60
+	long lastTimeMapCentered, lastTimeRedrawn,
  61
+	    timeBetweenUpdates = 5000, distBetweenUpdates = 5;
60 62
 	boolean warnedAboutDriving, forceRedraw, forceRecenter;
61  
-	
  63
+
62 64
 	@Override
63 65
 	public void onCreate(Bundle savedInstanceState)
64 66
 	{
@@ -75,12 +77,17 @@ public void onCreate(Bundle savedInstanceState)
75 77
 		mapView.setSatellite(true);
76 78
 
77 79
 		mapController = mapView.getController();
78  
-		locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
  80
+		locationManager = (LocationManager) this
  81
+		    .getSystemService(Context.LOCATION_SERVICE);
79 82
 		mapOverlays = mapView.getOverlays();
80  
-		capsuleInnerDrawable = this.getResources().getDrawable(R.drawable.ic_capsule_inner);
81  
-		capsuleOuterDrawable = this.getResources().getDrawable(R.drawable.ic_capsule_outer);
82  
-		innerCapsules = new CapsuleOverlays(capsuleInnerDrawable, this);
83  
-		outerCapsules = new CapsuleOverlays(capsuleOuterDrawable, this);
  83
+		capsuleInnerDrawable = this.getResources().getDrawable(
  84
+		    R.drawable.ic_capsule_inner);
  85
+		capsuleOuterDrawable = this.getResources().getDrawable(
  86
+		    R.drawable.ic_capsule_outer);
  87
+		innerCapsules = new CapsuleOverlays(capsuleInnerDrawable,
  88
+		    this);
  89
+		outerCapsules = new CapsuleOverlays(capsuleOuterDrawable,
  90
+		    this);
84 91
 		lastRetrieve = null;
85 92
 		lastTimeMapCentered = 0L;
86 93
 
@@ -94,28 +101,39 @@ public void onCreate(Bundle savedInstanceState)
94 101
 
95 102
 		user = new UserOverlay(toGeoPoint(userLocation), this);
96 103
 		mapOverlays.add(user);
97  
-//		userOverlay = new MyLocationOverlay(this, mapView);
98  
-//		mapOverlays.add(userOverlay);
99  
-//		userOverlay.enableCompass();
100  
-//        userOverlay.enableMyLocation();
  104
+		// userOverlay = new MyLocationOverlay(this, mapView);
  105
+		// mapOverlays.add(userOverlay);
  106
+		// userOverlay.enableCompass();
  107
+		// userOverlay.enableMyLocation();
101 108
 
102 109
 		/** Register header-footer buttons for clicks*/
103  
-		((Button) findViewById(R.id.map_settings_button)).setOnClickListener(this);
104  
-		((Button) findViewById(R.id.map_filter_button)).setOnClickListener(this);
105  
-		((Button) findViewById(R.id.map_capture_button)).setOnClickListener(this);
106  
-		((Button) findViewById(R.id.map_profile_button)).setOnClickListener(this);
107  
-		((Button) findViewById(R.id.map_map_button)).setOnClickListener(this);
108  
-		((ImageView) findViewById(R.id.map_center_map_button)).setOnClickListener(this);
109  
-		((ImageView) findViewById(R.id.map_zoom_in_button)).setOnClickListener(this);
110  
-		((ImageView) findViewById(R.id.map_zoom_out_button)).setOnClickListener(this);
111  
-//		((ImageView) findViewById(R.id.map_notsurewhattouseitfor_button)).setOnClickListener(this);
  110
+		((Button) findViewById(R.id.map_settings_button))
  111
+		    .setOnClickListener(this);
  112
+		((Button) findViewById(R.id.map_filter_button))
  113
+		    .setOnClickListener(this);
  114
+		((Button) findViewById(R.id.map_capture_button))
  115
+		    .setOnClickListener(this);
  116
+		((Button) findViewById(R.id.map_profile_button))
  117
+		    .setOnClickListener(this);
  118
+		((Button) findViewById(R.id.map_map_button))
  119
+		    .setOnClickListener(this);
  120
+		((ImageView) findViewById(R.id.map_center_map_button))
  121
+		    .setOnClickListener(this);
  122
+		((ImageView) findViewById(R.id.map_zoom_in_button))
  123
+		    .setOnClickListener(this);
  124
+		((ImageView) findViewById(R.id.map_zoom_out_button))
  125
+		    .setOnClickListener(this);
  126
+		// ((ImageView)
  127
+		// findViewById(R.id.map_notsurewhattouseitfor_button)).setOnClickListener(this);
112 128
 
113 129
 		// makes sure user is logged in otherwise kicks them to login
114 130
 		// screen
115  
-		if (getSharedPreferences("profile", 0).getString("player_id", "-1").equals("-1"))
  131
+		if (getSharedPreferences("profile", 0).getString("player_id",
  132
+		    "-1").equals("-1"))
116 133
 		{
117 134
 			finish();
118  
-			Intent i = new Intent(getApplicationContext(), LoginActivity.class);
  135
+			Intent i = new Intent(getApplicationContext(),
  136
+			    LoginActivity.class);
119 137
 			startActivity(i);
120 138
 		}
121 139
 
@@ -135,14 +153,17 @@ public void onResume()
135 153
 		warnedAboutDriving = false;
136 154
 		forceRedraw = true;
137 155
 		forceRecenter = true;
138  
-		
  156
+
139 157
 		/** setup follow user button icon **/
140  
-		if (PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getBoolean("follow_user", false))
  158
+		if (PreferenceManager.getDefaultSharedPreferences(
  159
+		    getApplicationContext()).getBoolean("follow_user", false))
141 160
 		{
142  
-			((ImageView) findViewById(R.id.map_center_map_button)).setImageResource(R.drawable.center_on_user);
  161
+			((ImageView) findViewById(R.id.map_center_map_button))
  162
+			    .setImageResource(R.drawable.center_on_user);
143 163
 		} else
144 164
 		{
145  
-			((ImageView) findViewById(R.id.map_center_map_button)).setImageResource(R.drawable.dont_center);
  165
+			((ImageView) findViewById(R.id.map_center_map_button))
  166
+			    .setImageResource(R.drawable.dont_center);
146 167
 		}
147 168
 		/**************************/
148 169
 		// Debug.stopMethodTracing();
@@ -167,8 +188,10 @@ public void onPause()
167 188
 	 ***************************************************************/
168 189
 	protected void requestLocationUpdates()
169 190
 	{
170  
-		locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
171  
-		locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
  191
+		locationManager.requestLocationUpdates(
  192
+		    LocationManager.NETWORK_PROVIDER, 0, 0, this);
  193
+		locationManager.requestLocationUpdates(
  194
+		    LocationManager.GPS_PROVIDER, 0, 0, this);
172 195
 	}
173 196
 
174 197
 	protected void stopLocationUpdates()
@@ -189,28 +212,36 @@ protected void retrieveCapsules()
189 212
 		String lat = Double.toString(userLocation.getLatitude());
190 213
 		String lng = Double.toString(userLocation.getLongitude());
191 214
 
192  
-		SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
  215
+		SharedPreferences prefs = PreferenceManager
  216
+		    .getDefaultSharedPreferences(getApplicationContext());
193 217
 		Calendar c = Calendar.getInstance();
194  
-		c.setTimeInMillis(prefs.getLong(FilterActivity.START_RANGE, 0L));
  218
+		c.setTimeInMillis(prefs.getLong(FilterActivity.START_RANGE,
  219
+		    0L));
195 220
 		String from = "";
196 221
 
197 222
 		if (c.getTimeInMillis() != 0L)
198 223
 		{
199  
-			from = c.get(Calendar.YEAR) + "/" + (c.get(Calendar.MONTH) + 1) + "/" + c.get(Calendar.DAY_OF_MONTH);
  224
+			from = c.get(Calendar.YEAR) + "/"
  225
+			    + (c.get(Calendar.MONTH) + 1) + "/"
  226
+			    + c.get(Calendar.DAY_OF_MONTH);
200 227
 		}
201 228
 
202 229
 		c.setTimeInMillis(prefs.getLong(FilterActivity.END_RANGE, 0L));
203 230
 		String to = "";
204 231
 		if (c.getTimeInMillis() != 0L)
205 232
 		{
206  
-			to = c.get(Calendar.YEAR) + "/" + (c.get(Calendar.MONTH) + 1) + "/" + c.get(Calendar.DAY_OF_MONTH);
  233
+			to = c.get(Calendar.YEAR) + "/"
  234
+			    + (c.get(Calendar.MONTH) + 1) + "/"
  235
+			    + c.get(Calendar.DAY_OF_MONTH);
207 236
 		}
208 237
 
209  
-		String minRating = (prefs.getFloat(FilterActivity.MIN_RATING, 0) + " ").substring(0, 1);
  238
+		String minRating = (prefs.getFloat(FilterActivity.MIN_RATING,
  239
+		    0) + " ").substring(0, 1);
210 240
 
211  
-		// TODO MERGE BOTH OF THESE INTO ONE
212  
-		final String retrieveInner = Server.getCapsules(lat, lng, "1", from, to, minRating);
213  
-		final String retrieveOuter = Server.getCapsules(lat, lng, "2", from, to, minRating);
  241
+		final String retrieveInner = Server.getCapsules(lat, lng,
  242
+		    "1", from, to, minRating);
  243
+		final String retrieveOuter = Server.getCapsules(lat, lng,
  244
+		    "2", from, to, minRating);
214 245
 		String retrieve = retrieveInner + retrieveOuter;
215 246
 
216 247
 		if (lastRetrieve != retrieve || lastRetrieve == null)
@@ -245,8 +276,9 @@ public void run()
245 276
 	 */
246 277
 	protected void parseAndDrawCapsules(String capsules, boolean inner)
247 278
 	{
248  
-		//TODO clean this up when we combine the inner/outer calls
249  
-		if (inner) {
  279
+		// TODO clean this up when we combine the inner/outer calls
  280
+		if (inner)
  281
+		{
250 282
 			innerCapsules.clear();
251 283
 			outerCapsules.clear();
252 284
 		}
@@ -267,26 +299,33 @@ protected void parseAndDrawCapsules(String capsules, boolean inner)
267 299
 						cID = Integer.parseInt(capsuleData[0]);
268 300
 					else
269 301
 						cID = -1;
270  
-					double latitude = Double.parseDouble(capsuleData[2]) * 1e6;
271  
-					double longitude = Double.parseDouble(capsuleData[3]) * 1e6;
  302
+					double latitude = Double
  303
+					    .parseDouble(capsuleData[2]) * 1e6;
  304
+					double longitude = Double
  305
+					    .parseDouble(capsuleData[3]) * 1e6;
272 306
 
273 307
 					int lat = (int) latitude;
274 308
 					int lng = (int) longitude;
275 309
 
276 310
 					GeoPoint point = new GeoPoint(lat, lng);
277  
-					CapsuleOverlayItem item = new CapsuleOverlayItem(point, null, null, cID);
278  
-					if(cID == -1) {
  311
+					CapsuleOverlayItem item = new CapsuleOverlayItem(
  312
+					    point, null, null, cID);
  313
+					if (cID == -1)
  314
+					{
279 315
 						outerCapsules.addOverlay(item);
280  
-					} else {
  316
+					} else
  317
+					{
281 318
 						innerCapsules.addOverlay(item);
282 319
 					}
283 320
 
284 321
 				} catch (NumberFormatException ex)
285 322
 				{
286  
-					System.out.println("Improper treasure format, encountered Number Format Exception.");
  323
+					Log.e("debug",
  324
+					    "Improper treasure format, encountered Number Format Exception.");
287 325
 				} catch (ArrayIndexOutOfBoundsException ex)
288 326
 				{
289  
-					System.out.println("Array Index out of Bounds, problem traversing array.");
  327
+					Log.e("debug",
  328
+					    "Array Index out of Bounds, problem traversing array.");
290 329
 				}
291 330
 			}
292 331
 		}
@@ -307,17 +346,21 @@ public void onLocationChanged(Location location)
307 346
 		/**************************/
308 347
 		// Debug.startMethodTracing("map_location_changed");
309 348
 		/**************************/
310  
-		
311  
-//		mapOverlays.remove(mapOverlays.indexOf(user));
312  
-//		user = new UserOverlay(toGeoPoint(location), location.getBearing(), this);
313  
-//		mapOverlays.add(user);
  349
+
  350
+		// mapOverlays.remove(mapOverlays.indexOf(user));
  351
+		// user = new UserOverlay(toGeoPoint(location),
  352
+		// location.getBearing(), this);
  353
+		// mapOverlays.add(user);
314 354
 
315 355
 		if (location.getSpeed() > 25 && !warnedAboutDriving)
316 356
 		{
317 357
 			warnedAboutDriving = true;
318  
-			Toast.makeText(this, "Caution: do not use this application while driving", Toast.LENGTH_LONG).show();
  358
+			Toast.makeText(this,
  359
+			    "Caution: do not use this application while driving",
  360
+			    Toast.LENGTH_LONG).show();
319 361
 		}
320 362
 
  363
+		Log.d("debug", "accuracy:" + location.getAccuracy());
321 364
 		// will not accept location without a good accuracy
322 365
 		if (location != null && location.getAccuracy() <= 500)
323 366
 		{
@@ -327,7 +370,11 @@ public void onLocationChanged(Location location)
327 370
 			 * 2) the user has moved more than 5
328 371
 			 * 3) meters, assuming a good level of accuracy haven't redrawn in the last 5 seconds
329 372
 			 */
330  
-			if (forceRedraw || (userLocation.distanceTo(location) > 5 && location.getAccuracy() <= 500 && Calendar.getInstance().getTimeInMillis() - lastTimeRedrawn > timeBetweenUpdates))
  373
+			if (forceRedraw
  374
+			    || (userLocation.distanceTo(location) > 5
  375
+			        && location.getAccuracy() <= 500 && Calendar
  376
+			        .getInstance().getTimeInMillis()
  377
+			        - lastTimeRedrawn > timeBetweenUpdates))
331 378
 			{
332 379
 				forceRedraw = false;
333 380
 				userLocation = location;
@@ -351,7 +398,10 @@ public void run()
351 398
 			 * the optional box in preferences of if their location
352 399
 			 * was just found and a recenter is forced
353 400
 			 */
354  
-			if (forceRecenter || PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getBoolean("follow_user", false))
  401
+			if (forceRecenter
  402
+			    || PreferenceManager.getDefaultSharedPreferences(
  403
+			        getApplicationContext()).getBoolean(
  404
+			        "follow_user", false))
355 405
 			{
356 406
 				forceRecenter = false;
357 407
 				centerMap(false);
@@ -373,7 +423,8 @@ public void onProviderEnabled(String provider)
373 423
 	}
374 424
 
375 425
 	@Override
376  
-	public void onStatusChanged(String provider, int status, Bundle extras)
  426
+	public void onStatusChanged(String provider, int status,
  427
+	    Bundle extras)
377 428
 	{
378 429
 	}
379 430
 
@@ -388,7 +439,9 @@ private void centerMap(boolean forceRefresh)
388 439
 		if (forceRefresh && userLocation != null)
389 440
 		{
390 441
 			mapController.animateTo(toGeoPoint(userLocation));
391  
-			PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putBoolean("follow_user", true).commit();
  442
+			PreferenceManager
  443
+			    .getDefaultSharedPreferences(getApplicationContext())
  444
+			    .edit().putBoolean("follow_user", true).commit();
392 445
 		}
393 446
 	}
394 447
 
@@ -412,34 +465,42 @@ public void onClick(View v)
412 465
 		switch (v.getId())
413 466
 		{
414 467
 		case R.id.map_settings_button:
415  
-			Intent i = new Intent(getApplicationContext(), SettingsActivity.class);
  468
+			Intent i = new Intent(getApplicationContext(),
  469
+			    SettingsActivity.class);
416 470
 			startActivity(i);
417 471
 			break;
418 472
 		case R.id.map_filter_button:
419  
-			Intent i1 = new Intent(getApplicationContext(), FilterActivity.class);
  473
+			Intent i1 = new Intent(getApplicationContext(),
  474
+			    FilterActivity.class);
420 475
 			startActivity(i1);
421 476
 			break;
422 477
 		case R.id.map_capture_button:
423  
-			Intent i2 = new Intent(getApplicationContext(), AddCapsuleActivity.class);
  478
+			Intent i2 = new Intent(getApplicationContext(),
  479
+			    AddCapsuleActivity.class);
424 480
 			startActivity(i2);
425 481
 			break;
426 482
 		case R.id.map_profile_button:
427  
-			Intent i3 = new Intent(getApplicationContext(), ProfileActivity.class);
  483
+			Intent i3 = new Intent(getApplicationContext(),
  484
+			    ProfileActivity.class);
428 485
 			startActivity(i3);
429 486
 			break;
430 487
 		case R.id.map_map_button:
431 488
 			if (mapView.isSatellite())
432 489
 			{
433 490
 				mapView.setSatellite(false);
434  
-				((Button) findViewById(R.id.map_map_button)).setBackgroundResource(R.drawable.ic_tab_map_grey);
  491
+				((Button) findViewById(R.id.map_map_button))
  492
+				    .setBackgroundResource(R.drawable.ic_tab_map_grey);
435 493
 			} else
436 494
 			{
437 495
 				mapView.setSatellite(true);
438  
-				((Button) findViewById(R.id.map_map_button)).setBackgroundResource(R.drawable.ic_tab_map_color);
  496
+				((Button) findViewById(R.id.map_map_button))
  497
+				    .setBackgroundResource(R.drawable.ic_tab_map_color);
439 498
 			}
440 499
 			break;
441 500
 		case R.id.map_center_map_button:
442  
-			if (!PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getBoolean("follow_user", false))
  501
+			if (!PreferenceManager.getDefaultSharedPreferences(
  502
+			    getApplicationContext()).getBoolean("follow_user",
  503
+			    false))
443 504
 			{
444 505
 				centerMap(true);
445 506
 				int zoomLvl = mapView.getZoomLevel();
@@ -451,18 +512,26 @@ public void onClick(View v)
451 512
 						mapController.zoomIn();
452 513
 					}
453 514
 				}
454  
-				Toast.makeText(getApplicationContext(), "Following", Toast.LENGTH_SHORT).show();
455  
-				((ImageView) findViewById(R.id.map_center_map_button)).setImageResource(R.drawable.center_on_user);
  515
+				Toast.makeText(getApplicationContext(), "Following",
  516
+				    Toast.LENGTH_SHORT).show();
  517
+				((ImageView) findViewById(R.id.map_center_map_button))
  518
+				    .setImageResource(R.drawable.center_on_user);
456 519
 
457 520
 			} else
458 521
 			{
459  
-				PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putBoolean("follow_user", false).commit();
460  
-				Toast.makeText(getApplicationContext(), "Not Following", Toast.LENGTH_SHORT).show();
461  
-				((ImageView) findViewById(R.id.map_center_map_button)).setImageResource(R.drawable.dont_center);
  522
+				PreferenceManager
  523
+				    .getDefaultSharedPreferences(
  524
+				        getApplicationContext()).edit()
  525
+				    .putBoolean("follow_user", false).commit();
  526
+				Toast.makeText(getApplicationContext(),
  527
+				    "Not Following", Toast.LENGTH_SHORT).show();
  528
+				((ImageView) findViewById(R.id.map_center_map_button))
  529
+				    .setImageResource(R.drawable.dont_center);
462 530
 			}
463 531
 			if (userLocation == null)
464 532
 			{
465  
-				Toast.makeText(this, "Waiting for GPS Location...", Toast.LENGTH_LONG).show();
  533
+				Toast.makeText(this, "Waiting for GPS Location...",
  534
+				    Toast.LENGTH_LONG).show();
466 535
 			}
467 536
 			break;
468 537
 		case R.id.map_zoom_in_button:
@@ -471,9 +540,9 @@ public void onClick(View v)
471 540
 		case R.id.map_zoom_out_button:
472 541
 			mapController.zoomOut();
473 542
 			break;
474  
-//		case R.id.map_notsurewhattouseitfor_button:
475  
-//			centerMap(true);
476  
-//			break;
  543
+		// case R.id.map_notsurewhattouseitfor_button:
  544
+		// centerMap(true);
  545
+		// break;
477 546
 		}
478 547
 
479 548
 	}
@@ -490,7 +559,8 @@ private GeoPoint toGeoPoint(Location location)
490 559
 	{
491 560
 		if (location != null)
492 561
 		{
493  
-			return new GeoPoint((int) (location.getLatitude() * 1e6), (int) (location.getLongitude() * 1e6));
  562
+			return new GeoPoint((int) (location.getLatitude() * 1e6),
  563
+			    (int) (location.getLongitude() * 1e6));
494 564
 		} else
495 565
 		{
496 566
 			return new GeoPoint(0, 0);
44  src/com/gvsu/socnet/user/LoginActivity.java
@@ -25,9 +25,22 @@
25 25
  * @author Caleb Gomer
26 26
  * @version 1.0
27 27
  ***************************************************************/
28  
-public class LoginActivity extends Activity implements OnClickListener {
29  
-
30  
-	public static final String PROFILE = "profile", PLAYER_ID = "player_id";
  28
+public class LoginActivity extends Activity implements
  29
+    OnClickListener {
  30
+	// TODO put login in a scroll view
  31
+	// TODO prevent server from getting/returning garbage
  32
+	// TODO Scaling radius based on number of capsules
  33
+	// parseAnd draw will stop at N capsules
  34
+	// TODO SUMMER LIST
  35
+	// TODO Polish up the user interface
  36
+	// everyone can be on the look out for a designer that could
  37
+	// possibly pretty up the app
  38
+	// TODO look for a small group to beta test it in the fall
  39
+	// TODO add pictures to the game maybe add a profile picture
  40
+	// (gravatar?)
  41
+
  42
+	public static final String PROFILE = "profile",
  43
+	    PLAYER_ID = "player_id";
31 44
 	public TextView loginResult, username, password, newUser;
32 45
 	public Button loginButton = null;
33 46
 
@@ -39,7 +52,7 @@ public void onCreate(Bundle savedInstanceState) {
39 52
 
40 53
 		SharedPreferences prefs = getSharedPreferences(PROFILE, 0);
41 54
 
42  
-		Log.d("debug", "id: "+prefs.getString(PLAYER_ID, "-1"));
  55
+		Log.d("debug", "id: " + prefs.getString(PLAYER_ID, "-1"));
43 56
 		if (!prefs.getString(PLAYER_ID, "-1").equals("-1")) {
44 57
 			finish();
45 58
 			gotoProfile();
@@ -58,7 +71,7 @@ public void onCreate(Bundle savedInstanceState) {
58 71
 		username.setHint("Username");
59 72
 		password.setHint("Password");
60 73
 	}
61  
-	
  74
+
62 75
 	public void onBackPressed() {
63 76
 		return;
64 77
 	}
@@ -76,22 +89,26 @@ public void onClick(View v) {
76 89
 			String strPassword = password.getText().toString();
77 90
 
78 91
 			if (strUsername.equals("") || strPassword.equals("")) {
79  
-				showDialog("Missing Information", "Please enter a username and password", this);
  92
+				showDialog("Missing Information",
  93
+				    "Please enter a username and password", this);
80 94
 				return;
81 95
 			}
82 96
 
83 97
 			String id = Server.login(strUsername, strPassword);
84 98
 			if (!id.equals("-1")) {
85  
-				getSharedPreferences(PROFILE, 0).edit().putString(PLAYER_ID, id).commit();
  99
+				getSharedPreferences(PROFILE, 0).edit()
  100
+				    .putString(PLAYER_ID, id).commit();
86 101
 				finish();
87 102
 				gotoProfile();
88 103
 			} else {
89  
-				showDialog("Nope...", "Your username or password are incorrect", this);
  104
+				showDialog("Nope...",
  105
+				    "Your username or password are incorrect", this);
90 106
 			}
91 107
 
92 108
 			break;
93 109
 		case R.id.button_new_user:
94  
-			Intent i = new Intent(getApplicationContext(), NewUserActivity.class);
  110
+			Intent i = new Intent(getApplicationContext(),
  111
+			    NewUserActivity.class);
95 112
 			startActivity(i);
96 113
 			finish();
97 114
 		}
@@ -109,9 +126,11 @@ public void showDialog(String title, String info, Context context) {
109 126
 		AlertDialog alertDialog;
110 127
 
111 128
 		LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
112  
-		View layout = inflater.inflate(R.layout.text_dialog, (ViewGroup) findViewById(R.id.layout_root));
  129
+		View layout = inflater.inflate(R.layout.text_dialog,
  130
+		    (ViewGroup) findViewById(R.id.layout_root));
113 131
 
114  
-		TextView text = (TextView) layout.findViewById(R.id.text_level);
  132
+		TextView text = (TextView) layout
  133
+		    .findViewById(R.id.text_level);
115 134
 		text.setText(info);
116 135
 
117 136
 		builder = new AlertDialog.Builder(context);
@@ -126,7 +145,8 @@ public void showDialog(String title, String info, Context context) {
126 145
 	 ***************************************************************/
127 146
 	public void gotoProfile() {
128 147
 
129  
-		Intent intent = new Intent(getBaseContext(), ProfileActivity.class);
  148
+		Intent intent = new Intent(getBaseContext(),
  149
+		    ProfileActivity.class);
130 150
 		startActivity(intent);
131 151
 		finish();
132 152
 	}

0 notes on commit 33cdef2

Please sign in to comment.
Something went wrong with that request. Please try again.