Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@ dependencies {
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'

//compile 'com.google.android.gms:play-services-appindexing:10.0.1'
compile 'com.google.firebase:firebase-appindexing:10.0.1'
}
13 changes: 11 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,28 @@
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity android:name=".MainActivity">
android:value="" />
<!--<meta-data-->
<!--android:name="com.google.android.gms.version"-->
<!--android:value="@integer/google_play_services_version" />-->
<activity android:name=".MainActivity"></activity>
<activity android:name=".SplashScreenActivity">
android:theme="@style/SplashScreenTheme">
android:theme="@style/SplashScreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".google_map.MapsActivity_Hakeem"></activity>
<activity android:name=".google_map.MapsActivity_Hakeem"></activity><!-- ATTENTION: This was auto-generated to add Google Play services to your project for
App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information. -->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import java.util.ArrayList;

import nyc.c4q.wesniemarcelin.resourcedapp.backend.CallBack;
import nyc.c4q.wesniemarcelin.resourcedapp.backend.ChildCareClient;


Expand All @@ -24,7 +25,7 @@
import nyc.c4q.wesniemarcelin.resourcedapp.fragments.ProfileFragment;
import nyc.c4q.wesniemarcelin.resourcedapp.fragments.WelcomeFragment;

public class MainActivity extends AppCompatActivity {
public class MainActivity extends AppCompatActivity implements CallBack {
private DrawerLayout mDrawer;
private Toolbar toolbar;
private NavigationView nvDrawer;
Expand All @@ -43,7 +44,7 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
childCareClient = new ChildCareClient();
childCareClient = new ChildCareClient(this);
data = childCareClient.getData();
// Set a Toolbar to replace the ActionBar.
toolbar = (Toolbar) findViewById(R.id.toolbar);
Expand Down Expand Up @@ -154,5 +155,10 @@ public void onConfigurationChanged(Configuration newConfig) {
// Pass any configuration change to the drawer toggles
drawerToggle.onConfigurationChanged(newConfig);
}

@Override
public void stuff(ArrayList<ArrayList<String>> data) {

}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package nyc.c4q.wesniemarcelin.resourcedapp.backend;

import java.util.ArrayList;

/**
* Created by hakeemsackes-bramble on 2/1/17.
*/

public interface CallBack {
void stuff(ArrayList<ArrayList<String>> data);
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public static void main(String[] args) {
}
private static final String TAG = "Connection result";
private static String BASE_URL = "https://data.cityofnewyork.us/";
private final CallBack cb;

public ArrayList<ArrayList<String>> getData() {
return data;
Expand All @@ -36,7 +37,8 @@ public void setData(ArrayList<ArrayList<String>> data) {
HAKEEM: I added the constructor so that inside we can call Jose's connectToServer method
this will be useful for getting the data we need in the main activity
*/
public ChildCareClient() {
public ChildCareClient(CallBack cb) {
this.cb = cb;
connectToServer(BASE_URL);
}
// private RecyclerView childCareRecyclerView;
Expand All @@ -52,11 +54,10 @@ public static void connectToServer(String baseUrl) {
public void onResponse(Call<ChildCareResponse> call, Response<ChildCareResponse> response) {

/*
HAKEEM: added an arraylist data field that will get populated here
* HAKEEM: added an arraylist data field that will get populated here
*/
data = response.body().getData();
System.out.println(data);
System.out.println("hahaha much mistake");
// cb.stuff(data);
// childCareAdapter = new ChildCareAdapter(response.body());
// childCareRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
// childCareRecyclerView.setAdapter(adapter);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package nyc.c4q.wesniemarcelin.resourcedapp.backend.places_gmaps;

/**
* Created by hakeemsackes-bramble on 2/4/17.
*/

public class PlaceResponse {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package nyc.c4q.wesniemarcelin.resourcedapp.backend.places_gmaps;

import retrofit2.Call;
import retrofit2.http.GET;

/**
* Created by hakeemsackes-bramble on 2/4/17.
*/

public interface PlaceService {
@GET("maps/api/place/textsearch/")
Call<PlaceResponse> getPlace();
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class HomeInstructionFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
mroot = inflater.inflate(R.layout.home_instructions, container, false);
next = (Button) mroot.findViewById(R.id.next_button3);
//next = (Button) mroot.findViewById(R.id.next_button3);

next.setOnClickListener(new View.OnClickListener() {
@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package nyc.c4q.wesniemarcelin.resourcedapp.fragments;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package nyc.c4q.wesniemarcelin.resourcedapp.google_map;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.EditText;

import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.OnMapReadyCallback;
Expand All @@ -12,10 +16,24 @@
import java.util.ArrayList;

import nyc.c4q.wesniemarcelin.resourcedapp.R;
import nyc.c4q.wesniemarcelin.resourcedapp.backend.places_gmaps.PlaceResponse;
import nyc.c4q.wesniemarcelin.resourcedapp.backend.places_gmaps.PlaceService;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

public class MapsActivity_Hakeem extends AppCompatActivity implements OnMapReadyCallback {
private ArrayList<ArrayList<String>> retrofitData;
private ArrayList<ArrayList<String>> dataToImplement;
private EditText radius;
private static final double ONEMILEINDEGREES = 1 / 69d;
private GoogleMap mapDisplayed;
private EditText address;
int PLACE_PICKER_REQUEST = 1;
private GoogleApiClient mGoogleApiClient;


@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -24,13 +42,19 @@ protected void onCreate(Bundle savedInstanceState) {
MapFragment mapFragment = (MapFragment) getFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);

radius = (EditText) findViewById(R.id.radius);
address = (EditText) findViewById(R.id.search_bar_gmap);
// ATTENTION: This "addApi(AppIndex.API)"was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
}

@Override
public void onMapReady(GoogleMap googleMap) {
mapDisplayed = googleMap;
mapMarker(mapDisplayed, dataToImplement);
}


void mapMarker(GoogleMap googleMap, ArrayList<ArrayList<String>> dataToMap) {
for (int i = 0; i < dataToMap.size(); i++) {
/*
Expand Down Expand Up @@ -61,4 +85,30 @@ private LatLng getLatLngFromRadius(String place) {
private double distanceFromPoint(LatLng a, LatLng b) {
return Math.sqrt(Math.pow(a.longitude - b.longitude, 2) + Math.pow(a.latitude - b.latitude, 2));
}

public void mapSearch(View v) {
dataToImplement = distanceSearch( new LatLng(0,0), Double.valueOf(radius.getText().toString()));
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);

}
private static void connectToServer(String baseUrl) {
Retrofit retrofit = new Retrofit.Builder().baseUrl(baseUrl).addConverterFactory(GsonConverterFactory.create()).build();
PlaceService service = retrofit.create(PlaceService.class);
Call<PlaceResponse> call = service.getPlace();
call.enqueue(new Callback<PlaceResponse>() {
@Override
public void onResponse(Call<PlaceResponse> call, Response<PlaceResponse> response) {
// data = response.body();
}
@Override
public void onFailure(Call<PlaceResponse> call, Throwable t) {

}
});
}

}
Binary file added app/src/main/res/drawable/search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 3 additions & 4 deletions app/src/main/res/layout/activity_main_hakeem.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
tools:context="nyc.c4q.wesniemarcelin.resourcedapp.google_map.MapsActivity_Hakeem">

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_weight="1"
android:name="com.google.android.gms.maps.MapFragment"
android:id="@+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="0dp"
tools:context = "nyc.c4q.wesniemarcelin.resourcedapp.google_map.MapsActivity">
android:layout_height="match_parent"
tools:context="nyc.c4q.wesniemarcelin.resourcedapp.google_map.MapsActivity">
</fragment>

</LinearLayout>
32 changes: 24 additions & 8 deletions app/src/main/res/layout/activity_maps.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,32 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/white"
>

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="nyc.c4q.wesniemarcelin.resourcedapp.google_map.MapsActivity"></fragment>
<EditText
android:id="@+id/search_bar_gmap"
android:layout_weight="2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter Location"/>

<EditText
android:id="@+id/radius"
android:layout_weight="2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:hint="Enter Radius"/>

<Button
android:layout_weight=".1"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/search"
android:id="@+id/button2"
android:onClick="mapSearch"
/>
</LinearLayout>
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
<color name="colorAccent">#FF4081</color>
<color name="purpleColor">#673AB7</color>
<color name="black">#060606</color>
<color name="white">#ccffffff</color>
</resources>