Android Open Source - awareness-android Items Adapter






From Project

Back to project page awareness-android.

License

The source code is released under:

MIT License

If you think the Android project awareness-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.contexthub.awareness.ui.widget;
/*from w ww.j a v a2s  .co  m*/
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.contexthub.awareness.R;

/**
 * Created by andy on 11/10/14.
 */
public class ItemsAdapter extends RecyclerView.Adapter<ViewHolder> {

    protected Context context;
    protected Item[] items;

    public ItemsAdapter(Context context, Item[] items) {
        this.context = context;
        this.items = items;
    }
    @Override
    public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.list_item, viewGroup, false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(ViewHolder viewHolder, int position) {
        Item item = items[position];
        viewHolder.text1.setText(item.getText1());
        viewHolder.text2.setText(item.getText2());
        if(item.getListener() != null) viewHolder.itemView.setOnClickListener(item.getListener());
    }

    @Override
    public int getItemCount() {
        return items.length;
    }
}




Java Source Code List

com.contexthub.awareness.ApplicationTest.java
com.contexthub.awareness.AwarenessApp.java
com.contexthub.awareness.push.NotificationHandler.java
com.contexthub.awareness.ui.BeaconsActivity.java
com.contexthub.awareness.ui.ChildListActivity.java
com.contexthub.awareness.ui.GeofencesActivity.java
com.contexthub.awareness.ui.MainActivity.java
com.contexthub.awareness.ui.PushActivity.java
com.contexthub.awareness.ui.VaultActivity.java
com.contexthub.awareness.ui.fragments.AboutFragment.java
com.contexthub.awareness.ui.fragments.ContextualObjectsFragment.java
com.contexthub.awareness.ui.widget.DividerItemDecoration.java
com.contexthub.awareness.ui.widget.Item.java
com.contexthub.awareness.ui.widget.ItemsAdapter.java
com.contexthub.awareness.ui.widget.SimpleSectionedRecyclerViewAdapter.java
com.contexthub.awareness.ui.widget.ViewHolder.java