Skip to content

Commit

Permalink
Refactor class adapter to use user ID instead of class ID for compari…
Browse files Browse the repository at this point in the history
…son.
  • Loading branch information
nqmgaming committed Dec 8, 2023
1 parent b24a402 commit 1c8f96e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void onBindViewHolder(@NonNull @NotNull ClassAdapter.ClassViewHolder hold
Group group = classes.get(position);
holder.binding.classNameTv.setText(group.getName());
UserSharePreferences userSharePreferences = new UserSharePreferences(context);
if (Objects.equals(group.getId(), userSharePreferences.getClassId())) {
if (Objects.equals(group.getUser_id(), userSharePreferences.getId())) {
holder.binding.isAdminTv.setVisibility(View.VISIBLE);
}
GroupDAO groupDAO = new GroupDAO(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public ClassCopyAdapter.ClassViewHolder onCreateViewHolder(@NonNull @NotNull Vie
public void onBindViewHolder(@NonNull @NotNull ClassCopyAdapter.ClassViewHolder holder, int position) {
Group group = classes.get(position);
UserSharePreferences userSharePreferences = new UserSharePreferences(context);
if (Objects.equals(group.getId(), userSharePreferences.getClassId())) {
if (Objects.equals(group.getUser_id(), userSharePreferences.getId())) {
holder.binding.isAdminTv.setVisibility(View.VISIBLE);
}
holder.binding.classNameTv.setText(group.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ class EditFlashCardActivity : AppCompatActivity() {
}

for (card_id in listIdCard) {
Toast.makeText(this, card_id, Toast.LENGTH_SHORT).show()
cardDAO.deleteCardById(card_id) >= 0


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,11 +445,11 @@ private void copyFlashCard() {
card.setCreated_at(getCurrentDate());
card.setUpdated_at(getCurrentDate());
if (cardDAO.insertCard(card) > 0L) {
Toast.makeText(this, getString(R.string.review_success), Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, getString(R.string.review_error), Toast.LENGTH_SHORT).show();
}
}
Toast.makeText(this, getString(R.string.review_success), Toast.LENGTH_SHORT).show();
}


Expand Down

0 comments on commit 1c8f96e

Please sign in to comment.