app/src/main/java/com/example/android/sunshine/ui/list/ForecastAdapter.java
@Override
    public void onBindViewHolder(ForecastAdapterViewHolder forecastAdapterViewHolder, int position) {
        WeatherEntry currentWeather = mForecast.get(position);

        /****************
         * Weather Icon *
         ****************/
        int weatherIconId = currentWeather.getWeatherIconId();
        int weatherImageResourceId = getImageResourceId(weatherIconId, position);
        forecastAdapterViewHolder.iconView.setImageResource(weatherImageResourceId);

        /****************
         * Weather Date *
         ****************/
        long dateInMillis = currentWeather.getDate().getTime();
         /* Get human readable string using our utility method */
        String dateString = SunshineDateUtils.getFriendlyDateString(mContext, dateInMillis, false);

         /* Display friendly date string */
        forecastAdapterViewHolder.dateView.setText(dateString);

        /***********************
         * Weather Description *
         ***********************/
        String description = SunshineWeatherUtils.getStringForWeatherCondition(mContext, weatherIconId);
         /* Create the accessibility (a11y) String from the weather description */
        String descriptionA11y = mContext.getString(R.string.a11y_forecast, description);

         /* Set the text and content description (for accessibility purposes) */
        forecastAdapterViewHolder.descriptionView.setText(description);
        forecastAdapterViewHolder.descriptionView.setContentDescription(descriptionA11y);

        /**************************
         * High (max) temperature *
         **************************/
        double highInCelsius = currentWeather.getMax();
         /*
          * If the user's preference for weather is fahrenheit, formatTemperature will convert
          * the temperature. This method will also append either °C or °F to the temperature
          * String.
          */
        String highString = SunshineWeatherUtils.formatTemperature(mContext, highInCelsius);
         /* Create the accessibility (a11y) String from the weather description */
        String highA11y = mContext.getString(R.string.a11y_high_temp, highString);

         /* Set the text and content description (for accessibility purposes) */
        forecastAdapterViewHolder.highTempView.setText(highString);
        forecastAdapterViewHolder.highTempView.setContentDescription(highA11y);

        /*************************
         * Low (min) temperature *
         *************************/
        double lowInCelsius = currentWeather.getMin();
         /*
          * If the user's preference for weather is fahrenheit, formatTemperature will convert
          * the temperature. This method will also append either °C or °F to the temperature
          * String.
          */
        String lowString = SunshineWeatherUtils.formatTemperature(mContext, lowInCelsius);
        String lowA11y = mContext.getString(R.string.a11y_low_temp, lowString);

         /* Set the text and content description (for accessibility purposes) */
        forecastAdapterViewHolder.lowTempView.setText(lowString);
        forecastAdapterViewHolder.lowTempView.setContentDescription(lowA11y);
    }
/**
     * OnBindViewHolder is called by the RecyclerView to display the data at the specified
     * position. In this method, we update the contents of the ViewHolder to display the weather
     * details for this particular position, using the "position" argument that is conveniently
     * passed into us.
     *
     * @param forecastAdapterViewHolder The ViewHolder which should be updated to represent the
     *                                  contents of the item at the given position in the data set.
     * @param position                  The position of the item within the adapter's data set.
     */
OnBindViewHolder is called by the RecyclerView to display the data at the specified
position. In this method, we update the contents of the ViewHolder to display the weather
details for this particular position, using the "position" argument that is conveniently
passed into us.

