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

    forecast.setCurrent(getCurrentDetails(jsonData));
    forecast.setHourlyForecast(getHourlyForecast(jsonData));
    forecast.setDailyForecast(getDailyForecast(jsonData));

    return forecast;
  }
예제 #2
0
 private void updateDisplay() {
   Current current = mForecast.getCurrent();
   mLocationLabel.setText(LOCATION_NAME);
   mTemperatureLabel.setText(current.getTemperature() + "");
   mTimeLabel.setText("At " + current.getFormattedTime() + " it will be");
   mHumidityValue.setText(current.getHumidity() + "");
   mPrecipValue.setText(current.getPrecipChance() + "%");
   mSummaryLabel.setText(current.getSummary());
   Drawable drawable = getResources().getDrawable(mForecast.getCurrent().getIconId());
   mIconImageView.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.getHourlyForecast());
   startActivity(intent);
 }
예제 #4
0
 @OnClick(R.id.dailyButton)
 public void startDailyActivity(View view) {
   Intent intent = new Intent(this, DailyForecastActivity.class);
   intent.putExtra(DAILY_FORECAST, mForecast.getDailyForecast());
   startActivity(intent);
 }