Skip to content

Commit

Permalink
Fixed Remove CartItem issue
Browse files Browse the repository at this point in the history
  • Loading branch information
banditVedant committed Sep 12, 2023
1 parent 725481c commit 4c68246
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
17 changes: 10 additions & 7 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,22 @@
android:exported="false" />
<activity
android:name=".ui.CreatePasscode"
android:exported="true" />
android:exported="true" >
</activity>

<activity
android:name=".ui.NavigationDrawer_Dashboard"
android:label="Dashboard Activity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.LAUNCHER" />
<data
android:host="bugbazaar"
android:scheme="bb"
android:pathPrefix="/dashboard">
</data>
</intent-filter>

</activity>
<activity
android:name=".ui.MyProfile"
Expand All @@ -89,7 +87,12 @@
<activity
android:name=".ui.Signin"
android:clearTaskOnLaunch="true"
android:exported="true" />
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<meta-data
android:name="preloaded_fonts"
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/BugBazaar/ui/cart/CartItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public void setId(long id) {
this.id = id;
}


// Increment the quantity by 1
public void incrementQuantity(Context context) {
if (quantity < Integer.MAX_VALUE) { // To avoid overflow
Expand Down Expand Up @@ -101,10 +102,9 @@ public void decrementQuantity(Context context) {
}
public void removeItem(Context context){
quantity=0;
// Update the database with the new quantity
CartDatabaseHelper dbHelper = new CartDatabaseHelper(context, "cart.db", null, 1);
Log.d("removeID",String.valueOf(id));
dbHelper.removeCartItem(this); // Pass the item's ID for removal

dbHelper.updateCartItem(this);
}


Expand Down

0 comments on commit 4c68246

Please sign in to comment.