mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-26 17:53:14 +00:00
ListItemPageを宣言
ListItemのコードを削除
This commit is contained in:
parent
87e734332c
commit
341b694298
|
@ -8,15 +8,17 @@ import android.widget.TextView;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import one.nem.lacerta.model.ListItem;
|
||||
import one.nem.lacerta.model.document.DocumentMeta;
|
||||
|
||||
public class DocumentAdapter extends RecyclerView.Adapter<DocumentAdapter.DocumentViewHolder> {
|
||||
|
||||
private List<DocumentMeta> documentMetas;
|
||||
private ArrayList<ListItem> documentMetas;
|
||||
|
||||
public DocumentAdapter(List<DocumentMeta> documentMetas) {
|
||||
public DocumentAdapter(ArrayList<ListItem> documentMetas) {
|
||||
// nullの場合に例外を発生させる
|
||||
if (documentMetas == null) {
|
||||
throw new IllegalArgumentException("DocumentMetas list cannot be null or empty");
|
||||
|
@ -33,7 +35,7 @@ public class DocumentAdapter extends RecyclerView.Adapter<DocumentAdapter.Docume
|
|||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull DocumentViewHolder holder, int position) {
|
||||
DocumentMeta documentMeta = documentMetas.get(position);
|
||||
ListItem documentMeta = documentMetas.get(position);
|
||||
if (documentMeta != null) {
|
||||
holder.title.setText(documentMeta.getTitle());
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package one.nem.lacerta.feature.library;
|
||||
|
||||
import static one.nem.lacerta.feature.library.LibraryUtils.convertToLibraryItems;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
@ -117,14 +119,13 @@ public class LibraryTopFragment extends Fragment {
|
|||
// トーストメッセージでドキュメントの数を表示
|
||||
Toast.makeText(getContext(), "ドキュメント数: " + Integer.toString(metas.size()), Toast.LENGTH_LONG).show();
|
||||
|
||||
// Create and set the adapter
|
||||
DocumentAdapter adapter = new DocumentAdapter(metas);
|
||||
//LibraryItemPageを使用してadapterを設定
|
||||
LibraryItemPage libraryItemPage = new LibraryItemPage("Page Title", "Page ID", convertToLibraryItems(metas));
|
||||
DocumentAdapter adapter = new DocumentAdapter(libraryItemPage.getListItems());
|
||||
documentRecyclerView.setAdapter(adapter);
|
||||
|
||||
// Use a LinearLayoutManager to specify the layout
|
||||
return view;
|
||||
}
|
||||
private ArrayList<ListItem> convertToLibraryItems(List<DocumentMeta> metas) {
|
||||
return LibraryUtils.convertToLibraryItems(metas);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user