Search in sources :

Example 1 with SearchRecordAdapter

use of com.knight.wanandroid.module_home.module_adapter.SearchRecordAdapter in project wanandroid by KnightAndroid.

the class SearchActivity method initView.

@Override
public void initView(Bundle savedInstanceState) {
    mDatabind.setClick(new ProcyClick());
    showLoading(mDatabind.homeSearchhotRv);
    mHomeHotKeyAdapter = new HomeHotKeyAdapter(new ArrayList<>());
    FlexboxLayoutManager flexboxLayoutManager = new FlexboxLayoutManager(this);
    // 方向 主轴为水平方向,起点在左端
    flexboxLayoutManager.setFlexDirection(FlexDirection.ROW);
    // 左对齐
    flexboxLayoutManager.setJustifyContent(JustifyContent.FLEX_START);
    SetInitCustomView.initSwipeRecycleview(mDatabind.homeSearchhotRv, flexboxLayoutManager, mHomeHotKeyAdapter, false);
    SystemUtils.showDelaySoftKeyBoard(mDatabind.homeSearchEt);
    mSearchRecordAdapter = new SearchRecordAdapter(new ArrayList<>());
    SetInitCustomView.initSwipeRecycleview(mDatabind.homeSearchhistroyKeywordRv, new LinearLayoutManager(this), mSearchRecordAdapter, false);
    mDatabind.homeSearchEt.setOnEditorActionListener(new TextView.OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_SEARCH) {
                keyword = mDatabind.homeSearchEt.getText().toString().trim();
                if (TextUtils.isEmpty(keyword)) {
                    ToastUtils.show(R.string.home_input_content_search);
                } else {
                    AppConfig.SEARCH_KEYWORD = keyword;
                    ARouterUtils.startActivity(RoutePathActivity.Home.searchResult, "keyword", keyword);
                }
                return true;
            }
            return false;
        }
    });
    SystemUtils.seteditTextChangeListener(mDatabind.homeSearchEt, mDatabind.homeTvsearchCancel);
    initClickListener();
}
Also used : KeyEvent(android.view.KeyEvent) HomeHotKeyAdapter(com.knight.wanandroid.module_home.module_adapter.HomeHotKeyAdapter) FlexboxLayoutManager(com.google.android.flexbox.FlexboxLayoutManager) ArrayList(java.util.ArrayList) TextView(android.widget.TextView) SearchRecordAdapter(com.knight.wanandroid.module_home.module_adapter.SearchRecordAdapter) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Aggregations

KeyEvent (android.view.KeyEvent)1 TextView (android.widget.TextView)1 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 FlexboxLayoutManager (com.google.android.flexbox.FlexboxLayoutManager)1 HomeHotKeyAdapter (com.knight.wanandroid.module_home.module_adapter.HomeHotKeyAdapter)1 SearchRecordAdapter (com.knight.wanandroid.module_home.module_adapter.SearchRecordAdapter)1 ArrayList (java.util.ArrayList)1