本文整理汇总了Java中fi.foyt.foursquare.api.entities.CompactVenue类的典型用法代码示例。如果您正苦于以下问题:Java CompactVenue类的具体用法?Java CompactVenue怎么用?Java CompactVenue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CompactVenue类属于fi.foyt.foursquare.api.entities包,在下文中一共展示了CompactVenue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onStartCommand
import fi.foyt.foursquare.api.entities.CompactVenue; //导入依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId){
super.onStartCommand(intent,flags,startId);
this.intent = intent;
this.venue = (CompactVenue) intent.getSerializableExtra("venue");
this.fence = (FenceInfo) intent.getSerializableExtra("fence");
if(venue != null && fence != null){
if(servicesConnected()){
locationClient = new GoogleApiClient.Builder(this)
.addApi(LocationServices.API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
locationClient.connect();
}
}
return START_NOT_STICKY;
}
示例2: onResume
import fi.foyt.foursquare.api.entities.CompactVenue; //导入依赖的package包/类
@Override
public void onResume(){
super.onResume();
List<CompactVenue> venues = StorageUtils.getInstance().loadCompactVenues(this);
if(venues.size() == 0){
placeholder.setVisibility(View.VISIBLE);
list.setVisibility(View.GONE);
}else{
placeholder.setVisibility(View.GONE);
list.setVisibility(View.VISIBLE);
}
adapter.setVenues(venues);
setMarkers();
if(servicesConnected()){
locationClient = new GoogleApiClient.Builder(this)
.addApi(LocationServices.API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
locationClient.connect();
}
}
示例3: setMarkers
import fi.foyt.foursquare.api.entities.CompactVenue; //导入依赖的package包/类
@UiThread
public void setMarkers(){
if(map == null) return;
map.clear();
List<FenceInfo> fenceinfo = store.loadAllFenceInfo(this);
List<CompactVenue> venues = store.loadCompactVenues(this);
for(int i = 0 ; i < venues.size() ; i++){
FenceInfo fence = fenceinfo.get(i);
CompactVenue venue = venues.get(i);
CircleOptions circleOptions = new CircleOptions()
.center(new LatLng(venue.getLocation().getLat(), venue.getLocation().getLng()))
.strokeColor(getResources().getColor(R.color.blue))
.fillColor(getResources().getColor(R.color.blue_transparent_9))
.strokeWidth(3)
.radius(fence.getRadius()); // In meters
map.addMarker(new MarkerOptions()
.position(new LatLng(venue.getLocation().getLat(), venue.getLocation().getLng()))
.draggable(false));
map.addCircle(circleOptions);
}
}
示例4: loadCompactVenue
import fi.foyt.foursquare.api.entities.CompactVenue; //导入依赖的package包/类
public CompactVenue loadCompactVenue(Context context, String id){
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
String venueString = sp.getString(COMPACT_VENUE + "." + id, "");
if(venueString.equals("")) return null;
return gson.fromJson(venueString, CompactVenue.class);
}
示例5: loadCompactVenues
import fi.foyt.foursquare.api.entities.CompactVenue; //导入依赖的package包/类
public List<CompactVenue> loadCompactVenues(Context context){
ArrayList<CompactVenue> result = new ArrayList<CompactVenue>();
String[]ids = loadCompactVenueIds(context);
for(String id : ids){
CompactVenue venue = loadCompactVenue(context, id);
if(venue != null) result.add(venue);
}
return result;
}
示例6: toGeofence
import fi.foyt.foursquare.api.entities.CompactVenue; //导入依赖的package包/类
public Geofence toGeofence(CompactVenue venue) {
// Build a new Geofence object
return new Geofence.Builder()
.setRequestId(id)
.setTransitionTypes(transition)
.setCircularRegion(
venue.getLocation().getLat(),
venue.getLocation().getLng(),
radius)
.setLoiteringDelay(delay*60*1000)
.setExpirationDuration(expiration)
.build();
}
示例7: setMayors
import fi.foyt.foursquare.api.entities.CompactVenue; //导入依赖的package包/类
@UiThread
protected void setMayors(VenueHistory[] mayors){
CompactVenue[] venues = new CompactVenue[mayors.length];
for(int i = 0; i < mayors.length; i++){
venues[i] = mayors[i].getVenue();
}
adapter.setMayors(venues);
}
示例8: setVenueHistory
import fi.foyt.foursquare.api.entities.CompactVenue; //导入依赖的package包/类
@UiThread
protected void setVenueHistory(VenueHistory[] history){
CompactVenue[] venues = new CompactVenue[history.length];
for(int i = 0; i < history.length; i++){
venues[i] = history[i].getVenue();
}
adapter.setHistory(venues);
}
示例9: setupMap
import fi.foyt.foursquare.api.entities.CompactVenue; //导入依赖的package包/类
public void setupMap(){
marker = map.addMarker(new MarkerOptions()
.position(new LatLng(venue.getLocation().getLat(), venue.getLocation().getLng()))
.draggable(true));
map.setOnMarkerDragListener(this);
map.animateCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition(new LatLng(marker.getPosition().latitude + 0.0005, marker.getPosition().longitude), (float) 16, (float) 30, (float) 0.0)));
//map.getUiSettings().setAllGesturesEnabled(false);
map.getUiSettings().setMyLocationButtonEnabled(false);
map.getUiSettings().setCompassEnabled(false);
map.getUiSettings().setZoomControlsEnabled(false);
map.setMapType(GoogleMap.MAP_TYPE_HYBRID);
List<FenceInfo> fenceinfo = store.loadAllFenceInfo(this);
List<CompactVenue> venues = store.loadCompactVenues(this);
for(int i = 0 ; i < venues.size() ; i++){
FenceInfo fence = fenceinfo.get(i);
CompactVenue venueItem = venues.get(i);
if(fence.getId().equals(venue.getId())) continue;
CircleOptions circleOptions = new CircleOptions()
.center(new LatLng(venueItem.getLocation().getLat(), venueItem.getLocation().getLng()))
.strokeColor(getResources().getColor(R.color.blue))
.fillColor(getResources().getColor(R.color.blue_transparent_3))
.strokeWidth(3)
.radius(fence.getRadius()); // In meters
map.addCircle(circleOptions);
}
}
示例10: setMayors
import fi.foyt.foursquare.api.entities.CompactVenue; //导入依赖的package包/类
public void setMayors(CompactVenue[] mayors) {
this.mayors = new LinkedList<CompactVenue>();
if(mayors != null){
for(CompactVenue venue : mayors){
this.mayors.add(venue);
Collections.sort(this.mayors, new VenueComparator());
}
}
}
示例11: setHistory
import fi.foyt.foursquare.api.entities.CompactVenue; //导入依赖的package包/类
public void setHistory(CompactVenue[] history) {
this.history = new LinkedList<CompactVenue>();
if(history != null){
for(CompactVenue venue : history){
this.history.add(venue);
Collections.sort(this.history, new VenueComparator());
}
}
notifyDataSetChanged();
}
示例12: getView
import fi.foyt.foursquare.api.entities.CompactVenue; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
holder = new ViewHolder();
convertView = inflater.inflate(R.layout.item_venue_home, parent, false);
holder.name = (TextView) convertView.findViewById(R.id.name);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
final CompactVenue venue = getItem(position);
holder.name.setText(venue.getName());
convertView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, AddConfigActivity_.class);
intent.putExtra("venue", venue);
context.startActivity(intent);
}
});
return convertView;
}
示例13: saveCompactVenue
import fi.foyt.foursquare.api.entities.CompactVenue; //导入依赖的package包/类
public void saveCompactVenue(Context context, CompactVenue venue){
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
String json = gson.toJson(venue);
sp.edit().putString(COMPACT_VENUE + "." + venue.getId(), json).commit();
addCompactVenueId(context, venue.getId());
}
示例14: removeCompactVenue
import fi.foyt.foursquare.api.entities.CompactVenue; //导入依赖的package包/类
public void removeCompactVenue(Context context, CompactVenue venue){
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
sp.edit().remove(COMPACT_VENUE + "." + venue.getId()).commit();
removeCompactVenueId(context, venue.getId());
removeRange(context, venue.getId());
}
示例15: getConflictingFences
import fi.foyt.foursquare.api.entities.CompactVenue; //导入依赖的package包/类
public List<CompactVenue> getConflictingFences(FenceInfo info, CompactVenue venue){
List<CompactVenue> conflicts = new ArrayList<CompactVenue>();
Location current = toLocation(venue);
List<FenceInfo> fences = StorageUtils.getInstance().loadAllFenceInfo(context);
List<CompactVenue> venues = StorageUtils.getInstance().loadCompactVenues(context);
for(int i = 0; i < fences.size(); i++){
CompactVenue otherVenue = venues.get(i);
// no conflict with current ;)
if(otherVenue.getId().equals(venue.getId())) continue;
Location other = toLocation(otherVenue);
float distance = current.distanceTo(other); // meters
if(distance <= (fences.get(i).getRadius() + info.getRadius())){
conflicts.add(otherVenue);
}
}
return conflicts;
}