コード例 #1
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.subject_search:
       if (filterContent.getVisibility() == 0) {
         mFilterExpand.hideMoreListView();
         //					loadAnim(filterContent);
         filterContent.startAnimation(mAnim);
         filterContent.setVisibility(View.INVISIBLE);
       } else {
         mFilterExpand.openMoreListView();
         filterContent.startAnimation(mLeftAnim);
         filterContent.setVisibility(View.VISIBLE);
       }
       break;
     case R.id.filter_latest:
       mType = 1;
       mFilterLatest.setBackgroundResource(R.drawable.filter_but_l_s);
       mFilterLatest.setTextColor(mColorSelect);
       mFilterPopularity.setTextColor(mColor);
       mFilterStar.setTextColor(mColor);
       mFilterPopularity.setBackgroundResource(R.drawable.filter_but_c);
       mFilterStar.setBackgroundResource(R.drawable.filter_but_r);
       prlistView.setPage(0);
       new GetDataTask().execute();
       break;
     case R.id.filter_popularity:
       mType = 2;
       mFilterLatest.setBackgroundResource(R.drawable.filter_but_l);
       mFilterPopularity.setBackgroundResource(R.drawable.filter_but_c_s);
       mFilterStar.setBackgroundResource(R.drawable.filter_but_r);
       mFilterLatest.setTextColor(mColor);
       mFilterPopularity.setTextColor(mColorSelect);
       mFilterStar.setTextColor(mColor);
       prlistView.setPage(0);
       new GetDataTask().execute();
       break;
     case R.id.filter_price:
       mType = 3;
       mFilterLatest.setBackgroundResource(R.drawable.filter_but_l);
       mFilterPopularity.setBackgroundResource(R.drawable.filter_but_c);
       mFilterStar.setBackgroundResource(R.drawable.filter_but_r_s);
       mFilterLatest.setTextColor(mColor);
       mFilterPopularity.setTextColor(mColor);
       mFilterStar.setTextColor(mColorSelect);
       prlistView.setPage(0);
       new GetDataTask().execute();
       break;
     case R.id.subject_search_value:
       Intent mIntent = new Intent(this, SubjectSearchActivity.class);
       startActivity(mIntent);
       break;
     case R.id.menu_control_level1_but:
       finish();
       break;
   }
 }
コード例 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.subject);

    filter_tab = (LinearLayout) findViewById(R.id.filter_tab);
    LogUtil.d("&&&&&&&&&", filter_tab.getWidth() + "--------width---" + filter_tab.getHeight());

    mFilter = (Button) findViewById(R.id.subject_search);
    mFilter.setFocusable(true);
    mFilter.setClickable(true);
    mFilter.setOnClickListener(this);

    mSearchIB = (ImageButton) findViewById(R.id.subject_search_value);
    mSearchIB.setOnClickListener(this);
    home = (ImageButton) findViewById(R.id.menu_control_level1_but);
    home.setOnClickListener(this);
    initNav();
    lv = (LoadingView) findViewById(R.id.data_loading);
    prlistView = (PullToRefreshListView) findViewById(R.id.obj_list);
    prlistView.setOnRefreshListener(
        new OnRefreshListener() {
          @Override
          public void onRefresh() {
            new GetDataTask().execute();
          }

          @Override
          public void onLoadMore() {
            // TODO Auto-generated method stub
            new GetDataTask().execute();
          }
        });

    data = new ArrayList<SubjectVo>();
    prlistView.setOnItemClickListener(this);

    filterContent = (LinearLayout) findViewById(R.id.filter_content);
    mFilterExpand = (FilterExpand) findViewById(R.id.filter_expand);

    mFilterLatest = (Button) findViewById(R.id.filter_latest);
    mFilterPopularity = (Button) findViewById(R.id.filter_popularity);
    mFilterStar = (Button) findViewById(R.id.filter_price);
    mFilterLatest.setOnClickListener(this);
    mFilterPopularity.setOnClickListener(this);
    mFilterStar.setOnClickListener(this);
    loadAnim(filterContent);
  }