Search in sources :

Example 1 with AttentionListAdapter

use of com.rideread.rideread.adapter.AttentionListAdapter in project ride-read-android by Ride-Read.

the class AttentionFragment method initView.

private void initView(View mView) {
    listview = (ListView) mView.findViewById(R.id.timeline_attention_listview);
    View v = LayoutInflater.from(getActivity().getApplicationContext()).inflate(R.layout.timeline_newmsg_headview, null);
    listview.addHeaderView(v);
    AttentionListAdapter adapter = new AttentionListAdapter(lists, R.layout.timeline_attention_listitem, getContext());
    listview.setAdapter(adapter);
    listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (position == 0) {
                Toast.makeText(getContext(), "点击了消息提示", Toast.LENGTH_SHORT).show();
            } else {
                Intent intent = new Intent(AttentionFragment.this.getActivity(), TimelineDetailsActivity.class);
                intent.putExtra("timeline", (TimeLine) parent.getAdapter().getItem(position));
                startActivity(intent);
            }
        }
    });
}
Also used : AttentionListAdapter(com.rideread.rideread.adapter.AttentionListAdapter) TimeLine(com.rideread.rideread.bean.TimeLine) AdapterView(android.widget.AdapterView) Intent(android.content.Intent) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) TimelineDetailsActivity(com.rideread.rideread.activity.TimelineDetailsActivity)

Aggregations

Intent (android.content.Intent)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ListView (android.widget.ListView)1 TimelineDetailsActivity (com.rideread.rideread.activity.TimelineDetailsActivity)1 AttentionListAdapter (com.rideread.rideread.adapter.AttentionListAdapter)1 TimeLine (com.rideread.rideread.bean.TimeLine)1