Search in sources :

Example 1 with BaseContentFloatView

use of com.blankj.utildebug.base.view.BaseContentFloatView in project AndroidUtilCode by Blankj.

the class SpViewerContentView method onAttach.

@Override
public void onAttach() {
    spViewTitle = findViewById(R.id.spViewTitle);
    spViewSearchEt = findViewById(R.id.spViewSearchEt);
    spViewRv = findViewById(R.id.spViewRv);
    spViewTitle.setText(mSpName);
    mAdapter = new BaseItemAdapter<>();
    mSrcItems = SpItem.getSpItems(mSPUtils);
    mAdapter.setItems(mSrcItems);
    spViewRv.setAdapter(mAdapter);
    spViewRv.setLayoutManager(new LinearLayoutManager(getContext()));
    spViewRv.addItemDecoration(new RecycleViewDivider(getContext(), RecycleViewDivider.VERTICAL, R.drawable.du_shape_divider));
    spViewSearchEt.setOnTextChangedListener(new SearchEditText.OnTextChangedListener() {

        @Override
        public void onTextChanged(String text) {
            mAdapter.setItems(SpItem.filterItems(mSrcItems, text));
            mAdapter.notifyDataSetChanged();
        }
    });
    setOnRefreshListener(spViewRv, new OnRefreshListener() {

        @Override
        public void onRefresh(BaseContentFloatView floatView) {
            mSrcItems = SpItem.getSpItems(mSPUtils);
            mAdapter.setItems(mSrcItems);
            mAdapter.notifyDataSetChanged();
            spViewSearchEt.reset();
            floatView.closeRefresh();
        }
    });
}
Also used : RecycleViewDivider(com.blankj.utildebug.base.rv.RecycleViewDivider) SearchEditText(com.blankj.utildebug.base.view.SearchEditText) BaseContentFloatView(com.blankj.utildebug.base.view.BaseContentFloatView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) OnRefreshListener(com.blankj.utildebug.base.view.listener.OnRefreshListener)

Example 2 with BaseContentFloatView

use of com.blankj.utildebug.base.view.BaseContentFloatView in project AndroidUtilCode by Blankj.

the class DeviceInfoFloatView method initContentView.

@Override
public void initContentView() {
    deviceInfoRv = findViewById(R.id.deviceInfoRv);
    final BaseItemAdapter<DeviceInfoItem> adapter = new BaseItemAdapter<>();
    adapter.setItems(DeviceInfoItem.getAppInfoItems());
    deviceInfoRv.setAdapter(adapter);
    deviceInfoRv.setLayoutManager(new LinearLayoutManager(getContext()));
    deviceInfoRv.addItemDecoration(new RecycleViewDivider(getContext(), RecycleViewDivider.VERTICAL, R.drawable.du_shape_divider));
    getContentView().setOnRefreshListener(deviceInfoRv, new OnRefreshListener() {

        @Override
        public void onRefresh(final BaseContentFloatView floatView) {
            adapter.setItems(DeviceInfoItem.getAppInfoItems());
            adapter.notifyDataSetChanged();
            floatView.closeRefresh();
        }
    });
}
Also used : RecycleViewDivider(com.blankj.utildebug.base.rv.RecycleViewDivider) BaseContentFloatView(com.blankj.utildebug.base.view.BaseContentFloatView) BaseItemAdapter(com.blankj.utildebug.base.rv.BaseItemAdapter) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) OnRefreshListener(com.blankj.utildebug.base.view.listener.OnRefreshListener)

Example 3 with BaseContentFloatView

use of com.blankj.utildebug.base.view.BaseContentFloatView in project AndroidUtilCode by Blankj.

the class FileContentView method onAttach.

@Override
public void onAttach() {
    fileExplorerSearchEt = findViewById(R.id.fileExplorerSearchEt);
    fileExplorerRv = findViewById(R.id.fileExplorerRv);
    if (FileItem.isEmptyItems(mSrcItems)) {
        fileExplorerSearchEt.setVisibility(GONE);
    }
    mAdapter = new BaseItemAdapter<>();
    mAdapter.setItems(mSrcItems);
    fileExplorerRv.setAdapter(mAdapter);
    fileExplorerRv.setLayoutManager(new LinearLayoutManager(getContext()));
    fileExplorerRv.addItemDecoration(new RecycleViewDivider(getContext(), RecycleViewDivider.VERTICAL, R.drawable.du_shape_file_divider));
    fileExplorerSearchEt.setOnTextChangedListener(new SearchEditText.OnTextChangedListener() {

        @Override
        public void onTextChanged(String text) {
            mAdapter.setItems(FileItem.filterItems(mSrcItems, text));
            mAdapter.notifyDataSetChanged();
        }
    });
    setOnRefreshListener(fileExplorerRv, new OnRefreshListener() {

        @Override
        public void onRefresh(BaseContentFloatView floatView) {
            mSrcItems = FileItem.getFileItems(mParent);
            mAdapter.setItems(mSrcItems);
            mAdapter.notifyDataSetChanged();
            fileExplorerSearchEt.reset();
            floatView.closeRefresh();
        }
    });
}
Also used : RecycleViewDivider(com.blankj.utildebug.base.rv.RecycleViewDivider) SearchEditText(com.blankj.utildebug.base.view.SearchEditText) BaseContentFloatView(com.blankj.utildebug.base.view.BaseContentFloatView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) OnRefreshListener(com.blankj.utildebug.base.view.listener.OnRefreshListener)

Aggregations

LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)3 RecycleViewDivider (com.blankj.utildebug.base.rv.RecycleViewDivider)3 BaseContentFloatView (com.blankj.utildebug.base.view.BaseContentFloatView)3 OnRefreshListener (com.blankj.utildebug.base.view.listener.OnRefreshListener)3 SearchEditText (com.blankj.utildebug.base.view.SearchEditText)2 BaseItemAdapter (com.blankj.utildebug.base.rv.BaseItemAdapter)1