Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
Added delete function ti delete tasks from database.
Browse files Browse the repository at this point in the history
  • Loading branch information
adityasimant committed Oct 21, 2022
1 parent bd6c5d0 commit 8186bfe
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions app/src/main/java/adapters/dashboard_list_adapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.example.ignite.NotificationActivity;
import com.example.ignite.R;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.FirebaseDatabase;

import java.util.ArrayList;

Expand All @@ -20,6 +25,10 @@
public class dashboard_list_adapter extends RecyclerView.Adapter<dashboard_list_adapter.viewHolde> {


FirebaseDatabase database;
FirebaseUser currentUser ;


ArrayList<AddUser> list;
Context context;

Expand Down Expand Up @@ -50,6 +59,17 @@ public void onBindViewHolder(@NonNull viewHolde holder, int position) {
holder.phonev.setText(model.getPhone_number());
holder.remarkv.setText(model.getRemark());

holder.delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
database = FirebaseDatabase.getInstance();
currentUser = FirebaseAuth.getInstance().getCurrentUser();
database.getReference().child("posts/"+currentUser.getUid()+"/Customer/"
+holder.phonev.getText().toString()).removeValue();

}
});

holder.billv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Expand All @@ -74,6 +94,8 @@ public int getItemCount() {
public class viewHolde extends RecyclerView.ViewHolder{

TextView namev, phonev, emailv, remarkv, billv;
ImageView delete;


public viewHolde(@NonNull View itemView) {
super(itemView);
Expand All @@ -83,6 +105,7 @@ public viewHolde(@NonNull View itemView) {
emailv = itemView.findViewById(R.id.idEmail);
remarkv = itemView.findViewById(R.id.idremark);
billv = itemView.findViewById(R.id.bill_id);
delete = itemView.findViewById(R.id.btn_delete);

}
}
Expand Down

0 comments on commit 8186bfe

Please sign in to comment.