Search in sources :

Example 1 with ProductListAdapter

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

the class MerchantProductListFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_main_activity_merchant, container, false);
    // Inflate the layout for this fragment
    ArrayList<Product> productArrayList = new ArrayList<>();
    menuListAdapter = new ProductListAdapter((Activity) container.getContext(), productArrayList);
    swipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.swiperefresh);
    swipeLayout.setOnRefreshListener(this);
    swipeLayout.setColorSchemeResources(R.color.colorPrimary, R.color.colorPrimaryDark, R.color.colorPrimaryLight);
    firebaseAuth = FirebaseAuth.getInstance();
    merchant = firebaseAuth.getCurrentUser();
    // Initialize References
    databaseUsers = FirebaseDatabase.getInstance().getReference("users");
    databaseProducts = FirebaseDatabase.getInstance().getReference("products");
    databaseStore = FirebaseDatabase.getInstance().getReference("store");
    // Initialize ListView
    productListView = view.findViewById(R.id.gridview);
    productListView.setAdapter(menuListAdapter);
    return view;
}
Also used : ProductListAdapter(com.example.asus.onlinecanteen.adapter.ProductListAdapter) ArrayList(java.util.ArrayList) Product(com.example.asus.onlinecanteen.model.Product) Activity(android.app.Activity) GridView(android.widget.GridView) View(android.view.View) ListView(android.widget.ListView)

Aggregations

Activity (android.app.Activity)1 View (android.view.View)1 GridView (android.widget.GridView)1 ListView (android.widget.ListView)1 ProductListAdapter (com.example.asus.onlinecanteen.adapter.ProductListAdapter)1 Product (com.example.asus.onlinecanteen.model.Product)1 ArrayList (java.util.ArrayList)1