예제 #1
0
  private Forecast parseForecastData(String jsonData) throws JSONException {
    Forecast forecast = new Forecast();

    forecast.setCurrentWeather(getCurrentData(jsonData));
    forecast.setDailyWeathers(getDailyWeather(jsonData));
    forecast.setHourlyWeathers(getHourlyWeather(jsonData));

    return forecast;
  }
예제 #2
0
  private void updateDisplay() {
    CurrentWeather mCurrentWeather = mForecast.getCurrentWeather();

    mTimeLabel.setText("At " + mCurrentWeather.getFormattedTime() + " it will be");
    mTempratureLabel.setText(mCurrentWeather.getTempInCelcius() + "");
    mHumidityValue.setText(mCurrentWeather.getHumidity() + "");
    mPrecipValue.setText(mCurrentWeather.getChanceOfRain() + "%");
    mSummary.setText("The weather is " + mCurrentWeather.getSummary());
    Drawable drawable = getResources().getDrawable(mCurrentWeather.getIconId());
    mIconImage.setImageDrawable(drawable);
  }
예제 #3
0
 @OnClick(R.id.hourlyButton)
 public void startHourlyActivity(View view) {
   Intent intent = new Intent(this, HourlyForecastActivity.class);
   intent.putExtra(HOURLY_FORECAST, mForecast.getHourlyWeathers());
   startActivity(intent);
 }