Search in sources :

Example 1 with BaseItemAdapter

use of com.blankj.utildebug.base.rv.BaseItemAdapter in project AndroidUtilCode by Blankj.

the class DebugMenuItem method bind.

@Override
public void bind(@NonNull ItemViewHolder holder, int position) {
    TextView menuTitle = holder.findViewById(R.id.menuCategory);
    RecyclerView menuRv = holder.findViewById(R.id.menuRv);
    ShadowHelper.applyMenu(holder.itemView);
    menuTitle.setText(mTitle);
    BaseItemAdapter<DebugItem> adapter = new BaseItemAdapter<>();
    adapter.setItems(DebugItem.getDebugItems(mDebugs));
    menuRv.setAdapter(adapter);
    menuRv.setLayoutManager(new GridLayoutManager(menuRv.getContext(), 4));
}
Also used : GridLayoutManager(androidx.recyclerview.widget.GridLayoutManager) TextView(android.widget.TextView) RecyclerView(androidx.recyclerview.widget.RecyclerView) BaseItemAdapter(com.blankj.utildebug.base.rv.BaseItemAdapter)

Example 2 with BaseItemAdapter

use of com.blankj.utildebug.base.rv.BaseItemAdapter 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 BaseItemAdapter

use of com.blankj.utildebug.base.rv.BaseItemAdapter in project AndroidUtilCode by Blankj.

the class AppInfoFloatView method initContentView.

@Override
public void initContentView() {
    appInfoRv = findViewById(R.id.appInfoRv);
    BaseItemAdapter<AppInfoItem> adapter = new BaseItemAdapter<>();
    adapter.setItems(AppInfoItem.getAppInfoItems());
    appInfoRv.setAdapter(adapter);
    appInfoRv.setLayoutManager(new LinearLayoutManager(getContext()));
    appInfoRv.addItemDecoration(new RecycleViewDivider(getContext(), RecycleViewDivider.VERTICAL, R.drawable.du_shape_divider));
}
Also used : RecycleViewDivider(com.blankj.utildebug.base.rv.RecycleViewDivider) BaseItemAdapter(com.blankj.utildebug.base.rv.BaseItemAdapter) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Aggregations

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