private void onRefresh(View view, String showText) { expandTabView.onPressBack(); int position = getPositon(view); if (position >= 0 && !expandTabView.getTitle(position).equals(showText)) { expandTabView.setTitle(showText, position); } Toast.makeText(YouHuiQuanActivity.this, showText, Toast.LENGTH_SHORT).show(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tab_youhuiquan); // dialog =new MyProcessDialog(YouHuiQuanActivity.this); myApp = (MyApp) YouHuiQuanActivity.this.getApplication(); listview = (PullView) findViewById(R.id.listview); moreView = getLayoutInflater().inflate(R.layout.list_more_load, null); adapter = new YouHuiQuanListViewAdapter(YouHuiQuanActivity.this); youhuiquan_list = new ArrayList<YouHuiQuanList>(); listview.setAdapter(adapter); adapter.notifyDataSetChanged(); listview.setOnScrollListener(this); // 设置listview的滚动事件 ListViewInFo(pageno = 1); expandTabView = (ExpandTabView) findViewById(R.id.expandtab_view); viewMiddle = new ViewMiddle(this); view_l = new ViewMiddle(this); view_r = new ViewMiddle(this); mViewArray.add(viewMiddle); mViewArray.add(view_l); mViewArray.add(view_r); mTextArray.add("全部地区"); mTextArray.add("全部分类"); mTextArray.add("默认排序"); expandTabView.setValue(mTextArray, mViewArray); viewMiddle.setOnSelectListener( new ViewMiddle.OnSelectListener() { @Override public void getValue(String showText) { onRefresh(viewMiddle, showText); } }); listview.setonRefreshListener( new OnRefreshListener() { @Override public void onRefresh() { listview.removeFooterView(moreView); ListViewInFo(pageno = 1); } }); listview.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { YouHuiQuanList you = (YouHuiQuanList) listview.getItemAtPosition(arg2); Intent intent = new Intent(YouHuiQuanActivity.this, YouHuiQuanDetalisActivity.class); intent.putExtra("coupon_id", you.getCoupon_id() + ""); YouHuiQuanActivity.this.startActivity(intent); } }); }