Commit caf11021 authored by MUTTINENI NAVYA's avatar MUTTINENI NAVYA

small eroor

parent eea5b411
...@@ -28,6 +28,7 @@ import com.google.android.gms.maps.model.MarkerOptions; ...@@ -28,6 +28,7 @@ import com.google.android.gms.maps.model.MarkerOptions;
/** /**
* A simple {@link Fragment} subclass. * A simple {@link Fragment} subclass.
* Fragment to select location of found item from a google map
*/ */
public class LocationFragment extends Fragment implements OnMapReadyCallback, GoogleMap.OnMarkerDragListener, GoogleMap.OnMarkerClickListener, View.OnClickListener { public class LocationFragment extends Fragment implements OnMapReadyCallback, GoogleMap.OnMarkerDragListener, GoogleMap.OnMarkerClickListener, View.OnClickListener {
...@@ -43,7 +44,13 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback, Go ...@@ -43,7 +44,13 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback, Go
// Required empty public constructor // Required empty public constructor
} }
/**
* Defines the layout of fragment
* @param inflater
* @param container
* @param savedInstanceState
* @return mview
*/
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
...@@ -52,7 +59,11 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback, Go ...@@ -52,7 +59,11 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback, Go
return mView; return mView;
} }
/**
*
* @param view
* @param savedInstanceState
*/
@Override @Override
public void onViewCreated(View view, Bundle savedInstanceState){ public void onViewCreated(View view, Bundle savedInstanceState){
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
...@@ -68,7 +79,11 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback, Go ...@@ -68,7 +79,11 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback, Go
} }
/**
* Populates all the necessary current info which the map should contain.
* Adds marker and sets latitute and longitude of marker
* @param googleMap
*/
@Override @Override
public void onMapReady(GoogleMap googleMap) { public void onMapReady(GoogleMap googleMap) {
MapsInitializer.initialize(getContext()); MapsInitializer.initialize(getContext());
...@@ -92,6 +107,10 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback, Go ...@@ -92,6 +107,10 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback, Go
mMap.setOnMarkerDragListener(this); mMap.setOnMarkerDragListener(this);
} }
/**
* Define what should happen once Select Button is clicked
* @param view
*/
@Override @Override
public void onClick(View view) { public void onClick(View view) {
switch (view.getId()) { switch (view.getId()) {
...@@ -107,6 +126,11 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback, Go ...@@ -107,6 +126,11 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback, Go
} }
/**
* Defines what happens when marker is clicked
* @param marker
* @return
*/
@Override @Override
public boolean onMarkerClick(Marker marker) { public boolean onMarkerClick(Marker marker) {
LatLng my_marker_location = marker.getPosition(); LatLng my_marker_location = marker.getPosition();
...@@ -125,6 +149,10 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback, Go ...@@ -125,6 +149,10 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback, Go
} }
/**
* Method to define what happens when marker is dragged accross the map
* @param marker
*/
@Override @Override
public void onMarkerDragEnd(Marker marker) { public void onMarkerDragEnd(Marker marker) {
my_marker.setPosition(marker.getPosition()); my_marker.setPosition(marker.getPosition());
......
...@@ -19,6 +19,7 @@ import com.google.android.gms.maps.model.MarkerOptions; ...@@ -19,6 +19,7 @@ import com.google.android.gms.maps.model.MarkerOptions;
/** /**
* Fragment for lost item location
* A simple {@link Fragment} subclass. * A simple {@link Fragment} subclass.
*/ */
public class LostItemLocationFragment extends Fragment implements OnMapReadyCallback, GoogleMap.OnMarkerDragListener, GoogleMap.OnMarkerClickListener, View.OnClickListener { public class LostItemLocationFragment extends Fragment implements OnMapReadyCallback, GoogleMap.OnMarkerDragListener, GoogleMap.OnMarkerClickListener, View.OnClickListener {
...@@ -44,7 +45,11 @@ public class LostItemLocationFragment extends Fragment implements OnMapReadyCall ...@@ -44,7 +45,11 @@ public class LostItemLocationFragment extends Fragment implements OnMapReadyCall
return mView; return mView;
} }
/**
* Sets map's view
* @param view
* @param savedInstanceState
*/
@Override @Override
public void onViewCreated(View view, Bundle savedInstanceState){ public void onViewCreated(View view, Bundle savedInstanceState){
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
...@@ -60,7 +65,11 @@ public class LostItemLocationFragment extends Fragment implements OnMapReadyCall ...@@ -60,7 +65,11 @@ public class LostItemLocationFragment extends Fragment implements OnMapReadyCall
} }
/**
* Populatesmap with required info
* Adds marker and sets its location
* @param googleMap
*/
@Override @Override
public void onMapReady(GoogleMap googleMap) { public void onMapReady(GoogleMap googleMap) {
MapsInitializer.initialize(getContext()); MapsInitializer.initialize(getContext());
...@@ -78,6 +87,10 @@ public class LostItemLocationFragment extends Fragment implements OnMapReadyCall ...@@ -78,6 +87,10 @@ public class LostItemLocationFragment extends Fragment implements OnMapReadyCall
mMap.setOnMarkerDragListener(this); mMap.setOnMarkerDragListener(this);
} }
/**
* implemented clickable event, select to select location of lost item
* @param view
*/
@Override @Override
public void onClick(View view) { public void onClick(View view) {
switch (view.getId()) { switch (view.getId()) {
...@@ -93,6 +106,11 @@ public class LostItemLocationFragment extends Fragment implements OnMapReadyCall ...@@ -93,6 +106,11 @@ public class LostItemLocationFragment extends Fragment implements OnMapReadyCall
getActivity().getSupportFragmentManager().beginTransaction().remove(this).commit(); getActivity().getSupportFragmentManager().beginTransaction().remove(this).commit();
} }
/**
* defines what happens when marker is clicked
* @param marker
* @return
*/
@Override @Override
public boolean onMarkerClick(Marker marker) { public boolean onMarkerClick(Marker marker) {
LatLng my_marker_location = marker.getPosition(); LatLng my_marker_location = marker.getPosition();
...@@ -109,6 +127,10 @@ public class LostItemLocationFragment extends Fragment implements OnMapReadyCall ...@@ -109,6 +127,10 @@ public class LostItemLocationFragment extends Fragment implements OnMapReadyCall
} }
/**
* Defines what happens when the marker is dragged
* @param marker
*/
@Override @Override
public void onMarkerDragEnd(Marker marker) { public void onMarkerDragEnd(Marker marker) {
my_marker = marker; my_marker = marker;
......
...@@ -35,7 +35,13 @@ public class SeeLocationFragment extends Fragment implements OnMapReadyCallback, ...@@ -35,7 +35,13 @@ public class SeeLocationFragment extends Fragment implements OnMapReadyCallback,
// Required empty public constructor // Required empty public constructor
} }
/**
* Defines the layout of fragment
* @param inflater
* @param container
* @param savedInstanceState
* @return mview
*/
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
...@@ -59,7 +65,11 @@ public class SeeLocationFragment extends Fragment implements OnMapReadyCallback, ...@@ -59,7 +65,11 @@ public class SeeLocationFragment extends Fragment implements OnMapReadyCallback,
} }
/**
* Populates all the necessary current info which the map should contain.
* Adds marker and sets latitute and longitude of marker
* @param googleMap
*/
@Override @Override
public void onMapReady(GoogleMap googleMap) { public void onMapReady(GoogleMap googleMap) {
MapsInitializer.initialize(getContext()); MapsInitializer.initialize(getContext());
...@@ -73,7 +83,11 @@ public class SeeLocationFragment extends Fragment implements OnMapReadyCallback, ...@@ -73,7 +83,11 @@ public class SeeLocationFragment extends Fragment implements OnMapReadyCallback,
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(location,16f)); mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(location,16f));
mMap.setOnMarkerClickListener(this); mMap.setOnMarkerClickListener(this);
} }
/**
* Define what should happen once Done Button is clicked
* The fragment closes and goes back to parent
* @param view
*/
@Override @Override
public void onClick(View view) { public void onClick(View view) {
switch (view.getId()) { switch (view.getId()) {
...@@ -83,7 +97,11 @@ public class SeeLocationFragment extends Fragment implements OnMapReadyCallback, ...@@ -83,7 +97,11 @@ public class SeeLocationFragment extends Fragment implements OnMapReadyCallback,
} }
} }
/**
* Defines what happens when marker is clicked
* @param marker
* @return
*/
@Override @Override
public boolean onMarkerClick(Marker marker) { public boolean onMarkerClick(Marker marker) {
LatLng my_marker_location = marker.getPosition(); LatLng my_marker_location = marker.getPosition();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment