Added showing address location google places view.

master
Tomasz Półgrabia 2016-10-02 19:06:23 +02:00
parent b874f77551
commit f52a6e7a9a
2 changed files with 21 additions and 0 deletions
app/src/main
java/pl/tpolgrabia/urbanexplorer/fragments

View File

@ -9,10 +9,14 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.TextView;
import org.apache.http.HttpStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pl.tpolgrabia.googleutils.callback.LocationGeoCoderCallback;
import pl.tpolgrabia.googleutils.callback.PlacesCallback;
import pl.tpolgrabia.googleutils.dto.GooglePlaceResult;
import pl.tpolgrabia.googleutils.utils.GeocoderUtils;
import pl.tpolgrabia.googleutils.utils.PlacesUtils;
import pl.tpolgrabia.panoramiobindings.callback.ProviderStatusCallback;
import pl.tpolgrabia.urbanexplorer.AppConstants;
@ -33,6 +37,7 @@ public class PlacesFragment extends Fragment {
private static final Logger lg = LoggerFactory.getLogger(PlacesFragment.class);
public static final String TAG = PlacesFragment.class.getSimpleName();
private PlacesUtils placesUtils;
private GeocoderUtils geocoderUtils;
public PlacesFragment() {
// Required empty public constructor
@ -94,6 +99,8 @@ public class PlacesFragment extends Fragment {
}
});
geocoderUtils = new GeocoderUtils(getActivity(), AppConstants.GOOGLE_API_KEY);
}
@Override
@ -109,6 +116,19 @@ public class PlacesFragment extends Fragment {
return;
}
geocoderUtils.getGeoCodedLocation(new LocationGeoCoderCallback() {
@Override
public void callback(int code, String message, String googleStatus, String geocodedLocation) {
lg.trace("Geocoded code: {}, message: {}, google status: {}, location: {}",
code,
message,
googleStatus,
geocodedLocation);
TextView locationWidget = (TextView) getView().findViewById(R.id.google_places_location);
locationWidget.setText(geocodedLocation);
}
});
fetchNearbyPlacesAndPresemt(location);
}

View File

@ -7,6 +7,7 @@
<!-- TODO: Update blank fragment layout -->
<TextView
android:id="@+id/google_places_location"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/location_info"/>