Skip to content

Commit 9cb9016

Browse files
committed
Merge remote-tracking branch 'origin/vedant' into vedant
# Conflicts: # app/src/main/java/com/BugBazaar/ui/NavigationDrawer_Dashboard.java
2 parents 8e04a01 + 10d1f4e commit 9cb9016

File tree

5 files changed

+112
-5
lines changed

5 files changed

+112
-5
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
</queries>
2323

2424
<application
25+
2526
android:allowBackup="true"
2627
android:allowTaskReparenting="true"
2728
android:dataExtractionRules="@xml/data_extraction_rules"

app/src/main/java/com/BugBazaar/ui/NavigationDrawer_Dashboard.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.BugBazaar.R;
2323
import com.BugBazaar.ui.ContactsPack.ReferUs;
2424
import com.BugBazaar.ui.cart.CartActivity;
25+
import com.BugBazaar.ui.cart.CartItem;
2526
import com.BugBazaar.ui.cart.NotificationHelper;
2627
import com.BugBazaar.ui.myorders.OrderHistoryActivity;
2728
import com.google.android.material.navigation.NavigationView;
@@ -46,16 +47,19 @@ protected void onCreate(Bundle savedInstanceState) {
4647
Uri data = getLink.getData();
4748

4849
if (data != null) {
49-
String scheme = data.getScheme();
50-
String host = data.getHost();
51-
String path = data.getPath();
50+
String scheme = data.getScheme(); // Get the scheme (should be "bb")
51+
String host = data.getHost(); // Get the host (should be "bugbazaar.com")
52+
String path = data.getPath(); // Get the path (should be "/dashboard")
53+
5254
// Check if the deep link matches the expected values
5355
if ("bb".equals(scheme) && "bugbazaar.com".equals(host) && "/dashboard".equals(path)) {
5456
// Handle the deep link here, e.g., open the dashboard or perform other actions.
55-
57+
// You can also extract additional data from the deep link if needed.
5658
}
5759
}
5860

61+
// Rest of your activity initialization code
62+
5963
// Hide the keyboard and clear focus from the EditText
6064
View focusedView = getCurrentFocus();
6165
if (focusedView != null) {
@@ -171,6 +175,8 @@ public void onClick(View v) {
171175
startActivity(intent);
172176
drawerLayout.closeDrawer(GravityCompat.START);
173177
return true;
178+
} else if (itemId == R.id.itemWallet) {
179+
Toast.makeText(this, "Wallet is clicked", Toast.LENGTH_SHORT).show();
174180
}
175181
else if (itemId == R.id.itemCart) {
176182
Intent intent =new Intent(this, CartActivity.class);
@@ -194,7 +200,7 @@ else if (itemId == R.id.itemCart) {
194200
return true;
195201
}
196202
else if (itemId == R.id.itemWallet) {
197-
Intent intent = new Intent(NavigationDrawer_Dashboard.this, Wallet.class);
203+
Intent intent = new Intent(NavigationDrawer_Dashboard.this, TermsAndConditionsActivity.class);
198204
startActivity(intent);
199205
drawerLayout.closeDrawer(GravityCompat.START);
200206
return true;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.BugBazaar.utils;
2+
3+
import android.content.Context;
4+
import android.content.SharedPreferences;
5+
6+
public class AppInitializationManager {
7+
private static final String PREF_NAME = "MyAppPreferences";
8+
9+
public static boolean isFirstRun(Context context) {
10+
SharedPreferences sharedPreferences = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
11+
return sharedPreferences.getBoolean("isFirstRun", true);
12+
}
13+
14+
public static void markFirstRunDone(Context context) {
15+
SharedPreferences sharedPreferences = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
16+
SharedPreferences.Editor editor = sharedPreferences.edit();
17+
editor.putBoolean("isFirstRun", false);
18+
editor.apply();
19+
}
20+
21+
public static void showNotification(Context context) {
22+
NotificationUtils.showCustomNotification(context.getApplicationContext());
23+
// Implement your notification logic here
24+
// This can be NotificationUtilsdone using local notifications or Firebase Cloud Messaging
25+
}
26+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.BugBazaar.utils;
2+
3+
import android.app.AlertDialog;
4+
import android.app.PendingIntent;
5+
import android.content.Context;
6+
import android.content.DialogInterface;
7+
8+
public class CustomDialog {
9+
public static void showCustomDialog(Context context, String title, String message, PendingIntent pendingIntent) {
10+
AlertDialog.Builder builder = new AlertDialog.Builder(context);
11+
builder.setTitle(title)
12+
.setMessage(message)
13+
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
14+
public void onClick(DialogInterface dialog, int id) {
15+
16+
}
17+
});
18+
19+
AlertDialog dialog = builder.create();
20+
dialog.show();
21+
}
22+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package com.BugBazaar.utils;
2+
3+
import android.app.Notification;
4+
import android.app.NotificationChannel;
5+
import android.app.NotificationManager;
6+
import android.app.PendingIntent;
7+
import android.content.Context;
8+
import android.content.Intent;
9+
import android.os.Build;
10+
import androidx.core.app.NotificationCompat;
11+
import androidx.core.app.NotificationManagerCompat;
12+
13+
import com.BugBazaar.R;
14+
15+
public class NotificationUtils {
16+
17+
private static final String CHANNEL_ID = "YourChannelId";
18+
private static final int NOTIFICATION_ID = 1;
19+
20+
public static void showCustomNotification(Context context) {
21+
Intent intent = new Intent();
22+
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
23+
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
24+
25+
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_ID)
26+
.setSmallIcon(com.razorpay.R.drawable.common_google_signin_btn_icon_dark)
27+
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
28+
.setAutoCancel(true)
29+
.setContentTitle("Your Title")
30+
.setContentText("Your Notification Content")
31+
.setContentIntent(pendingIntent);
32+
33+
createNotificationChannel(context);
34+
35+
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
36+
notificationManager.notify(NOTIFICATION_ID, builder.build());
37+
}
38+
39+
private static void createNotificationChannel(Context context) {
40+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
41+
CharSequence name = "Your Channel Name";
42+
String description = "Your Channel Description";
43+
int importance = NotificationManager.IMPORTANCE_DEFAULT;
44+
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
45+
channel.setDescription(description);
46+
47+
NotificationManager notificationManager = context.getSystemService(NotificationManager.class);
48+
notificationManager.createNotificationChannel(channel);
49+
}
50+
}
51+
}
52+

0 commit comments

Comments
 (0)