Skip to content

Instantly share code, notes, and snippets.

@wilsonsilva
Forked from testica/Shop.java
Created July 7, 2023 03:17
Show Gist options
  • Save wilsonsilva/15658d818be550e0fa567769faeb4c03 to your computer and use it in GitHub Desktop.
Save wilsonsilva/15658d818be550e0fa567769faeb4c03 to your computer and use it in GitHub Desktop.
Shop class from StayFree decompile app
package com.burockgames.timeclocker.shop;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.e;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.b.a.a.a.c;
import com.b.a.a.a.h;
import com.burockgames.timeclocker.a.a;
import com.burockgames.timeclocker.a.b;
import com.github.paolorotolo.appintro.BuildConfig;
import com.github.paolorotolo.appintro.R;
import java.text.SimpleDateFormat;
import java.util.Locale;
public class Shop extends e {
private c a;
private com.burockgames.timeclocker.a.e b;
private LinearLayout c;
private LinearLayout d;
private int e;
protected void onCreate(Bundle bundle) {
this.b = new com.burockgames.timeclocker.a.e(getApplicationContext());
this.e = this.b.u();
if (this.e == 1) {
setTheme(R.style.Theme1);
} else if (this.e == 2) {
setTheme(R.style.Theme2);
} else if (this.e == 3) {
setTheme(R.style.Theme3);
} else if (this.e == 4) {
setTheme(R.style.Theme4);
}
super.onCreate(bundle);
setContentView((int) R.layout.shop);
a();
}
public void onDestroy() {
if (this.a != null) {
this.a.d();
}
super.onDestroy();
}
protected void attachBaseContext(Context context) {
int q = new com.burockgames.timeclocker.a.e(context).q();
if (q == 1) {
context = b.a(context, new Locale("tr"));
} else if (q == 2) {
context = b.a(context, new Locale("de"));
} else {
context = b.a(context, new Locale(BuildConfig.FLAVOR));
}
super.attachBaseContext(context);
}
public void onBackPressed() {
super.onStop();
finish();
}
public boolean onOptionsItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() == 16908332) {
finish();
}
return super.onOptionsItemSelected(menuItem);
}
protected void onActivityResult(int i, int i2, Intent intent) {
if (!this.a.a(i, i2, intent)) {
super.onActivityResult(i, i2, intent);
}
}
private void a() {
this.c = (LinearLayout) findViewById(R.id.linearLayout_progress);
this.d = (LinearLayout) findViewById(R.id.linearLayout_main);
this.c.setVisibility(0);
this.d.setVisibility(4);
if (this.e == 0) {
findViewById(R.id.relativeLayout_backgroundShop).setBackgroundResource(R.drawable.background_first_theme);
} else if (this.e == 1) {
findViewById(R.id.relativeLayout_backgroundShop).setBackgroundResource(R.drawable.background_second_theme);
}
setSupportActionBar((Toolbar) findViewById(R.id.toolbar_shop));
if (getSupportActionBar() != null) {
getSupportActionBar().b(true);
getSupportActionBar().a(true);
getSupportActionBar().a((int) R.drawable.toolbar_arrow_left);
}
((TextView) findViewById(R.id.textView_toolbarTitle)).setText(getResources().getString(R.string.toolbar12));
((FrameLayout) findViewById(R.id.frameLayout_subscriptionMonthly)).setOnClickListener(new OnClickListener() {
public void onClick(View view) {
if (Shop.this.a != null && Shop.this.a.h()) {
if (Shop.this.b.m()) {
Toast.makeText(Shop.this.getApplicationContext(), Shop.this.getResources().getString(R.string.toast_premium_warning), 0).show();
} else {
Shop.this.a.b(Shop.this, "stayfree.subscription.monthly");
}
}
}
});
((FrameLayout) findViewById(R.id.frameLayout_subscriptionSeasonally)).setOnClickListener(new OnClickListener() {
public void onClick(View view) {
if (Shop.this.a != null && Shop.this.a.h()) {
if (Shop.this.b.m()) {
Toast.makeText(Shop.this.getApplicationContext(), Shop.this.getResources().getString(R.string.toast_premium_warning), 0).show();
} else {
Shop.this.a.b(Shop.this, "stayfree.subscription.seasonally");
}
}
}
});
((FrameLayout) findViewById(R.id.frameLayout_subscriptionYearly)).setOnClickListener(new OnClickListener() {
public void onClick(View view) {
if (Shop.this.a != null && Shop.this.a.h()) {
if (Shop.this.b.m()) {
Toast.makeText(Shop.this.getApplicationContext(), Shop.this.getResources().getString(R.string.toast_premium_warning), 0).show();
} else {
Shop.this.a.b(Shop.this, "stayfree.subscription.yearly");
}
}
}
});
((FrameLayout) findViewById(R.id.frameLayout_oneTimeLifetime)).setOnClickListener(new OnClickListener() {
public void onClick(View view) {
if (Shop.this.a != null && Shop.this.a.g()) {
if (!Shop.this.b.m()) {
if (!Shop.this.a.a("stayfree.lifetime")) {
Shop.this.a.a(Shop.this, "stayfree.lifetime");
return;
}
}
Toast.makeText(Shop.this.getApplicationContext(), Shop.this.getResources().getString(R.string.toast_premium_warning), 0).show();
}
}
});
((Button) findViewById(R.id.button_shopEnterCode)).setOnClickListener(new OnClickListener() {
public void onClick(View view) {
Shop.this.c();
}
});
this.a = new c(this, "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAj/VXs36Pu/9ou7c6/lH567rEYMFbCv2mQM26OaXSrzqnFwlRMgODWTn39Rk3YY7gBzsP2xWdhixtH3nAeRwylUdR+QHK3pVfMeZbiOq5wlbPXPoV1P7ZhCjjNv16AA5SSiP8G9rrS7jYqZIOEmWZf1vEdzYUhAr3ca2/dHvQ1G+lyTJ+9aP5sRCc1h8EqvIGFRiC31QN6ICKfaReeZKP89ktI+bjgs248I3Tu7ru1je1uLobMcGqp2OQ11AefRHOeDdWCoPY+W+dmSVKcuwsEusKOcZI0QuR5z5+8rsvVXHA+M5xKezuxBegPJioxVNUCzEA06eXTn5+piU7e1zM1wIDAQAB", new a(this, getApplicationContext()));
this.a.c();
b();
}
private void b() {
new Handler().postDelayed(new Runnable() {
public void run() {
Shop.this.a.f();
if (c.a(Shop.this.getApplicationContext())) {
StringBuilder stringBuilder;
int i;
TextView textView = (TextView) Shop.this.findViewById(R.id.textView_charge1);
TextView textView2 = (TextView) Shop.this.findViewById(R.id.textView_charge2);
TextView textView3 = (TextView) Shop.this.findViewById(R.id.textView_charge3);
TextView textView4 = (TextView) Shop.this.findViewById(R.id.textView_charge4);
TextView textView5 = (TextView) Shop.this.findViewById(R.id.textView_yearlyCharge1);
TextView textView6 = (TextView) Shop.this.findViewById(R.id.textView_yearlyCharge2);
h e = Shop.this.a.e("stayfree.subscription.monthly");
h e2 = Shop.this.a.e("stayfree.subscription.seasonally");
h e3 = Shop.this.a.e("stayfree.subscription.yearly");
h d = Shop.this.a.d("stayfree.lifetime");
if (e != null) {
textView.setText(e.o);
stringBuilder = new StringBuilder();
stringBuilder.append(String.format(Locale.getDefault(), "%.2f", new Object[]{Double.valueOf(e.f.doubleValue() * 12.0d)}));
stringBuilder.append("/");
stringBuilder.append(Shop.this.getResources().getString(R.string.shop_premium_period_charge));
textView5.setText(stringBuilder.toString().replace(".", ","));
} else {
textView.setVisibility(4);
textView5.setVisibility(4);
}
if (e2 != null) {
textView2.setText(e2.o);
stringBuilder = new StringBuilder();
stringBuilder.append(String.format(Locale.getDefault(), "%.2f", new Object[]{Double.valueOf(e2.f.doubleValue() * 4.0d)}));
stringBuilder.append("/");
stringBuilder.append(Shop.this.getResources().getString(R.string.shop_premium_period_charge));
textView6.setText(stringBuilder.toString().replace(".", ","));
i = 4;
} else {
i = 4;
textView2.setVisibility(4);
textView6.setVisibility(4);
}
if (e3 != null) {
textView3.setText(e3.o);
} else {
textView3.setVisibility(i);
}
if (d != null) {
textView4.setText(d.o);
} else {
textView4.setVisibility(i);
}
Shop.this.a.f();
boolean b = Shop.this.a.b("stayfree.subscription.monthly");
boolean b2 = Shop.this.a.b("stayfree.subscription.seasonally");
boolean b3 = Shop.this.a.b("stayfree.subscription.yearly");
textView3 = (TextView) Shop.this.findViewById(R.id.textView_monthly);
textView4 = (TextView) Shop.this.findViewById(R.id.textView_threeMonthly);
textView5 = (TextView) Shop.this.findViewById(R.id.textView_yearly);
if (b) {
stringBuilder = new StringBuilder();
stringBuilder.append(textView3.getText().toString());
stringBuilder.append(" ");
stringBuilder.append(Shop.this.getResources().getString(R.string.shop_current));
textView3.setText(String.valueOf(stringBuilder.toString()));
}
if (b2) {
stringBuilder = new StringBuilder();
stringBuilder.append(textView4.getText().toString());
stringBuilder.append(" ");
stringBuilder.append(Shop.this.getResources().getString(R.string.shop_current));
textView4.setText(String.valueOf(stringBuilder.toString()));
}
if (b3) {
stringBuilder = new StringBuilder();
stringBuilder.append(textView5.getText().toString());
stringBuilder.append(" ");
stringBuilder.append(Shop.this.getResources().getString(R.string.shop_current));
textView5.setText(String.valueOf(stringBuilder.toString()));
}
}
Shop.this.d.setVisibility(0);
Shop.this.c.setVisibility(4);
}
}, 1500);
}
private void c() {
final Dialog dialog = new Dialog(this);
dialog.requestWindowFeature(1);
dialog.setCancelable(true);
LayoutInflater layoutInflater = (LayoutInflater) getSystemService("layout_inflater");
if (layoutInflater != null) {
View inflate = layoutInflater.inflate(R.layout.shared_dialog_edittext, (ViewGroup) findViewById(R.id.linearLayout_sharedDialogEditText));
final EditText editText = (EditText) inflate.findViewById(R.id.editText_shared);
editText.setInputType(2);
((TextView) inflate.findViewById(R.id.textView_shared)).setText(getResources().getString(R.string.shop_enter_code_text));
Button button = (Button) inflate.findViewById(R.id.button_sharedLeft);
button.setText(getResources().getString(R.string.shared_cancel));
button.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
dialog.dismiss();
}
});
button = (Button) inflate.findViewById(R.id.button_sharedRight);
button.setText(getResources().getString(R.string.shared_OK));
button.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
if (Shop.this.d().equals(editText.getText().toString())) {
Shop.this.b.a("hasCode", true);
Toast.makeText(Shop.this.getApplicationContext(), Shop.this.getResources().getString(R.string.shop_enter_code_text_succesfully), 0).show();
} else {
Toast.makeText(Shop.this.getApplicationContext(), Shop.this.getResources().getString(R.string.shared_forget_password_toast), 0).show();
}
dialog.dismiss();
}
});
dialog.setContentView(inflate);
dialog.show();
}
}
private String d() {
try {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("ddMM", Locale.getDefault());
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(this.b.k());
stringBuilder.append(simpleDateFormat.format(Long.valueOf(System.currentTimeMillis())));
String stringBuilder2 = stringBuilder.toString();
int i = 0;
int parseInt = Integer.parseInt(this.b.k().substring(0, 2));
int parseInt2 = Integer.parseInt(this.b.k().substring(2, 4));
int parseInt3 = Integer.parseInt(this.b.k().substring(4, 6));
StringBuilder stringBuilder3 = new StringBuilder();
byte[] bytes = stringBuilder2.getBytes();
int length = bytes.length;
while (i < length) {
stringBuilder3.append(String.valueOf((bytes[i] + parseInt2) * parseInt));
i++;
}
stringBuilder2 = stringBuilder3.toString();
stringBuilder = new StringBuilder();
stringBuilder.append(stringBuilder2);
stringBuilder.append(parseInt3 * stringBuilder3.length());
return stringBuilder.toString();
} catch (Exception e) {
e.printStackTrace();
return "com.burockgames.no_thing";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment