Search in sources :

Example 1 with ViewHolder

use of xdroid.viewholder.ViewHolder in project xdroid by shamanland.

the class ExampleBinder method onNewData.

@Override
public void onNewData(int position, View view, ExampleData data) {
    ViewHolder holder = ViewHolder.obtain(view);
    TextView text1 = holder.get(android.R.id.text1);
    if (text1 != null) {
        text1.setText(data.getTitle());
    }
    TextView text2 = holder.get(android.R.id.text2);
    if (text2 != null) {
        text2.setText(data.getSubTitle());
    }
    CompoundButton added = holder.get(R.id.added);
    if (added != null) {
        added.setChecked(data.isAdded());
    }
    RatingBar progress = holder.get(android.R.id.progress);
    if (progress != null) {
        progress.setRating((Math.abs(data.hashCode()) % 5) + 1);
    }
}
Also used : ViewHolder(xdroid.viewholder.ViewHolder) TextView(android.widget.TextView) RatingBar(android.widget.RatingBar) CompoundButton(android.widget.CompoundButton)

Aggregations

CompoundButton (android.widget.CompoundButton)1 RatingBar (android.widget.RatingBar)1 TextView (android.widget.TextView)1 ViewHolder (xdroid.viewholder.ViewHolder)1