diff --git a/app/src/main/java/com/example/citrusclient/views/FavoritesBooksFragment.java b/app/src/main/java/com/example/citrusclient/views/FavoritesBooksFragment.java index 31261d8..4d27601 100644 --- a/app/src/main/java/com/example/citrusclient/views/FavoritesBooksFragment.java +++ b/app/src/main/java/com/example/citrusclient/views/FavoritesBooksFragment.java @@ -165,10 +165,13 @@ // for (Integer bookId : bookMap.keySet()) { // Book book = bookMap.get(bookId); // if (count == position){ + // 他の人のid名を表示するのに必要 holder.other_id.setText(books.get(position).getAccountId()); + // 本の名前を表示 holder.favorites_book.setText(books.get(position).getTitle()); int parsedColor = Color.parseColor(books.get(position).getColor()); holder.favorites_book.setBackgroundTintList(ColorStateList.valueOf(parsedColor)); + Context context = holder.itemView.getContext(); holder.favorites_book.setOnClickListener(v -> { Activity activity = (Activity) context; @@ -178,6 +181,9 @@ ((MainActivity) activity).showFragment(new OtherHomeFragment()); }); + + holder.other_icon.setBackgroundTintList(ColorStateList.valueOf(parsedColor)); + } @@ -185,10 +191,13 @@ TextView other_id; Button favorites_book; + Button other_icon; + public FavoritesBooksViewHolder(@NonNull View itemView) { super(itemView); favorites_book = itemView.findViewById(R.id.favorites_book); other_id = itemView.findViewById(R.id.other_id); + other_icon = itemView.findViewById(R.id.other_icon); } }