@Override public void afterCreate() { mCategory = getIntent().getStringExtra(EXTRA_CATEGORY); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setNavigationOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); setHeader(); EventBus.getDefault().register(this); // 初始化SwipeRefreshLayout mSwipeRefreshLayout.setColorSchemeResources(R.color.primary_color); initEvent(); // 初始化recyclerview mRvInvitation.setLayoutManager( mLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); // 加载数据并显示加载框 InvitationCondition condition = new InvitationCondition(); condition.setCategory(mCategory); mCondition = condition; showProgress(); mController.loadData(condition); }
@Override public void onClick(View v) { switch (v.getId()) { case R.id.btnFilter: // 弹出筛选对话框 showPopupWindow(); break; case R.id.btnReset: resetPopupwindow(); break; case R.id.btnOk: InvitationCondition condition = new InvitationCondition(); // 性别选择 if (mCbMan.isCheck() && !mCbWomen.isCheck()) { condition.setGender(Constant.GENDER_MAN); } else if (mCbWomen.isCheck() && !mCbMan.isCheck()) { condition.setGender(Constant.GENDER_WOMEN); } else { condition.setGender(Constant.GENDER_ALL); } // 年龄选择 String strMinAge = mEtMinAge.getText().toString(); String strMaxAge = mEtMaxAge.getText().toString(); if (!"".equals(strMinAge)) { condition.setMinAge(Integer.parseInt(strMinAge)); } if (!"".equals(strMaxAge)) { condition.setMaxAge(Integer.parseInt(strMaxAge)); } // 排序选择 if (mCbNearest.isChecked()) { condition.setOrderBy(InvitationCondition.OrderBy.NEAREST); } else if (mCbNewly.isChecked()) { condition.setOrderBy(InvitationCondition.OrderBy.NEWLY); } condition.setCategory(mCategory); mCondition = condition; mController.loadData(condition); showProgress(); mPopupWindow.dismiss(); resetPopupwindow(); break; } }