Small improvements

pull/156/head
M66B 6 years ago
parent cded26344c
commit ab11588f78

@ -44,16 +44,17 @@ public class AdapterOrder extends RecyclerView.Adapter<AdapterOrder.ViewHolder>
private LifecycleOwner owner;
private LayoutInflater inflater;
private String clazz;
private List<EntityOrder> items = new ArrayList<>();
public class ViewHolder extends RecyclerView.ViewHolder {
private View view;
private TextView tvTitle;
private TextView tvSubTitle;
ViewHolder(View itemView) {
super(itemView);
view = itemView.findViewById(R.id.clItem);
tvTitle = itemView.findViewById(R.id.tvTitle);
tvSubTitle = itemView.findViewById(R.id.tvSubTitle);
}
@ -65,10 +66,9 @@ public class AdapterOrder extends RecyclerView.Adapter<AdapterOrder.ViewHolder>
}
}
AdapterOrder(Context context, LifecycleOwner owner, String clazz) {
AdapterOrder(Context context, LifecycleOwner owner) {
this.context = context;
this.owner = owner;
this.clazz = clazz;
this.inflater = LayoutInflater.from(context);
setHasStableIds(true);
}

@ -78,7 +78,7 @@ public class FragmentOrder extends FragmentBase {
LinearLayoutManager llm = new LinearLayoutManager(getContext());
rvOrder.setLayoutManager(llm);
adapter = new AdapterOrder(getContext(), getViewLifecycleOwner(), clazz);
adapter = new AdapterOrder(getContext(), getViewLifecycleOwner());
rvOrder.setAdapter(adapter);
new ItemTouchHelper(touchHelper).attachToRecyclerView(rvOrder);

@ -8,6 +8,7 @@
android:id="@+id/clItem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/activatableItemBackground"
android:clickable="true"
android:foreground="?attr/selectableItemBackground"
android:padding="12dp">

Loading…
Cancel
Save