| | |
| | | import com.hdl.photovoltaic.ui.adapter.MessageHouseAdapter; |
| | | import com.hdl.photovoltaic.ui.bean.MessageBean; |
| | | import com.hdl.photovoltaic.ui.bean.UnCountBean; |
| | | import com.hdl.photovoltaic.ui.powerstation.HouseSearchActivity; |
| | | import com.hdl.photovoltaic.utils.KeyboardStateObserverUtils; |
| | | import com.hdl.photovoltaic.widget.refreshlayout.BGARefreshLayout; |
| | | import com.hdl.photovoltaic.widget.refreshlayout.HDLRefreshViewHolder; |
| | |
| | | |
| | | private void initEvent() { |
| | | //搜索 |
| | | viewBinding.powerStationSearchEt.addTextChangedListener(powerStationSearchWatcher); |
| | | //清除搜索文案 |
| | | viewBinding.powerStationClearIv.setOnClickListener(new View.OnClickListener() { |
| | | viewBinding.powerStationSearchCl.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | viewBinding.powerStationSearchEt.setText(""); |
| | | viewBinding.powerStationClearIv.setVisibility(View.GONE); |
| | | getMessageHouseList("", false); |
| | | |
| | | Intent intent = new Intent(); |
| | | intent.setClass(_mActivity, SearchMessageHouseActivity.class); |
| | | startActivity(intent); |
| | | } |
| | | }); |
| | | //全部已读 |
| | |
| | | viewBinding.houseListRcv.setLayoutManager(new LinearLayoutManager(_mActivity)); |
| | | viewBinding.houseListRcv.setAdapter(mMessageHouseAdapter); |
| | | this.pullToRefresh(); |
| | | //在界面中使用 |
| | | KeyboardStateObserverUtils.getKeyboardStateObserver(_mActivity).setKeyboardVisibilityListener(new KeyboardStateObserverUtils.OnKeyboardVisibilityListener() { |
| | | @Override |
| | | public void onKeyboardShow(int h) { |
| | | //Toast.makeText(MainActivity.this,"键盘弹出",Toast.LENGTH_SHORT).show(); |
| | | // viewBinding.messageSearchEt.requestFocus(); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | |
| | | public void onKeyboardHide(int h) { |
| | | viewBinding.powerStationSearchEt.clearFocus(); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private final TextWatcher powerStationSearchWatcher = new TextWatcher() { |
| | | @Override |
| | | public void beforeTextChanged(CharSequence s, int start, int count, int after) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onTextChanged(CharSequence s, int start, int before, int count) { |
| | | //搜索关键字 |
| | | String currSearchText = s.toString().replace(" ", ""); |
| | | if (TextUtils.isEmpty(currSearchText)) { |
| | | viewBinding.powerStationClearIv.setVisibility(View.GONE); |
| | | // HdlThreadLogic.toast(_mActivity, R.string.search_content_null); |
| | | return; |
| | | } |
| | | viewBinding.powerStationClearIv.setVisibility(View.VISIBLE); |
| | | viewBinding.powerStationSearchEt.clearFocus(); |
| | | getMessageHouseList(currSearchText, false); |
| | | } |
| | | |
| | | @Override |
| | | public void afterTextChanged(Editable s) { |
| | | |
| | | } |
| | | }; |
| | | |
| | | @Override |
| | | public void onDestroy() { |
| | | super.onDestroy(); |
| | | viewBinding.powerStationSearchEt.removeTextChangedListener(powerStationSearchWatcher); |
| | | } |
| | | } |