Skip to content

Commit

Permalink
points shop without api logic
Browse files Browse the repository at this point in the history
  • Loading branch information
sneh-saraff committed Feb 13, 2025
1 parent b20540b commit d075a75
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 19 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/org/hackillinois/android/API.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ interface API {
suspend fun buyShopItem(@Body body: ItemInstance): ShopItem

@POST("shop/cart/{itemId}")
fun addItemCart(@Path("itemId") itemId : String) : Call<ResponseBody>
fun addItemCart(@Path("itemId") itemId: String) : Call<ResponseBody>

@GET("shop/cart/")
suspend fun getCart(): Cart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,3 @@ data class ShopItem(
var quantity: Int,
var imageURL: String,
)




Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ class CartFragment : Fragment() {
private lateinit var cartAdapter: CartAdapter
private var cartItems: List<Pair<ShopItem, Int>> = listOf()

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
val view = inflater.inflate(R.layout.fragment_point_shop_cart, container, false)

recyclerView = view.findViewById(R.id.recyclerview_point_shop)
Expand Down Expand Up @@ -60,6 +58,4 @@ class CartFragment : Fragment() {
)
cartAdapter.updateCart(cartItems)
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ import org.hackillinois.android.R

class RedeemFragment : Fragment() {

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
val view = inflater.inflate(R.layout.fragment_point_shop_redeem, container, false)

// Handle Back Button Click
Expand All @@ -22,5 +20,5 @@ class RedeemFragment : Fragment() {
requireActivity().supportFragmentManager.popBackStack() // Go back to previous fragment
}
return view
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import kotlinx.android.synthetic.main.shop_tile.view.*
Expand Down Expand Up @@ -71,7 +70,6 @@ class ShopAdapter(private var itemList: List<ShopItem>) :

}


fun updateShop(shopItem: List<ShopItem>) {
this.itemList = shopItem
notifyDataSetChanged()
Expand Down

0 comments on commit d075a75

Please sign in to comment.