Search in sources :

Example 1 with OrderAdapter

use of com.example.asus.onlinecanteen.adapter.OrderAdapter in project OnlineCanteen by josephgunawan97.

the class MerchantOrderListFragment method detachDatabaseReadListener.

private void detachDatabaseReadListener() {
    if (eventListener != null) {
        adapter.notifyDataSetChanged();
        transactions = new ArrayList<Transaction>();
        adapter = new OrderAdapter(transactions);
        databaseProducts.removeEventListener(eventListener);
        eventListener = null;
    }
}
Also used : Transaction(com.example.asus.onlinecanteen.model.Transaction) OrderAdapter(com.example.asus.onlinecanteen.adapter.OrderAdapter)

Example 2 with OrderAdapter

use of com.example.asus.onlinecanteen.adapter.OrderAdapter in project OnlineCanteen by josephgunawan97.

the class MerchantOrderListFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_main_activity_merchant_order, container, false);
    // Inflate the layout for this fragment
    swipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.swiperefresh);
    swipeLayout.setOnRefreshListener(this);
    swipeLayout.setColorSchemeResources(R.color.colorPrimary, R.color.colorPrimaryDark, R.color.colorPrimaryLight);
    // Initialize References
    databaseTransaction = FirebaseDatabase.getInstance().getReference("transactions");
    databaseProducts = FirebaseDatabase.getInstance().getReference("products");
    databaseStore = FirebaseDatabase.getInstance().getReference("store");
    transactions = new ArrayList<Transaction>();
    adapter = new OrderAdapter(transactions);
    firebaseAuth = FirebaseAuth.getInstance();
    merchant = firebaseAuth.getCurrentUser();
    recyclerView = view.findViewById(R.id.list);
    layoutManager = new LinearLayoutManager(view.getContext());
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setAdapter(adapter);
    return view;
}
Also used : Transaction(com.example.asus.onlinecanteen.model.Transaction) OrderAdapter(com.example.asus.onlinecanteen.adapter.OrderAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) ListView(android.widget.ListView)

Aggregations

OrderAdapter (com.example.asus.onlinecanteen.adapter.OrderAdapter)2 Transaction (com.example.asus.onlinecanteen.model.Transaction)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 ListView (android.widget.ListView)1