Back to project page android-async-google-places.
The source code is released under:
Apache License
If you think the Android project android-async-google-places listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package io.github.axxiss.places.request; //from w w w . j a v a2s .c o m import java.util.EnumMap; import java.util.List; import java.util.Map; import io.github.axxiss.places.PlacesSettings; import io.github.axxiss.places.enums.Params; import io.github.axxiss.places.enums.PlaceType; /** * @author Axxiss */ public class PlaceParams { private static final String TAG = "PlaceParams"; private String mUrl; private EnumMap<Params, String> params = new EnumMap<Params, String>(Params.class); public PlaceParams() { params.put(Params.Key, PlacesSettings.getInstance().getApiKey()); params.put(Params.Sensor, "true"); } public void put(Params key, String value) { params.put(key, value); } public void put(Params key, boolean value) { params.put(key, String.valueOf(value)); } public void put(Params key, int value) { params.put(key, String.valueOf(value)); } public void put(Params key, double value) { params.put(key, String.valueOf(value)); } public void put(Params key) { } public static String buildLocation(double lat, double lng) { return String.format("%s,%s", String.valueOf(lat), String.valueOf(lng)); } public void put(Params key, List<PlaceType> values) { //FIXME setTypes(values.toArray(new PlaceType[values.size()])); } protected String getUrl() { return mUrl; } protected void setUrl(final String url) { mUrl = url; } private PlaceParams setTypes(PlaceType[] places) { //Single call in the Lib. Should be private final String divider = "|"; StringBuilder types = new StringBuilder(); for (PlaceType place : places) { types.append(place.getValue()); types.append(divider); } params.put(Params.Types, types.substring(0, types.length() - 1)); return this; } protected Map<Params, String> getParams() { return params; } }