<commit_before>package com.parse.starter;

import java.util.ArrayList;
import java.util.List;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.parse.FindCallback;
import com.parse.ParseException;
import com.parse.ParseGeoPoint;
import com.parse.ParseObject;
import com.parse.ParseQuery;

import android.app.Activity;
import android.os.Bundle;

public class NearbyActivity extends Activity {
	// private variables
	private ParseGeoPoint currentLocation;
	private GPSTracker gps;
	private GoogleMap mMap;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.nearby);
		// gets a handle on the gmap
		mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
		// checks if the map is available
		setUpMapIfNeeded();
	}
	
	@Override
	public void onStart() {
		super.onStart();
		// checks if the map is available
		setUpMapIfNeeded();
		gps = new GPSTracker(this);
		// Get user location and adds entry when done.
		if (gps.canGetLocation) {
            currentLocation = new ParseGeoPoint(gps.getLatitude(), gps.getLongitude());
            findNearby(currentLocation, 2);
		} else {
			//throw exception
		}
	}
	
	@Override
	public void onStop() {
		super.onStart();
	}
	
	// finds nearby locations
	public void findNearby(final ParseGeoPoint currentLocation, int radius) {
		// creates a query and gives it a distance condition
		ParseQuery<ParseObject> query = ParseQuery.getQuery("Entry");
		query.whereWithinMiles("Location", currentLocation, radius);
		query.findInBackground(new FindCallback<ParseObject>() {
	        public void done(List<ParseObject> objects, ParseException e) {
	            if (e == null) {
	            	// updates the objects list to be sorted by proximity to user
	            	objects = sortPoints(objects, currentLocation);
	            	
	            	
	            } else {
	                //throw exception
	            }
	        }
		});
	}
	<commit_msg>finished markers on map in near me<commit_after>package com.parse.starter;

import java.util.ArrayList;
import java.util.List;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMapOptions;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.parse.FindCallback;
import com.parse.ParseException;
import com.parse.ParseGeoPoint;
import com.parse.ParseObject;
import com.parse.ParseQuery;

import android.app.Activity;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.util.Log;

public class NearbyActivity extends Activity {
	// private variables
	private LatLng user;
	private GPSTracker gps;
	private GoogleMap mMap;
	private GoogleMapOptions options = new GoogleMapOptions();
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.nearby);
		// makes a gps object, this makes geo functionality easier
		gps = new GPSTracker(this);
		// gets the user's location
		user = new LatLng(gps.getLatitude(), gps.getLongitude());
		
		// gets a handle on the map by id
		mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
		// adds a marker at the user's location
		mMap.addMarker(new MarkerOptions().position(user).title("You"));
		/* sets the options for the map in order of cameraposition, zoomlevel, tilt, bearing
		options.mapType(GoogleMap.MAP_TYPE_NORMAL).camera(new CameraPosition(user, 19, 0, 0))
												  .zoomControlsEnabled(false).zoomGesturesEnabled(true).scrollGesturesEnabled(true);
		// initializes the map with the options above
		FragmentTransaction ft = getFragmentManager().beginTransaction();
		// Replace the container with the new fragment
		ft.add(R.id.map, MapFragment.newInstance(options));
		// Execute the changes specified
		ft.commit();*/
		
		// checks if the map is available
		setUpMapIfNeeded();
		findNearby(new ParseGeoPoint(gps.getLatitude(), gps.getLongitude()), 2);
		System.out.println(gps.getLatitude() + "   " + gps.getLongitude());
	}
	
	@Override
	public void onStart() {
		super.onStart();
		// clears the map
		mMap.clear();
		// checks if the map is available
		setUpMapIfNeeded();
		// adds a marker
		mMap.addMarker(new MarkerOptions().position(user).title("You"));
		// Get user location and adds entry when done
        findNearby(new ParseGeoPoint(gps.getLatitude(), gps.getLongitude()), 2);
	}
	
	@Override
	public void onStop() {
		super.onStart();
	}
	
	// finds nearby locations
	public void findNearby(final ParseGeoPoint currentLocation, int radius) {
		// creates a query and gives it a distance condition
		ParseQuery<ParseObject> query = ParseQuery.getQuery("Entry");
		query.whereWithinMiles("Location", currentLocation, radius);
		query.findInBackground(new FindCallback<ParseObject>() {
	        public void done(List<ParseObject> objects, ParseException e) {
	            //if (e == null) {
	            	// updates the objects list to be sorted by proximity to user
	            	//objects = sortPoints(objects, currentLocation);
	            	// iterates through the objects and puts markers on the map
	            	for(int i = 0; i < objects.size(); i++) {
	            		ParseGeoPoint point = (ParseGeoPoint)(objects.get(i).get("Location"));
	            		LatLng location = new LatLng(point.getLatitude(), point.getLongitude());
	            		mMap.addMarker(new MarkerOptions().position(location).icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_VIOLET)));
	            	}
	            /*} else {
	                //throw exception
	            }*/
	        }
		});
	}
	
{'fraction_non_alphanumeric': 0.10823608997124978, 'fraction_numerical': 0.0013529511246406223, 'mean_word_length': 3.542242703533026, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4660230', 'n_tokens_mistral': 1867, 'n_tokens_neox': 1714, 'n_words': 440}