|
@@ -5,21 +5,27 @@ import android.content.Context;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
-import android.widget.Button;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
|
+import androidx.appcompat.view.menu.MenuWrapperICS;
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
|
|
import com.noahvogt.miniprojekt.R;
|
|
|
+import com.noahvogt.miniprojekt.ui.DataBase.Data;
|
|
|
+import com.noahvogt.miniprojekt.ui.DataBase.Message;
|
|
|
+import com.noahvogt.miniprojekt.ui.gallery.GalleryFragment;
|
|
|
|
|
|
-import org.w3c.dom.Text;
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder> {
|
|
|
|
|
|
- private List<Data> localDataSet;
|
|
|
+ public static Message content = new Message();
|
|
|
+
|
|
|
+ private List<Message> localDataSet;
|
|
|
|
|
|
/**
|
|
|
* Provide a reference to the type of views that you are using
|
|
@@ -52,11 +58,12 @@ public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder
|
|
|
* @param dataSet String[] containing the data to populate views to be used
|
|
|
* by RecyclerView.
|
|
|
*/
|
|
|
- public CustomAdapter(List<Data> dataSet) {
|
|
|
+ public CustomAdapter(List<Message> dataSet) {
|
|
|
localDataSet = dataSet;
|
|
|
}
|
|
|
|
|
|
// Create new views (invoked by the layout manager)
|
|
|
+ @NotNull
|
|
|
@Override
|
|
|
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
|
|
|
// Create a new view, which defines the UI of the list item
|
|
@@ -82,7 +89,7 @@ public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder
|
|
|
// contents of the view with that element
|
|
|
//viewHolder.getTextView().setText(localDataSet[position]);
|
|
|
// Get the data model based on position
|
|
|
- Data contact = localDataSet.get(position);
|
|
|
+ Message contact = localDataSet.get(position);
|
|
|
|
|
|
// Set item views based on your views and data model
|
|
|
TextView nameView = viewHolder.name;
|
|
@@ -90,11 +97,11 @@ public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder
|
|
|
TextView dateView = viewHolder.date;
|
|
|
TextView beginView = viewHolder.begin;
|
|
|
|
|
|
- nameView.setText(contact.getName());
|
|
|
+ nameView.setText(contact.getFrom());
|
|
|
betreffView.setText(contact.getBetreff());
|
|
|
dateView.setText(contact.getDate());
|
|
|
- beginView.setText(contact.getBegin());
|
|
|
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
@@ -103,5 +110,71 @@ public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder
|
|
|
public int getItemCount() {
|
|
|
return localDataSet.size();
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //to set the content of the Sentfolder by changing the adapter
|
|
|
+ public static void setSent(int numItems){
|
|
|
+
|
|
|
+ for (int i = 1; i <= numItems; i++){
|
|
|
+ content.setBetreff("Hi");
|
|
|
+ content.setFrom("jeffry");
|
|
|
+ content.setDate("Today");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //to set the content of the Inboxfolder
|
|
|
+ public static void setInbox(int numItems){
|
|
|
+
|
|
|
+ for (int i =1 ; i <= numItems; i++){
|
|
|
+
|
|
|
+ content.setFrom("Hello");
|
|
|
+ content.setDate("Tomorrow");
|
|
|
+ content.setBetreff("Bye");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //to set the content of the Draftfolder
|
|
|
+ public static void setDraft(int numItems){
|
|
|
+
|
|
|
+ for (int i = 1; i <= numItems; i++){
|
|
|
+ content.setFrom("You");
|
|
|
+ content.setDate("noDay");
|
|
|
+ content.setBetreff("i want to die");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public static ArrayList<Message> createEmailList(int numItems){
|
|
|
+ ArrayList<Message> content = new ArrayList<Message>();
|
|
|
+
|
|
|
+
|
|
|
+ for (int i = 1; i <= numItems; i++) {
|
|
|
+ content.add(CustomAdapter.content);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ for (int i = 1; i <= numItems; i++) {
|
|
|
+ content.add(CustomAdapter.content);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ for (int i = 1; i <= numItems; i++) {
|
|
|
+ content.add(CustomAdapter.content);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return content;
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|