-1
I want to filter what will appear in Recyclerview, is possible?
There is a Calendarview and I want that when someone clicks on a day from the calendarview, it shows itemviews only from that date, for example, when someone clicks on the 15th of the month can, it shows only the tasks of that day
I don’t know if it’s possible. If anyone can help me, it would be great.
package com.iza.letfly;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Paint;
import android.os.Build;
import android.preference.PreferenceManager;
import android.text.Html;
import android.util.SparseBooleanArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
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 java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class AdapterDoes extends RecyclerView.Adapter<AdapterDoes.MyViewHolder> {
Context context;
ArrayList<Mydoes> mydoes;
FirebaseFirestore firestore;
FirebaseUser user;
public AdapterDoes(Context c, ArrayList<Mydoes> p){
context = c;
mydoes = p;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup ViewGroup, int i) {
return new MyViewHolder(LayoutInflater.from(context).inflate(R.layout.item_does, ViewGroup, false));
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, int i) {
myViewHolder.titleDoes.setText(mydoes.get(i).getTitleDoes());
myViewHolder.DescribeDoes.setText(mydoes.get(i).getDescribeDoes());
myViewHolder.dateDoes.setText(mydoes.get(i).getDateDoes());
myViewHolder.alarm.setText(mydoes.get(i).getAlarm());
myViewHolder.checkBox2.setText(mydoes.get(i).getCheck());
myViewHolder.checkBox2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (myViewHolder.checkBox2.isChecked()){
myViewHolder.checkBox2.setChecked(false);
}else{
myViewHolder.checkBox2.setChecked(true);
}
}
});
if(myViewHolder.checkBox2.getText().equals("CHECKED")){
myViewHolder.checkBox2.setChecked(true);
myViewHolder.titleDoes.setAlpha(0.4f);
myViewHolder.DescribeDoes.setAlpha(0.5f);
myViewHolder.DescribeDoes.setPaintFlags(myViewHolder.DescribeDoes.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
myViewHolder.titleDoes.setPaintFlags(myViewHolder.titleDoes.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
}
if(myViewHolder.checkBox2.getText().equals("UNCHECKED")){
myViewHolder.checkBox2.setChecked(false);
}
myViewHolder.itemView.setOnClickListener(new View.OnClickListener() {
final String getTitleDoes = mydoes.get(i).getTitleDoes();
final String getDescribeDoes = mydoes.get(i).getDescribeDoes();
final String getDateDoes = mydoes.get(i).getDateDoes();
final String getAlarm = mydoes.get(i).getAlarm();
final String getKeyDoes = mydoes.get(i).getKeyDoes();
final String getCheck = mydoes.get(i).getCheck();
@Override
public void onClick(View v) {
Intent i = new Intent(context,Edit_Check.class);
i.putExtra("titleDoes",getTitleDoes);
i.putExtra("DescribeDoes",getDescribeDoes);
i.putExtra("dateDoes",getDateDoes);
i.putExtra("alarm",getAlarm);
i.putExtra("keyDoes",getKeyDoes);
i.putExtra("check", getCheck);
context.startActivity(i);
}
});
}
@Override
public int getItemCount() {
return mydoes.size();
}
class MyViewHolder extends RecyclerView.ViewHolder {
TextView titleDoes,DescribeDoes,dateDoes, alarm, keyDoes;
CheckBox checkBox2;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
titleDoes = (TextView) itemView.findViewById(R.id.titleDoes);
DescribeDoes = (TextView) itemView.findViewById(R.id.DescribeDoes);
dateDoes = (TextView) itemView.findViewById(R.id.dateDoes);
alarm = (TextView) itemView.findViewById(R.id.alarm);
checkBox2 = (CheckBox) itemView.findViewById(R.id.checkBox2);
}
}
}