projects/moments/app/src/main/java/io/v/moments/ux/MomentHolder.java
/**
     * Modifies the view to reflect the state of moment.
     */
Modifies the view to reflect the state of moment.
Modifies the view to reflect the state of moment .
public void bind(Moment moment, Advertiser advertiser) {
        final Kind kind = advertiser == null ? Kind.REMOTE : Kind.LOCAL;
        Log.d(TAG, "Binding " + kind + " " + moment);
        mAuthorTextView.setText(moment.getAuthor());
        mCaptionTextView.setText(moment.getCaption());
        if (moment.hasPhoto(kind, Style.THUMB)) {
            mImageView.setImageBitmap(moment.getPhoto(kind, Style.THUMB));
            mImageView.setOnClickListener(showPhoto(moment, kind));
        }
        if (moment.hasPhoto(kind, Style.FULL)) {
            if (!moment.hasPhoto(kind, Style.THUMB)) {
                throw new IllegalStateException(Style.THUMB.toString() +
                        " should be ready if " + Style.FULL + " is ready.");
            }
        }
        if (kind.equals(Kind.REMOTE)) {
            mAdvertiseButton.setVisibility(View.INVISIBLE);
        } else {
            mAdvertiseButton.setText("");
            mAdvertiseButton.setVisibility(View.VISIBLE);
            mAdvertiseButton.setEnabled(true);
            mAdvertiseButton.setOnCheckedChangeListener(
                    toggleAdvertising(moment, advertiser));
            mAdvertiseButton.setChecked(
                    moment.getDesiredAdState().equals(AdState.ON));
        }
    }
public void bind ( Moment moment , Advertiser advertiser ) { final Kind kind = advertiser == null ? Kind . REMOTE : Kind . LOCAL ; Log . d ( TAG , "Binding " + kind + " " + moment ) ; mAuthorTextView . setText ( moment . getAuthor ( ) ) ; mCaptionTextView . setText ( moment . getCaption ( ) ) ; if ( moment . hasPhoto ( kind , Style . THUMB ) ) { mImageView . setImageBitmap ( moment . getPhoto ( kind , Style . THUMB ) ) ; mImageView . setOnClickListener ( showPhoto ( moment , kind ) ) ; } if ( moment . hasPhoto ( kind , Style . FULL ) ) { if ( ! moment . hasPhoto ( kind , Style . THUMB ) ) { throw new IllegalStateException ( Style . THUMB . toString ( ) + " should be ready if " + Style . FULL + " is ready." ) ; } } if ( kind . equals ( Kind . REMOTE ) ) { mAdvertiseButton . setVisibility ( View . INVISIBLE ) ; } else { mAdvertiseButton . setText ( "" ) ; mAdvertiseButton . setVisibility ( View . VISIBLE ) ; mAdvertiseButton . setEnabled ( true ) ; mAdvertiseButton . setOnCheckedChangeListener ( toggleAdvertising ( moment , advertiser ) ) ; mAdvertiseButton . setChecked ( moment . getDesiredAdState ( ) . equals ( AdState . ON ) ) ; } }
Modifies the view to reflect the state of moment.
Modifies the view to reflect the state of moment .