Files
ctf/2026/insomnihack/mobile/peaky_binders/jadx_srcs/peaky.binders/AchievementAdapter.java

101 lines
4.7 KiB
Java

package com.peaky.binders;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
/* JADX INFO: loaded from: classes.dex */
public class AchievementAdapter extends RecyclerView.Adapter<AchievementViewHolder> {
private List<Achievement> achievements;
private boolean animateUnlock = false;
public AchievementAdapter(List<Achievement> list) {
this.achievements = list;
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public AchievementViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
return new AchievementViewHolder(LayoutInflater.from(viewGroup.getContext()).inflate(C0842R.layout.achievement_card, viewGroup, false));
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public void onBindViewHolder(AchievementViewHolder achievementViewHolder, int i) {
achievementViewHolder.bind(this.achievements.get(i), this.animateUnlock);
this.animateUnlock = false;
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public int getItemCount() {
return this.achievements.size();
}
public void updateAchievement(int i) {
this.animateUnlock = true;
notifyItemChanged(i);
}
static class AchievementViewHolder extends RecyclerView.ViewHolder {
private TextView descriptionView;
private View lockedOverlay;
private TextView numberView;
private TextView statusView;
private TextView titleView;
private TextView unlockedIcon;
public AchievementViewHolder(View view) {
super(view);
this.numberView = (TextView) view.findViewById(C0842R.id.achievement_number);
this.titleView = (TextView) view.findViewById(C0842R.id.achievement_title);
this.descriptionView = (TextView) view.findViewById(C0842R.id.achievement_description);
this.statusView = (TextView) view.findViewById(C0842R.id.achievement_status);
this.lockedOverlay = view.findViewById(C0842R.id.locked_overlay);
this.unlockedIcon = (TextView) view.findViewById(C0842R.id.unlocked_icon);
}
public void bind(Achievement achievement, boolean z) {
this.numberView.setText(String.valueOf(achievement.getNumber()));
this.titleView.setText(achievement.getTitle());
if (achievement.isUnlocked()) {
this.descriptionView.setText(achievement.getDescription());
this.statusView.setText("UNLOCKED");
this.statusView.setTextColor(this.itemView.getContext().getColor(C0842R.color.peaky_accent));
this.statusView.setAlpha(0.8f);
if (z) {
Animation animationLoadAnimation = AnimationUtils.loadAnimation(this.itemView.getContext(), C0842R.anim.fade_out);
animationLoadAnimation.setAnimationListener(new Animation.AnimationListener() { // from class: com.peaky.binders.AchievementAdapter.AchievementViewHolder.1
@Override // android.view.animation.Animation.AnimationListener
public void onAnimationRepeat(Animation animation) {
}
@Override // android.view.animation.Animation.AnimationListener
public void onAnimationStart(Animation animation) {
}
@Override // android.view.animation.Animation.AnimationListener
public void onAnimationEnd(Animation animation) {
AchievementViewHolder.this.lockedOverlay.setVisibility(8);
}
});
this.lockedOverlay.startAnimation(animationLoadAnimation);
this.unlockedIcon.setVisibility(0);
this.unlockedIcon.startAnimation(AnimationUtils.loadAnimation(this.itemView.getContext(), C0842R.anim.unlock_scale));
return;
}
this.lockedOverlay.setVisibility(8);
this.unlockedIcon.setVisibility(0);
return;
}
this.descriptionView.setText(achievement.getLockedDescription());
this.statusView.setText("LOCKED");
this.statusView.setTextColor(this.itemView.getContext().getColor(C0842R.color.peaky_text_secondary));
this.statusView.setAlpha(0.6f);
this.lockedOverlay.setVisibility(0);
this.unlockedIcon.setVisibility(8);
}
}
}