diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index d67eed9..d03fd7d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -14,10 +14,12 @@
tools:targetApi="31">
+ android:exported="false"
+ android:theme="@style/Theme.AppCompat.DayNight.NoActionBar"/>
+ android:exported="false"
+ android:theme="@style/Theme.AppCompat.DayNight.NoActionBar"/>
{
- Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
- v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
- return insets;
- });
+// ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
+// Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
+// v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
+// return insets;
+// });
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/notemania/notedetails.java b/app/src/main/java/com/example/notemania/notedetails.java
index d951f8a..d02d2a8 100644
--- a/app/src/main/java/com/example/notemania/notedetails.java
+++ b/app/src/main/java/com/example/notemania/notedetails.java
@@ -1,6 +1,7 @@
package com.example.notemania;
import android.os.Bundle;
+import android.widget.TextView;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
@@ -8,17 +9,24 @@
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
+import com.google.android.material.floatingactionbutton.FloatingActionButton;
+
public class notedetails extends AppCompatActivity {
+ private TextView mtitleofnotedetail,mcontentofnotedetail;
+ FloatingActionButton mgotoeditnote;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- EdgeToEdge.enable(this);
+// EdgeToEdge.enable(this);
setContentView(R.layout.activity_notedetails);
- ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
- Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
- v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
- return insets;
- });
+// ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
+// Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
+// v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
+// return insets;
+// });
+ mtitleofnotedetail=findViewById(R.id.titleofnotedetail);
+ mcontentofnotedetail=findViewById(R.id.contentofnotedetail);
+ mgotoeditnote=findViewById(R.id.gotoeditnote);
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/notemania/notesActivity.java b/app/src/main/java/com/example/notemania/notesActivity.java
index bfe10fd..4e602e2 100644
--- a/app/src/main/java/com/example/notemania/notesActivity.java
+++ b/app/src/main/java/com/example/notemania/notesActivity.java
@@ -21,9 +21,12 @@
import com.firebase.ui.firestore.FirestoreRecyclerAdapter;
import com.firebase.ui.firestore.FirestoreRecyclerOptions;
+import com.google.android.gms.tasks.OnFailureListener;
+import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
+import com.google.firebase.firestore.DocumentReference;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.Query;
@@ -79,12 +82,17 @@ protected void onBindViewHolder(@NonNull NoteViewHolder noteViewHolder,int i,@No
noteViewHolder.notetitle.setText(firebasemodel.getTitle());
noteViewHolder.notecontent.setText(firebasemodel.getContent());
+ String docId=noteAdapter.getSnapshots().getSnapshot(i).getId();
+
noteViewHolder.itemView.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v){
//we have to open note detail activity
Intent intent=new Intent(v.getContext(),notedetails.class);
+ intent.putExtra("title",firebasemodel.getTitle());
+ intent.putExtra("content",firebasemodel.getContent());
+ intent.putExtra("noteId",docId);
v.getContext().startActivity(intent);
//Toast.makeText(getApplicationContext(),"This is Clicked",Toast.LENGTH_SHORT).show();
}
@@ -99,6 +107,9 @@ public void onClick(View v){
@Override
public boolean onMenuItemClick(@NonNull MenuItem item) {
Intent intent=new Intent(v.getContext(),editnoteactivity.class);
+ intent.putExtra("title",firebasemodel.getTitle());
+ intent.putExtra("content",firebasemodel.getContent());
+ intent.putExtra("noteId",docId);
v.getContext().startActivity(intent);
return false;
}
@@ -106,7 +117,19 @@ public boolean onMenuItemClick(@NonNull MenuItem item) {
popupMenu.getMenu().add("Delete").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener(){
@Override
public boolean onMenuItemClick(MenuItem item){
- Toast.makeText(v.getContext(),"This Note is Deleted",Toast.LENGTH_SHORT).show();
+// Toast.makeText(v.getContext(),"This Note is Deleted",Toast.LENGTH_SHORT).show();
+ DocumentReference documentReference= firebaseFirestore.collection("notes").document(firebaseUser.getUid()).collection("myNotes").document(docId);
+ documentReference.delete().addOnSuccessListener(new OnSuccessListener() {
+ @Override
+ public void onSuccess(Void unused) {
+ Toast.makeText(v.getContext(),"This Note is Deleted",Toast.LENGTH_SHORT).show();
+ }
+ }).addOnFailureListener(new OnFailureListener() {
+ @Override
+ public void onFailure(@NonNull Exception e) {
+ Toast.makeText(v.getContext(),"Failed to Delete",Toast.LENGTH_SHORT).show();
+ }
+ });
return false;
}
});
@@ -176,7 +199,7 @@ protected void onStart() {
protected void onStop() {
super.onStop();
if(noteAdapter!=null){
- noteAdapter.startListening();
+ noteAdapter.stopListening();
}
}
private int getRandomcolor()
diff --git a/app/src/main/res/drawable/baseline_arrow_circle_up_24.xml b/app/src/main/res/drawable/baseline_arrow_circle_up_24.xml
new file mode 100644
index 0000000..3709c31
--- /dev/null
+++ b/app/src/main/res/drawable/baseline_arrow_circle_up_24.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/baseline_edit_24.xml b/app/src/main/res/drawable/baseline_edit_24.xml
new file mode 100644
index 0000000..3c53db7
--- /dev/null
+++ b/app/src/main/res/drawable/baseline_edit_24.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_editnoteactivity.xml b/app/src/main/res/layout/activity_editnoteactivity.xml
index 195f342..25e9920 100644
--- a/app/src/main/res/layout/activity_editnoteactivity.xml
+++ b/app/src/main/res/layout/activity_editnoteactivity.xml
@@ -49,8 +49,8 @@
android:layout_marginBottom="30dp"
android:layout_marginEnd="30dp"
android:id="@+id/saveeditnote"
- android:src="@drawable/update"
+ android:src="@drawable/baseline_arrow_circle_up_24"
app:backgroundTint="#A1F4FB"
- app:maxImageSize="56dp" />
+ app:maxImageSize="40dp" />
diff --git a/app/src/main/res/layout/activity_notedetails.xml b/app/src/main/res/layout/activity_notedetails.xml
index db6f617..d32d4dd 100644
--- a/app/src/main/res/layout/activity_notedetails.xml
+++ b/app/src/main/res/layout/activity_notedetails.xml
@@ -31,7 +31,7 @@
-
+ android:id="@+id/contentofnotedetail">
+
+
+ app:maxImageSize="40dp" />