use of com.example.asus.onlinecanteen.model.Transaction in project OnlineCanteen by josephgunawan97.
the class TransactionCurrentOrderFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getActivity().setTitle("On-Progress");
ArrayList<Transaction> transactions = new ArrayList<>();
adapter = new TransactionHistoryAdapter(this);
adapter.setTransactionHistory(transactions);
recyclerView = view.findViewById(R.id.current_recycler_view);
layoutManager = new LinearLayoutManager(getContext());
recyclerView.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
recyclerView.setLayoutManager(layoutManager);
recyclerView.setAdapter(adapter);
}
use of com.example.asus.onlinecanteen.model.Transaction in project OnlineCanteen by josephgunawan97.
the class TransactionHistoryFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getActivity().setTitle(R.string.history_title_item);
ArrayList<Transaction> transactions = new ArrayList<>();
adapter = new TransactionHistoryAdapter(this);
adapter.setTransactionHistory(transactions);
recyclerView = view.findViewById(R.id.history_recycler_view);
layoutManager = new LinearLayoutManager(getContext());
recyclerView.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
recyclerView.setLayoutManager(layoutManager);
recyclerView.setAdapter(adapter);
}
use of com.example.asus.onlinecanteen.model.Transaction in project OnlineCanteen by josephgunawan97.
the class TransactionHistoryAdapter method onBindViewHolder.
/**
* Bind the view with data at the specified position
* @param holder ViewHolder which should be updated
* @param position position of items in the adapter
*/
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
// Get Transaction Item
final Transaction transaction = transactionHistory.get(position);
// Set Information on View
FirebaseDatabase.getInstance().getReference().child("store").child(transaction.getSid()).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
holder.storeNameTextView.setText(dataSnapshot.child("storeName").getValue().toString());
// Log.i(MerchantOrderListFragment.class.getSimpleName(),"IF+ "+merchant.getDisplayName() +" "+ trans.getSid());
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
holder.transactionDateTextView.setText(Transaction.getPurchasedDateString(transaction.getPurchaseDate()));
holder.paymentAmountTextView.setText("Rp " + String.valueOf(transaction.getTotalPrice()));
holder.statusTextView.setText(statusString(transaction.getDeliveryStatus()));
}
Aggregations