Guest User

Current.class

a guest
Aug 20th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.48 KB | None | 0 0
  1.         import java.text.SimpleDateFormat;
  2.         import java.util.Date;
  3.         import java.util.TimeZone;
  4.  
  5. public class Current {
  6.     private long mTime;
  7.     private String mSummary;
  8.     private String mIcon;
  9.     private double mTemp;
  10.     private double mPrecip;
  11.     private String mTimeZone;
  12.  
  13.  
  14.     public String getTimeZone() {
  15.         return mTimeZone;
  16.     }
  17.  
  18.     public void setTimeZone(String timeZone) {
  19.         mTimeZone = timeZone;
  20.     }
  21.  
  22.     public long getTime() {
  23.         return mTime;
  24.     }
  25.  
  26.     public void setTime(long time) {
  27.         mTime = time;
  28.     }
  29.  
  30.     public String getFormattedTime(){
  31.         SimpleDateFormat formatter = new SimpleDateFormat("h:mm a");
  32.         formatter.setTimeZone(TimeZone.getTimeZone(getTimeZone()));
  33.         Date datetime = new Date(getTime() * 1000);
  34.         String timeString = formatter.format(datetime);
  35.  
  36.         return timeString;
  37.     }
  38.  
  39.     public String getSummary() {
  40.         return mSummary;
  41.     }
  42.  
  43.     public void setSummary(String summary) {
  44.         mSummary = summary;
  45.     }
  46.  
  47.     public String getIcon() {
  48.         return mIcon;
  49.     }
  50.  
  51.     public void setIcon(String icon) {
  52.         mIcon = icon;
  53.     }
  54.  
  55.     public int getTemp() {
  56.         return (int) Math.round(mTemp);
  57.     }
  58.  
  59.     public void setTemp(double temp) {
  60.         mTemp = temp;
  61.     }
  62.  
  63.     public double getPrecip() {
  64.         return mPrecip;
  65.     }
  66.  
  67.     public void setPrecip(double precip) {
  68.         mPrecip = precip;
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment