From f4623b2d45911e4ca0a46d40203b4f786424d19c Mon Sep 17 00:00:00 2001 From: Naiki00 Date: Fri, 8 Jan 2021 16:02:11 +0100 Subject: [PATCH] Dodanie dziedziczenia RecyclerView do Adapetera notatki oraz implementacja ViewHoldera --- .../example/notatkon/note/NoteAdapter.java | 51 ++++++++++++++++++- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/example/notatkon/note/NoteAdapter.java b/app/src/main/java/com/example/notatkon/note/NoteAdapter.java index eb0c78d..b73ff32 100644 --- a/app/src/main/java/com/example/notatkon/note/NoteAdapter.java +++ b/app/src/main/java/com/example/notatkon/note/NoteAdapter.java @@ -1,4 +1,51 @@ package com.example.notatkon.note; -public class NoteAdapter { -} +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.notatkon.R; + +import org.w3c.dom.Text; + +import java.util.ArrayList; + +public class NoteAdapter extends RecyclerView.Adapter{ + + private ArrayList arrNotes = new ArrayList<>(); + + //obiekt listy notatek + private RecyclerView noteRecyclerView; + + //implementacja ViewHoldera + //https://developer.android.com/guide/topics/ui/layout/recyclerview + private class NoteViewHolder extends RecyclerView.ViewHolder { + public TextView noteTitle; + public TextView noteContent; + + public NoteViewHolder(@NonNull View itemView) { + super(itemView); + noteTitle = (TextView) itemView.findViewById(R.id.note_title); + noteContent = (TextView) itemView.findViewById(R.id.note_content); + } + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return null; + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + + } + + @Override + public int getItemCount() { + return 0; + } +} \ No newline at end of file