Skip to content

Commit

Permalink
Ajout de la méthode getImage à l'objet POI
Browse files Browse the repository at this point in the history
  • Loading branch information
joey-mbk committed May 8, 2012
1 parent d8f06c4 commit a13893d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/com/mobilecityguide/models/POI.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
package com.mobilecityguide.models;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;

import android.text.format.DateFormat;

public class POI {

private int id;
Expand Down Expand Up @@ -89,6 +95,15 @@ public void setLongitude(Double longitude) {
public String getImages(String timeOfDay) {
return this.images.get(timeOfDay);
}

public String getImage() {
Calendar cal = new GregorianCalendar();
int hourOfDay = cal.get(Calendar.HOUR_OF_DAY);
if (hourOfDay >= 18)
return this.images.get("night");
else
return this.images.get("day");
}

public void addImage(String timeOfDay, String path) {
this.images.put(timeOfDay, path);
Expand Down

0 comments on commit a13893d

Please sign in to comment.