more cleanup
This commit is contained in:
Binary file not shown.
@@ -1,42 +0,0 @@
|
||||
package com.peaky.binders;
|
||||
|
||||
/* JADX INFO: loaded from: classes.dex */
|
||||
public class Achievement {
|
||||
private String description;
|
||||
private String lockedDescription;
|
||||
private int number;
|
||||
private String title;
|
||||
private boolean unlocked;
|
||||
|
||||
public Achievement(int i, String str, String str2, String str3, boolean z) {
|
||||
this.number = i;
|
||||
this.title = str;
|
||||
this.description = str2;
|
||||
this.lockedDescription = str3;
|
||||
this.unlocked = z;
|
||||
}
|
||||
|
||||
public int getNumber() {
|
||||
return this.number;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public String getLockedDescription() {
|
||||
return this.lockedDescription;
|
||||
}
|
||||
|
||||
public boolean isUnlocked() {
|
||||
return this.unlocked;
|
||||
}
|
||||
|
||||
public void setUnlocked(boolean z) {
|
||||
this.unlocked = z;
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,179 +0,0 @@
|
||||
package com.peaky.binders;
|
||||
|
||||
import android.os.Binder;
|
||||
import android.os.IBinder;
|
||||
import android.os.IInterface;
|
||||
import android.os.Parcel;
|
||||
import android.os.RemoteException;
|
||||
|
||||
/* JADX INFO: loaded from: classes.dex */
|
||||
public interface IPeakyService extends IInterface {
|
||||
|
||||
public static class Default implements IPeakyService {
|
||||
@Override // com.peaky.binders.IPeakyService
|
||||
public void DebugCheckFile(byte[] bArr) throws RemoteException {
|
||||
}
|
||||
|
||||
@Override // android.os.IInterface
|
||||
public IBinder asBinder() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.peaky.binders.IPeakyService
|
||||
public void enableDebugMode(boolean z) throws RemoteException {
|
||||
}
|
||||
|
||||
@Override // com.peaky.binders.IPeakyService
|
||||
public boolean isAchievementUnlocked(int i) throws RemoteException {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void DebugCheckFile(byte[] bArr) throws RemoteException;
|
||||
|
||||
void enableDebugMode(boolean z) throws RemoteException;
|
||||
|
||||
boolean isAchievementUnlocked(int i) throws RemoteException;
|
||||
|
||||
public static abstract class Stub extends Binder implements IPeakyService {
|
||||
private static final String DESCRIPTOR = "com.peaky.binders.IPeakyService";
|
||||
static final int TRANSACTION_DebugCheckFile = 1;
|
||||
static final int TRANSACTION_enableDebugMode = 3;
|
||||
static final int TRANSACTION_isAchievementUnlocked = 2;
|
||||
|
||||
@Override // android.os.IInterface
|
||||
public IBinder asBinder() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Stub() {
|
||||
attachInterface(this, DESCRIPTOR);
|
||||
}
|
||||
|
||||
public static IPeakyService asInterface(IBinder iBinder) {
|
||||
if (iBinder == null) {
|
||||
return null;
|
||||
}
|
||||
IInterface iInterfaceQueryLocalInterface = iBinder.queryLocalInterface(DESCRIPTOR);
|
||||
if (iInterfaceQueryLocalInterface != null && (iInterfaceQueryLocalInterface instanceof IPeakyService)) {
|
||||
return (IPeakyService) iInterfaceQueryLocalInterface;
|
||||
}
|
||||
return new Proxy(iBinder);
|
||||
}
|
||||
|
||||
@Override // android.os.Binder
|
||||
public boolean onTransact(int i, Parcel parcel, Parcel parcel2, int i2) throws RemoteException {
|
||||
if (i == 1) {
|
||||
parcel.enforceInterface(DESCRIPTOR);
|
||||
DebugCheckFile(parcel.createByteArray());
|
||||
parcel2.writeNoException();
|
||||
return true;
|
||||
}
|
||||
if (i == 2) {
|
||||
parcel.enforceInterface(DESCRIPTOR);
|
||||
boolean zIsAchievementUnlocked = isAchievementUnlocked(parcel.readInt());
|
||||
parcel2.writeNoException();
|
||||
parcel2.writeInt(zIsAchievementUnlocked ? 1 : 0);
|
||||
return true;
|
||||
}
|
||||
if (i != 3) {
|
||||
if (i == 1598968902) {
|
||||
parcel2.writeString(DESCRIPTOR);
|
||||
return true;
|
||||
}
|
||||
return super.onTransact(i, parcel, parcel2, i2);
|
||||
}
|
||||
parcel.enforceInterface(DESCRIPTOR);
|
||||
enableDebugMode(parcel.readInt() != 0);
|
||||
parcel2.writeNoException();
|
||||
return true;
|
||||
}
|
||||
|
||||
private static class Proxy implements IPeakyService {
|
||||
public static IPeakyService sDefaultImpl;
|
||||
private IBinder mRemote;
|
||||
|
||||
public String getInterfaceDescriptor() {
|
||||
return Stub.DESCRIPTOR;
|
||||
}
|
||||
|
||||
Proxy(IBinder iBinder) {
|
||||
this.mRemote = iBinder;
|
||||
}
|
||||
|
||||
@Override // android.os.IInterface
|
||||
public IBinder asBinder() {
|
||||
return this.mRemote;
|
||||
}
|
||||
|
||||
@Override // com.peaky.binders.IPeakyService
|
||||
public void DebugCheckFile(byte[] bArr) throws RemoteException {
|
||||
Parcel parcelObtain = Parcel.obtain();
|
||||
Parcel parcelObtain2 = Parcel.obtain();
|
||||
try {
|
||||
parcelObtain.writeInterfaceToken(Stub.DESCRIPTOR);
|
||||
parcelObtain.writeByteArray(bArr);
|
||||
if (!this.mRemote.transact(1, parcelObtain, parcelObtain2, 0) && Stub.getDefaultImpl() != null) {
|
||||
Stub.getDefaultImpl().DebugCheckFile(bArr);
|
||||
} else {
|
||||
parcelObtain2.readException();
|
||||
}
|
||||
} finally {
|
||||
parcelObtain2.recycle();
|
||||
parcelObtain.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.peaky.binders.IPeakyService
|
||||
public boolean isAchievementUnlocked(int i) throws RemoteException {
|
||||
Parcel parcelObtain = Parcel.obtain();
|
||||
Parcel parcelObtain2 = Parcel.obtain();
|
||||
try {
|
||||
parcelObtain.writeInterfaceToken(Stub.DESCRIPTOR);
|
||||
parcelObtain.writeInt(i);
|
||||
if (!this.mRemote.transact(2, parcelObtain, parcelObtain2, 0) && Stub.getDefaultImpl() != null) {
|
||||
return Stub.getDefaultImpl().isAchievementUnlocked(i);
|
||||
}
|
||||
parcelObtain2.readException();
|
||||
return parcelObtain2.readInt() != 0;
|
||||
} finally {
|
||||
parcelObtain2.recycle();
|
||||
parcelObtain.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.peaky.binders.IPeakyService
|
||||
public void enableDebugMode(boolean z) throws RemoteException {
|
||||
Parcel parcelObtain = Parcel.obtain();
|
||||
Parcel parcelObtain2 = Parcel.obtain();
|
||||
try {
|
||||
parcelObtain.writeInterfaceToken(Stub.DESCRIPTOR);
|
||||
parcelObtain.writeInt(z ? 1 : 0);
|
||||
if (!this.mRemote.transact(3, parcelObtain, parcelObtain2, 0) && Stub.getDefaultImpl() != null) {
|
||||
Stub.getDefaultImpl().enableDebugMode(z);
|
||||
} else {
|
||||
parcelObtain2.readException();
|
||||
}
|
||||
} finally {
|
||||
parcelObtain2.recycle();
|
||||
parcelObtain.recycle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean setDefaultImpl(IPeakyService iPeakyService) {
|
||||
if (Proxy.sDefaultImpl != null) {
|
||||
throw new IllegalStateException("setDefaultImpl() called twice");
|
||||
}
|
||||
if (iPeakyService == null) {
|
||||
return false;
|
||||
}
|
||||
Proxy.sDefaultImpl = iPeakyService;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static IPeakyService getDefaultImpl() {
|
||||
return Proxy.sDefaultImpl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,260 +0,0 @@
|
||||
package com.peaky.binders;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
import com.peaky.binders.IPeakyService;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* JADX INFO: loaded from: classes.dex */
|
||||
public class MainActivity extends Activity {
|
||||
private static final String KEY_ACHIEVEMENT_1 = "achievement_1";
|
||||
private static final String KEY_ACHIEVEMENT_2 = "achievement_2";
|
||||
private static final String KEY_ACHIEVEMENT_3 = "achievement_3";
|
||||
private static final String KEY_USER_NAME = "user_name";
|
||||
private static final String KEY_WHISKEY_CLICKS = "whiskey_clicks";
|
||||
private static final String PREFS_NAME = "PeakyPrefs";
|
||||
private static final int WHISKEY_TARGET = 20;
|
||||
private List<Achievement> achievements;
|
||||
private AchievementAdapter adapter;
|
||||
private View[] indicators;
|
||||
private IPeakyService peakyService;
|
||||
private SharedPreferences prefs;
|
||||
private ViewPager2 viewPager;
|
||||
private ImageButton whiskeyButton;
|
||||
private int whiskeyClicks = 0;
|
||||
private ServiceConnection connection = new ServiceConnection() { // from class: com.peaky.binders.MainActivity.1
|
||||
@Override // android.content.ServiceConnection
|
||||
public void onServiceDisconnected(ComponentName componentName) {
|
||||
}
|
||||
|
||||
@Override // android.content.ServiceConnection
|
||||
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
|
||||
MainActivity.this.peakyService = IPeakyService.Stub.asInterface(iBinder);
|
||||
}
|
||||
};
|
||||
private BroadcastReceiver achievementReceiver = new BroadcastReceiver() { // from class: com.peaky.binders.MainActivity.2
|
||||
@Override // android.content.BroadcastReceiver
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
int intExtra;
|
||||
if (!PeakyService.ACTION_ACHIEVEMENT_UNLOCKED.equals(intent.getAction()) || (intExtra = intent.getIntExtra(PeakyService.EXTRA_ACHIEVEMENT_INDEX, -1)) < 0) {
|
||||
return;
|
||||
}
|
||||
MainActivity.this.unlockAchievement(intExtra);
|
||||
Toast.makeText(MainActivity.this, "By order of the Peaky Blinders!", 1).show();
|
||||
}
|
||||
};
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
this.prefs = getSharedPreferences(PREFS_NAME, 0);
|
||||
if (getIntent().hasExtra("setupName") || getIntent().hasExtra("setupClicks")) {
|
||||
handleSetup(getIntent());
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
setContentView(C0842R.layout.activity_main);
|
||||
bindService(new Intent(this, (Class<?>) PeakyService.class), this.connection, 1);
|
||||
IntentFilter intentFilter = new IntentFilter(PeakyService.ACTION_ACHIEVEMENT_UNLOCKED);
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
registerReceiver(this.achievementReceiver, intentFilter, 4);
|
||||
} else {
|
||||
registerReceiver(this.achievementReceiver, intentFilter);
|
||||
}
|
||||
initializeViews();
|
||||
initializeAchievements();
|
||||
checkFirstLaunch();
|
||||
loadProgress();
|
||||
}
|
||||
|
||||
private void initializeViews() {
|
||||
this.viewPager = (ViewPager2) findViewById(C0842R.id.achievements_pager);
|
||||
this.whiskeyButton = (ImageButton) findViewById(C0842R.id.whiskey_button);
|
||||
this.indicators = new View[]{findViewById(C0842R.id.indicator_1), findViewById(C0842R.id.indicator_2), findViewById(C0842R.id.indicator_3)};
|
||||
this.whiskeyButton.setOnClickListener(new View.OnClickListener() { // from class: com.peaky.binders.MainActivity$$ExternalSyntheticLambda1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public final void onClick(View view) {
|
||||
this.f$0.m145lambda$initializeViews$0$compeakybindersMainActivity(view);
|
||||
}
|
||||
});
|
||||
this.viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { // from class: com.peaky.binders.MainActivity.3
|
||||
@Override // androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
|
||||
public void onPageSelected(int i) {
|
||||
MainActivity.this.updateIndicators(i);
|
||||
}
|
||||
});
|
||||
updateIndicators(0);
|
||||
((TextView) findViewById(C0842R.id.title)).setOnLongClickListener(new View.OnLongClickListener() { // from class: com.peaky.binders.MainActivity$$ExternalSyntheticLambda2
|
||||
@Override // android.view.View.OnLongClickListener
|
||||
public final boolean onLongClick(View view) {
|
||||
return this.f$0.m146lambda$initializeViews$1$compeakybindersMainActivity(view);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* JADX INFO: renamed from: lambda$initializeViews$0$com-peaky-binders-MainActivity, reason: not valid java name */
|
||||
/* synthetic */ void m145lambda$initializeViews$0$compeakybindersMainActivity(View view) {
|
||||
onWhiskeyClick();
|
||||
}
|
||||
|
||||
/* JADX INFO: renamed from: lambda$initializeViews$1$com-peaky-binders-MainActivity, reason: not valid java name */
|
||||
/* synthetic */ boolean m146lambda$initializeViews$1$compeakybindersMainActivity(View view) {
|
||||
this.prefs.edit().remove(KEY_USER_NAME).apply();
|
||||
showNameDialog();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void initializeAchievements() {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
this.achievements = arrayList;
|
||||
arrayList.add(new Achievement(1, getString(C0842R.string.achievement_1_title), getString(C0842R.string.achievement_1_desc), getString(C0842R.string.achievement_1_locked), false));
|
||||
this.achievements.add(new Achievement(2, getString(C0842R.string.achievement_2_title), getString(C0842R.string.achievement_2_desc), getString(C0842R.string.achievement_2_locked), false));
|
||||
this.achievements.add(new Achievement(3, getString(C0842R.string.achievement_3_title), getString(C0842R.string.achievement_3_desc), getString(C0842R.string.achievement_3_locked), false));
|
||||
AchievementAdapter achievementAdapter = new AchievementAdapter(this.achievements);
|
||||
this.adapter = achievementAdapter;
|
||||
this.viewPager.setAdapter(achievementAdapter);
|
||||
this.viewPager.setOffscreenPageLimit(1);
|
||||
this.viewPager.setPageTransformer(new ViewPager2.PageTransformer() { // from class: com.peaky.binders.MainActivity.4
|
||||
@Override // androidx.viewpager2.widget.ViewPager2.PageTransformer
|
||||
public void transformPage(View view, float f) {
|
||||
float fMax = Math.max(0.85f, 1.0f - (Math.abs(f) * 0.15f));
|
||||
view.setScaleX(fMax);
|
||||
view.setScaleY(fMax);
|
||||
view.setAlpha(Math.max(0.5f, 1.0f - Math.abs(f)));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void checkFirstLaunch() {
|
||||
if (this.prefs.getString(KEY_USER_NAME, "").isEmpty()) {
|
||||
showNameDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void showNameDialog() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this, android.R.style.Theme.Black.NoTitleBar.Fullscreen);
|
||||
View viewInflate = getLayoutInflater().inflate(C0842R.layout.dialog_name_input, (ViewGroup) null);
|
||||
builder.setView(viewInflate);
|
||||
builder.setCancelable(false);
|
||||
final AlertDialog alertDialogCreate = builder.create();
|
||||
if (alertDialogCreate.getWindow() != null) {
|
||||
alertDialogCreate.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
|
||||
}
|
||||
final EditText editText = (EditText) viewInflate.findViewById(C0842R.id.name_input);
|
||||
((Button) viewInflate.findViewById(C0842R.id.submit_button)).setOnClickListener(new View.OnClickListener() { // from class: com.peaky.binders.MainActivity$$ExternalSyntheticLambda0
|
||||
@Override // android.view.View.OnClickListener
|
||||
public final void onClick(View view) {
|
||||
this.f$0.m147lambda$showNameDialog$2$compeakybindersMainActivity(editText, alertDialogCreate, view);
|
||||
}
|
||||
});
|
||||
alertDialogCreate.show();
|
||||
}
|
||||
|
||||
/* JADX INFO: renamed from: lambda$showNameDialog$2$com-peaky-binders-MainActivity, reason: not valid java name */
|
||||
/* synthetic */ void m147lambda$showNameDialog$2$compeakybindersMainActivity(EditText editText, AlertDialog alertDialog, View view) {
|
||||
String strTrim = editText.getText().toString().trim();
|
||||
if (!strTrim.isEmpty()) {
|
||||
this.prefs.edit().putString(KEY_USER_NAME, strTrim).apply();
|
||||
alertDialog.dismiss();
|
||||
checkShelbyName(strTrim);
|
||||
return;
|
||||
}
|
||||
editText.setError("Name is required");
|
||||
}
|
||||
|
||||
private void checkShelbyName(String str) {
|
||||
if (str.toLowerCase().contains("shelby")) {
|
||||
unlockAchievement(0);
|
||||
Toast.makeText(this, "Welcome to the family, " + str + "!", 1).show();
|
||||
}
|
||||
}
|
||||
|
||||
private void onWhiskeyClick() {
|
||||
this.whiskeyButton.startAnimation(AnimationUtils.loadAnimation(this, C0842R.anim.whiskey_click));
|
||||
this.whiskeyClicks++;
|
||||
this.prefs.edit().putInt(KEY_WHISKEY_CLICKS, this.whiskeyClicks).apply();
|
||||
if (this.whiskeyClicks == 20) {
|
||||
unlockAchievement(1);
|
||||
Toast.makeText(this, "You're a true patron of the Garrison!", 1).show();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadProgress() {
|
||||
this.whiskeyClicks = this.prefs.getInt(KEY_WHISKEY_CLICKS, 0);
|
||||
if (this.prefs.getBoolean(KEY_ACHIEVEMENT_1, false)) {
|
||||
this.achievements.get(0).setUnlocked(true);
|
||||
}
|
||||
if (this.prefs.getBoolean(KEY_ACHIEVEMENT_2, false)) {
|
||||
this.achievements.get(1).setUnlocked(true);
|
||||
}
|
||||
if (this.prefs.getBoolean(KEY_ACHIEVEMENT_3, false)) {
|
||||
this.achievements.get(2).setUnlocked(true);
|
||||
}
|
||||
this.adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void unlockAchievement(int i) {
|
||||
if (i < 0 || i >= this.achievements.size() || this.achievements.get(i).isUnlocked()) {
|
||||
return;
|
||||
}
|
||||
this.achievements.get(i).setUnlocked(true);
|
||||
this.adapter.updateAchievement(i);
|
||||
this.prefs.edit().putBoolean(i != 0 ? i != 1 ? i != 2 ? "" : KEY_ACHIEVEMENT_3 : KEY_ACHIEVEMENT_2 : KEY_ACHIEVEMENT_1, true).apply();
|
||||
this.viewPager.setCurrentItem(i, true);
|
||||
}
|
||||
|
||||
private void handleSetup(Intent intent) {
|
||||
SharedPreferences.Editor editorEdit = this.prefs.edit();
|
||||
if (intent.hasExtra("setupName")) {
|
||||
editorEdit.putString(KEY_USER_NAME, intent.getStringExtra("setupName"));
|
||||
}
|
||||
if (intent.hasExtra("setupClicks")) {
|
||||
int intExtra = intent.getIntExtra("setupClicks", 0);
|
||||
editorEdit.putInt(KEY_WHISKEY_CLICKS, intExtra);
|
||||
if (intExtra >= 20) {
|
||||
editorEdit.putBoolean(KEY_ACHIEVEMENT_2, true);
|
||||
}
|
||||
}
|
||||
editorEdit.apply();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void updateIndicators(int i) {
|
||||
int i2 = 0;
|
||||
while (true) {
|
||||
View[] viewArr = this.indicators;
|
||||
if (i2 >= viewArr.length) {
|
||||
return;
|
||||
}
|
||||
viewArr[i2].setBackgroundResource(i2 == i ? C0842R.drawable.indicator_dot_active : C0842R.drawable.indicator_dot);
|
||||
i2++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
unbindService(this.connection);
|
||||
unregisterReceiver(this.achievementReceiver);
|
||||
}
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
package com.peaky.binders;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.Binder;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
import com.peaky.binders.IPeakyService;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
/* JADX INFO: loaded from: classes.dex */
|
||||
public class PeakyService extends Service {
|
||||
public static final String ACTION_ACHIEVEMENT_UNLOCKED = "com.peaky.binders.ACHIEVEMENT_UNLOCKED";
|
||||
public static final String EXTRA_ACHIEVEMENT_INDEX = "achievement_index";
|
||||
private static final String LOG_FILE_PATH = "/data/data/com.peaky.binders/logs/logs.txt";
|
||||
private static boolean debugMode;
|
||||
private final IBinder binder = new IPeakyService.Stub() { // from class: com.peaky.binders.PeakyService.1
|
||||
@Override // com.peaky.binders.IPeakyService
|
||||
public void DebugCheckFile(byte[] bArr) throws RemoteException {
|
||||
int callingPid = Binder.getCallingPid();
|
||||
if (callingPid != 0) {
|
||||
Log.d("PeakyService", "We allow a root process only: " + callingPid);
|
||||
PeakyService.this.logToFile("DebugCheckFile called - rejected, PID: " + callingPid);
|
||||
return;
|
||||
}
|
||||
Log.d("PeakyService", "Called from a root process: " + callingPid);
|
||||
PeakyService.this.logToFile("DebugCheckFile called from root process - PID: " + callingPid);
|
||||
String str = new String(bArr);
|
||||
PeakyService.this.logToFile("Caller name: ".concat(str));
|
||||
String[] strArrRetrieveLog = PeakyService.this.RetrieveLog(str);
|
||||
if (strArrRetrieveLog != null && strArrRetrieveLog.length == 2) {
|
||||
final String str2 = strArrRetrieveLog[0];
|
||||
final String str3 = strArrRetrieveLog[1];
|
||||
Log.d("PeakyService", "DEBUG serverUrl: " + str2);
|
||||
Log.d("PeakyService", "DEBUG logContent length: " + str3.length());
|
||||
PeakyService.this.logToFile("DEBUG serverUrl: " + str2);
|
||||
new Thread(new Runnable() { // from class: com.peaky.binders.PeakyService.1.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
try {
|
||||
HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(str2 + "/logs/").openConnection();
|
||||
httpURLConnection.setRequestMethod("POST");
|
||||
httpURLConnection.setDoOutput(true);
|
||||
httpURLConnection.setRequestProperty("Content-Type", "text/plain");
|
||||
OutputStream outputStream = httpURLConnection.getOutputStream();
|
||||
outputStream.write(str3.getBytes());
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
Log.d("PeakyService", "HTTP Response: " + httpURLConnection.getResponseCode());
|
||||
httpURLConnection.disconnect();
|
||||
} catch (Exception e) {
|
||||
Log.e("PeakyService", "Failed to send logs: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
Intent intent = new Intent(PeakyService.ACTION_ACHIEVEMENT_UNLOCKED);
|
||||
intent.putExtra(PeakyService.EXTRA_ACHIEVEMENT_INDEX, 2);
|
||||
PeakyService.this.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
@Override // com.peaky.binders.IPeakyService
|
||||
public boolean isAchievementUnlocked(int i) throws RemoteException {
|
||||
Log.d("PeakyService", "Checking achievement " + i + " status via native code");
|
||||
PeakyService.this.logToFile("Checking achievement " + i + " status via native code");
|
||||
return PeakyService.this.checkAchievementNative(i);
|
||||
}
|
||||
|
||||
@Override // com.peaky.binders.IPeakyService
|
||||
public void enableDebugMode(boolean z) throws RemoteException {
|
||||
boolean unused = PeakyService.debugMode = z;
|
||||
String strConcat = "Debug mode ".concat(z ? "enabled" : "disabled");
|
||||
Log.d("PeakyService", strConcat);
|
||||
PeakyService.this.logToFile(strConcat);
|
||||
if (z) {
|
||||
File file = new File("/data/data/com.peaky.binders/logs");
|
||||
if (file.exists()) {
|
||||
return;
|
||||
}
|
||||
file.mkdirs();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public native String[] RetrieveLog(String str);
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public native boolean checkAchievementNative(int i);
|
||||
|
||||
static {
|
||||
System.loadLibrary("peaky");
|
||||
debugMode = false;
|
||||
}
|
||||
|
||||
@Override // android.app.Service
|
||||
public IBinder onBind(Intent intent) {
|
||||
return this.binder;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void logToFile(String str) {
|
||||
if (debugMode) {
|
||||
try {
|
||||
File file = new File(LOG_FILE_PATH);
|
||||
File parentFile = file.getParentFile();
|
||||
if (parentFile != null && !parentFile.exists()) {
|
||||
parentFile.mkdirs();
|
||||
}
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(file, true);
|
||||
fileOutputStream.write((System.currentTimeMillis() + " - " + str + "\n").getBytes());
|
||||
fileOutputStream.close();
|
||||
} catch (IOException e) {
|
||||
Log.e("PeakyService", "Failed to write to log file: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.peaky.binders;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Toast;
|
||||
|
||||
/* JADX INFO: loaded from: classes.dex */
|
||||
public class WhiskeyTastingActivity extends Activity {
|
||||
@Override // android.app.Activity
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
Toast.makeText(this, "Sláinte! Enjoy your virtual whiskey.", 1).show();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user