From cd07ea3a0de478225934b330ba8614ca97334496 Mon Sep 17 00:00:00 2001 From: BanditAmit Date: Mon, 29 Jul 2024 01:01:41 +0530 Subject: [PATCH] minor fixed --- app/src/main/AndroidManifest.xml | 2 +- .../com/BugBazaar/controller/UserAuthSave.java | 3 +-- .../com/BugBazaar/message/BugBazaarAddress.java | 15 +++++++++++++++ app/src/main/java/com/BugBazaar/ui/Signin.java | 3 --- .../java/com/BugBazaar/ui/addresses/Address.java | 9 +-------- 5 files changed, 18 insertions(+), 14 deletions(-) create mode 100644 app/src/main/java/com/BugBazaar/message/BugBazaarAddress.java diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b235212..16c3994 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -177,7 +177,7 @@ diff --git a/app/src/main/java/com/BugBazaar/controller/UserAuthSave.java b/app/src/main/java/com/BugBazaar/controller/UserAuthSave.java index 2f2642e..2ffa5d5 100644 --- a/app/src/main/java/com/BugBazaar/controller/UserAuthSave.java +++ b/app/src/main/java/com/BugBazaar/controller/UserAuthSave.java @@ -16,11 +16,10 @@ public class UserAuthSave { private static SharedPreferences sharedPreferences1; private static final String keypasscode_flag = "passcode_flag"; - private static final String USER_DATA = "userCred"; private static SharedPreferences sharedPreferences; private SessionManager sessionManager; // Move the initialization to a constructor - private static SharedPreferences sharedPreferences1; + public UserAuthSave(Context context) { sharedPreferences = context.getSharedPreferences(USER_PREFERENCES, Context.MODE_PRIVATE); diff --git a/app/src/main/java/com/BugBazaar/message/BugBazaarAddress.java b/app/src/main/java/com/BugBazaar/message/BugBazaarAddress.java new file mode 100644 index 0000000..78185fc --- /dev/null +++ b/app/src/main/java/com/BugBazaar/message/BugBazaarAddress.java @@ -0,0 +1,15 @@ +package com.BugBazaar.message; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.widget.Toast; + +public class BugBazaarAddress extends BroadcastReceiver +{ + @Override + public void onReceive(Context context, Intent intent) { + Toast.makeText(context.getApplicationContext(), "Address has been saved Successfully", Toast.LENGTH_SHORT).show(); + } +} + diff --git a/app/src/main/java/com/BugBazaar/ui/Signin.java b/app/src/main/java/com/BugBazaar/ui/Signin.java index 500114f..feb1694 100644 --- a/app/src/main/java/com/BugBazaar/ui/Signin.java +++ b/app/src/main/java/com/BugBazaar/ui/Signin.java @@ -89,9 +89,6 @@ public void onClick(View v) { userAuthSave.saveUserData( randomToken,isLoggedin); userAuthSave.saveuserCred(username,password); sessionManager.setLoggedIn(true); - String randomToken = TokenGenerator.generateRandomToken(64); - userAuthSave.saveUserData( randomToken,isLoggedin); - userAuthSave.saveuserCred(username,password); // Successful login, do something (e.g., start a new activity) Toast.makeText(Signin.this, "Login successful!", Toast.LENGTH_SHORT).show(); diff --git a/app/src/main/java/com/BugBazaar/ui/addresses/Address.java b/app/src/main/java/com/BugBazaar/ui/addresses/Address.java index 597afd8..ae3da34 100644 --- a/app/src/main/java/com/BugBazaar/ui/addresses/Address.java +++ b/app/src/main/java/com/BugBazaar/ui/addresses/Address.java @@ -43,13 +43,6 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_address); addressListLayout = findViewById(R.id.addressListLayout); - /// - - - - - - /// //Toolbar title set @@ -100,7 +93,7 @@ public void onClick(View v) { } else { addressListLayout.removeAllViews(); // Insert data into the SQLite database - + dbHelper.insertAddress(nickname, address); sendacrosscomponents(nickname,address); List addresses = dbHelper.getAllAddresses();