Search in sources :

Example 6 with Cart

use of com.example.asus.onlinecanteen.model.Cart in project OnlineCanteen by josephgunawan97.

the class UserOrderProductAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
    // Get product and cart
    Cart cart = orders.get(position);
    Product product = products.get(position);
    // Set on view
    holder.userOrderProductNameTextView.setText(cart.getProductName());
    holder.userOrderProductPriceTextView.setText("Rp " + String.valueOf(cart.getProductPrice()));
    holder.userOrderProductQuantityTextView.setText(String.valueOf(cart.getQuantity()));
    // Get image
    if (product.getImageUrl() != null) {
        Glide.with(holder.userOrderProductImageView.getContext()).load(product.getImageUrl()).into(holder.userOrderProductImageView);
    }
}
Also used : Product(com.example.asus.onlinecanteen.model.Product) Cart(com.example.asus.onlinecanteen.model.Cart)

Aggregations

Cart (com.example.asus.onlinecanteen.model.Cart)6 DialogInterface (android.content.DialogInterface)3 Intent (android.content.Intent)3 AlertDialog (android.support.v7.app.AlertDialog)3 View (android.view.View)3 TextView (android.widget.TextView)3 ArrayList (java.util.ArrayList)3 ListView (android.widget.ListView)2 Product (com.example.asus.onlinecanteen.model.Product)2 DataSnapshot (com.google.firebase.database.DataSnapshot)2 DatabaseError (com.google.firebase.database.DatabaseError)2 ValueEventListener (com.google.firebase.database.ValueEventListener)2 Activity (android.app.Activity)1 NavigationView (android.support.design.widget.NavigationView)1 DrawerLayout (android.support.v4.widget.DrawerLayout)1 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)1 LayoutInflater (android.view.LayoutInflater)1 ImageView (android.widget.ImageView)1 CartActivityAdapter (com.example.asus.onlinecanteen.adapter.CartActivityAdapter)1 MenuListAdapter (com.example.asus.onlinecanteen.adapter.MenuListAdapter)1