@param forecastAdapterViewHolder The ViewHolder which should be updated to represent the
contents of the item at the given position in the data set.
@param position                  The position of the item within the adapter's data set.
OnBindViewHolder is called by the RecyclerView to display the data at the specified position . In this method we update the contents of the ViewHolder to display the weather details for this particular position using the " position " argument that is conveniently passed into us . @param forecastAdapterViewHolder The ViewHolder which should be updated to represent the contents of the item at the given position in the data set . @param position The position of the item within the adapter ' s data set .
@Override
    public void onBindViewHolder(ForecastAdapterViewHolder forecastAdapterViewHolder, int position) {
        WeatherEntry currentWeather = mForecast.get(position);
        /****************
         * Weather Icon *
         ****************/
        int weatherIconId = currentWeather.getWeatherIconId();
        int weatherImageResourceId = getImageResourceId(weatherIconId, position);
        forecastAdapterViewHolder.iconView.setImageResource(weatherImageResourceId);
        /****************
         * Weather Date *
         ****************/
        long dateInMillis = currentWeather.getDate().getTime();
         /* Get human readable string using our utility method */
        String dateString = SunshineDateUtils.getFriendlyDateString(mContext, dateInMillis, false);
         /* Display friendly date string */
        forecastAdapterViewHolder.dateView.setText(dateString);
        /***********************
         * Weather Description *
         ***********************/
        String description = SunshineWeatherUtils.getStringForWeatherCondition(mContext, weatherIconId);
         /* Create the accessibility (a11y) String from the weather description */
        String descriptionA11y = mContext.getString(R.string.a11y_forecast, description);
         /* Set the text and content description (for accessibility purposes) */
        forecastAdapterViewHolder.descriptionView.setText(description);
        forecastAdapterViewHolder.descriptionView.setContentDescription(descriptionA11y);
        /**************************
         * High (max) temperature *
         **************************/
        double highInCelsius = currentWeather.getMax();
         /*
          * If the user's preference for weather is fahrenheit, formatTemperature will convert
          * the temperature. This method will also append either °C or °F to the temperature
          * String.
          */
        String highString = SunshineWeatherUtils.formatTemperature(mContext, highInCelsius);
         /* Create the accessibility (a11y) String from the weather description */
        String highA11y = mContext.getString(R.string.a11y_high_temp, highString);
         /* Set the text and content description (for accessibility purposes) */
        forecastAdapterViewHolder.highTempView.setText(highString);
        forecastAdapterViewHolder.highTempView.setContentDescription(highA11y);
        /*************************
         * Low (min) temperature *
         *************************/
        double lowInCelsius = currentWeather.getMin();
         /*
          * If the user's preference for weather is fahrenheit, formatTemperature will convert
          * the temperature. This method will also append either °C or °F to the temperature
          * String.
          */
        String lowString = SunshineWeatherUtils.formatTemperature(mContext, lowInCelsius);
        String lowA11y = mContext.getString(R.string.a11y_low_temp, lowString);
         /* Set the text and content description (for accessibility purposes) */
        forecastAdapterViewHolder.lowTempView.setText(lowString);
        forecastAdapterViewHolder.lowTempView.setContentDescription(lowA11y);
    }
@ Override public void onBindViewHolder ( ForecastAdapterViewHolder forecastAdapterViewHolder , int position ) { WeatherEntry currentWeather = mForecast . get ( position ) ; /****************
         * Weather Icon *
         ****************/ int weatherIconId = currentWeather . getWeatherIconId ( ) ; int weatherImageResourceId = getImageResourceId ( weatherIconId , position ) ; forecastAdapterViewHolder . iconView . setImageResource ( weatherImageResourceId ) ; /****************
         * Weather Date *
         ****************/ long dateInMillis = currentWeather . getDate ( ) . getTime ( ) ; /* Get human readable string using our utility method */ String dateString = SunshineDateUtils . getFriendlyDateString ( mContext , dateInMillis , false ) ; /* Display friendly date string */ forecastAdapterViewHolder . dateView . setText ( dateString ) ; /***********************
         * Weather Description *
         ***********************/ String description = SunshineWeatherUtils . getStringForWeatherCondition ( mContext , weatherIconId ) ; /* Create the accessibility (a11y) String from the weather description */ String descriptionA11y = mContext . getString ( R . string . a11y_forecast , description ) ; /* Set the text and content description (for accessibility purposes) */ forecastAdapterViewHolder . descriptionView . setText ( description ) ; forecastAdapterViewHolder . descriptionView . setContentDescription ( descriptionA11y ) ; /**************************
         * High (max) temperature *
         **************************/ double highInCelsius = currentWeather . getMax ( ) ; /*
          * If the user's preference for weather is fahrenheit, formatTemperature will convert
          * the temperature. This method will also append either °C or °F to the temperature
          * String.
          */ String highString = SunshineWeatherUtils . formatTemperature ( mContext , highInCelsius ) ; /* Create the accessibility (a11y) String from the weather description */ String highA11y = mContext . getString ( R . string . a11y_high_temp , highString ) ; /* Set the text and content description (for accessibility purposes) */ forecastAdapterViewHolder . highTempView . setText ( highString ) ; forecastAdapterViewHolder . highTempView . setContentDescription ( highA11y ) ; /*************************
         * Low (min) temperature *
         *************************/ double lowInCelsius = currentWeather . getMin ( ) ; /*
          * If the user's preference for weather is fahrenheit, formatTemperature will convert
          * the temperature. This method will also append either °C or °F to the temperature
          * String.
          */ String lowString = SunshineWeatherUtils . formatTemperature ( mContext , lowInCelsius ) ; String lowA11y = mContext . getString ( R . string . a11y_low_temp , lowString ) ; /* Set the text and content description (for accessibility purposes) */ forecastAdapterViewHolder . lowTempView . setText ( lowString ) ; forecastAdapterViewHolder . lowTempView . setContentDescription ( lowA11y ) ; }
OnBindViewHolder is called by the RecyclerView to display the data at the specified
 position.
OnBindViewHolder is called by the RecyclerView to display the data at the specified position .