Merge pull request #217 from nitta-lab-2024/bagFixSakoda
市丸君のバグ修正
commit 577422075f9833f39711fddb375d72566c2e7132
2 parents 8e8b997 + 749faec
市丸元輝 authored on 24 Oct
Showing 1 changed file
View
5
app/src/main/java/com/example/citrusclient/views/MyAdapter.java
holder.LikeTextView.setImageResource(R.drawable.baseline_favorite_24);
Animation animation = AnimationUtils.loadAnimation(holder.itemView.getContext(),R.anim.touch);
view.startAnimation(animation);
holder.LikeTextView.setTag("liked");
if(!favoritesMap.containsKey(currentBook.getAccountId())) {
favoritesMap.put(currentBook.getAccountId(), new HashSet<>());
}
favoritesMap.get(currentBook.getAccountId()).add(currentBook.getBookId());
}else if(holder.LikeTextView.getTag().equals("liked")){
System.out.println(citrus.getAccountId()+"が"+currentBook.getAccountId()+"の"+currentBook.getBookId()+"を解除しました");
booksViewModel.unregisterFavoriteCount(currentBook.getAccountId(), currentBook.getBookId());
holder.LikedCountTextView.setText(context.getString(R.string.liked_count_format, currentBook.getFavoritedCount()));
favoritesViewModel.deletefavorite(currentBook.getAccountId(), currentBook.getBookId(), citrus.getAccountId(), citrus.getToken());
holder.LikeTextView.setImageResource(R.drawable.baseline_favorite_border_24);
holder.LikeTextView.setTag("unliked");
favoritesMap.get(currentBook.getAccountId()).remove(currentBook.getBookId());
}
});
}