Search in sources :

Example 31 with OnItemClickListener

use of android.widget.AdapterView.OnItemClickListener in project android-app by eoecn.

the class BlogFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    listview.setXListViewListener(this);
    // construct the RelativeLayout
    listview.setXListViewListener(this);
    // construct the RelativeLayout
    mAdapter = new MyAdapter();
    mAdapter.appendToList(items_list);
    listview.setAdapter(mAdapter);
    listview.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // TODO Auto-generated method stub
            BlogContentItem item = (BlogContentItem) mAdapter.getItem(position - 1);
            startDetailActivity(mActivity, item.getDetail_url(), "博客", item.getTitle());
        }
    });
    return view;
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) BlogContentItem(cn.eoe.app.entity.BlogContentItem) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 32 with OnItemClickListener

use of android.widget.AdapterView.OnItemClickListener in project android-app by eoecn.

the class NewsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreateView(inflater, container, savedInstanceState);
    listview.setXListViewListener(this);
    // construct the RelativeLayout
    mAdapter = new MyAdapter();
    mAdapter.appendToList(items_list);
    listview.setAdapter(mAdapter);
    listview.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // TODO Auto-generated method stub
            NewsContentItem item = (NewsContentItem) mAdapter.getItem(position - 1);
            startDetailActivity(mActivity, item.getDetail_url(), "资讯", item.getTitle());
        }
    });
    return view;
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) NewsContentItem(cn.eoe.app.entity.NewsContentItem) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) SuppressLint(android.annotation.SuppressLint)

Example 33 with OnItemClickListener

use of android.widget.AdapterView.OnItemClickListener in project android-app by eoecn.

the class MainActivity method initListView.

private void initListView() {
    lvAdapter = new SimpleAdapter(this, getData(), R.layout.behind_list_show, new String[] { LIST_TEXT, LIST_IMAGEVIEW }, new int[] { R.id.textview_behind_title, R.id.imageview_behind_icon }) {

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            // TODO Auto-generated method stub.
            View view = super.getView(position, convertView, parent);
            if (position == mTag) {
                view.setBackgroundResource(R.drawable.back_behind_list);
                lvTitle.setTag(view);
            } else {
                view.setBackgroundColor(Color.TRANSPARENT);
            }
            return view;
        }
    };
    lvTitle.setAdapter(lvAdapter);
    lvTitle.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            NavigationModel navModel = navs.get(position);
            mAboveTitle.setText(navModel.getName());
            current_page = navModel.getTags();
            if (lvTitle.getTag() != null) {
                if (lvTitle.getTag() == view) {
                    MainActivity.this.showContent();
                    return;
                }
                ((View) lvTitle.getTag()).setBackgroundColor(Color.TRANSPARENT);
            }
            lvTitle.setTag(view);
            view.setBackgroundResource(R.drawable.back_behind_list);
            imgQuery.setVisibility(View.VISIBLE);
            switch(position) {
                case 0:
                    imgQuery.setVisibility(View.GONE);
                    new MyTask().execute(topDao);
                    break;
                case 1:
                    new MyTask().execute(newsDao);
                    break;
                case 2:
                    new MyTask().execute(wikiDao);
                    break;
                case 3:
                    new MyTask().execute(blogsDao);
                    break;
            }
        }
    });
}
Also used : NavigationModel(cn.eoe.app.entity.NavigationModel) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) ViewGroup(android.view.ViewGroup) SimpleAdapter(android.widget.SimpleAdapter) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView)

Example 34 with OnItemClickListener

use of android.widget.AdapterView.OnItemClickListener in project standup-timer by jwood.

the class TeamDetails method createMeetingListClickListener.

private OnItemClickListener createMeetingListClickListener() {
    return new OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            String meetingTime = meetingListAdapter.getItem(position);
            Intent intent = new Intent(TeamDetails.this, MeetingDetails.class);
            intent.putExtra("teamName", team.getName());
            intent.putExtra("meetingTime", meetingTime);
            startActivity(intent);
        }
    };
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) AdapterView(android.widget.AdapterView) Intent(android.content.Intent) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView)

Example 35 with OnItemClickListener

use of android.widget.AdapterView.OnItemClickListener in project qksms by moezbhatti.

the class QKDialog method setDoubleLineItems.

public QKDialog setDoubleLineItems(String[] titles, String[] bodies, final OnItemClickListener onClickListener) {
    int size = Math.min(titles.length, bodies.length);
    DoubleLineListItem[] doubleLineListItems = new DoubleLineListItem[size];
    for (int i = 0; i < size; i++) {
        doubleLineListItems[i] = new DoubleLineListItem();
        doubleLineListItems[i].title = titles[i];
        doubleLineListItems[i].body = bodies[i];
    }
    ArrayAdapter adapter = new DoubleLineArrayAdapter(mContext, doubleLineListItems);
    ListView listView = new ListView(mContext);
    listView.setAdapter(adapter);
    listView.setDivider(null);
    listView.setPadding(0, Units.dpToPx(mContext, 8), 0, Units.dpToPx(mContext, 8));
    listView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (onClickListener != null) {
                onClickListener.onItemClick(parent, view, position, id);
                dismiss();
            }
        }
    });
    return setCustomView(listView);
}
Also used : ListView(android.widget.ListView) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) QKTextView(com.moez.QKSMS.ui.view.QKTextView) View(android.view.View) AdapterView(android.widget.AdapterView) RecyclerView(android.support.v7.widget.RecyclerView) ScrollView(android.widget.ScrollView) ListView(android.widget.ListView) ArrayAdapter(android.widget.ArrayAdapter)

Aggregations

OnItemClickListener (android.widget.AdapterView.OnItemClickListener)142 AdapterView (android.widget.AdapterView)141 View (android.view.View)140 ListView (android.widget.ListView)107 TextView (android.widget.TextView)74 Intent (android.content.Intent)44 ImageView (android.widget.ImageView)44 OnClickListener (android.view.View.OnClickListener)26 Bundle (android.os.Bundle)18 ArrayAdapter (android.widget.ArrayAdapter)17 SuppressLint (android.annotation.SuppressLint)15 LayoutInflater (android.view.LayoutInflater)13 Paint (android.graphics.Paint)12 GridView (android.widget.GridView)12 ColorDrawable (android.graphics.drawable.ColorDrawable)11 DialogInterface (android.content.DialogInterface)10 CheckBox (android.widget.CheckBox)9 LinearLayout (android.widget.LinearLayout)9 ArrayList (java.util.ArrayList)8 OnItemLongClickListener (android.widget.AdapterView.OnItemLongClickListener)6