コード例 #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);
 }