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; }
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); }
@OnClick(R.id.hourlyButton) public void startHourlyActivity(View view) { Intent intent = new Intent(this, HourlyForecastActivity.class); intent.putExtra(HOURLY_FORECAST, mForecast.getHourlyForecast()); startActivity(intent); }
@OnClick(R.id.dailyButton) public void startDailyActivity(View view) { Intent intent = new Intent(this, DailyForecastActivity.class); intent.putExtra(DAILY_FORECAST, mForecast.getDailyForecast()); startActivity(intent); }