use of com.example.asus.onlinecanteen.adapter.UserProductItemAdapter in project OnlineCanteen by josephgunawan97.
the class UserProductListFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (currentStore != null)
getActivity().setTitle(currentStore.getStoreName());
// Order Floating Action Button
orderButton = view.findViewById(R.id.order_floating_action_button);
orderButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), UserOrderProductActivity.class);
intent.putExtra(UserOrderProductActivity.CURRENT_STORE_KEY, currentStore);
intent.putExtra(UserOrderProductActivity.PRODUCT_LIST_KEY, userProductItemAdapter.getProducts());
startActivity(intent);
}
});
// Set up recycler view
productRecyclerView = view.findViewById(R.id.product_recycler_view);
layoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false);
productRecyclerView.setLayoutManager(layoutManager);
DividerItemDecoration divider = new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL);
productRecyclerView.addItemDecoration(divider);
userProductItemAdapter = new UserProductItemAdapter();
productRecyclerView.setAdapter(userProductItemAdapter);
}
Aggregations