ZStore v1.7版本的 MD5 值为:ca9bb200afd8d690876bd39318f8215c

以下内容为反编译后的 MainActivity.java 源代码,内容仅作参考


package com.zackiestudios.zstore;

import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.RippleDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.util.SparseBooleanArray;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import com.airbnb.lottie.LottieAnimationView;
import com.google.android.gms.common.Scopes;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.google.firebase.FirebaseApp;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.GenericTypeIndicator;
import com.zackiestudios.zstore.RequestNetwork;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
import org.apache.http.cookie.ClientCookie;

public class MainActivity extends AppCompatActivity {
    private ChildEventListener _Users_child_listener;
    private OnCompleteListener<AuthResult> _auth_create_user_listener;
    private OnCompleteListener<Void> _auth_reset_password_listener;
    private OnCompleteListener<AuthResult> _auth_sign_in_listener;
    private ChildEventListener _maintenance_child_listener;
    private RequestNetwork.RequestListener _network_request_listener;
    private ChildEventListener _update_child_listener;
    private FirebaseAuth auth;
    private OnCompleteListener<Void> auth_deleteUserListener;
    private OnCompleteListener<Void> auth_emailVerificationSentListener;
    private OnCompleteListener<AuthResult> auth_googleSignInListener;
    private OnCompleteListener<AuthResult> auth_phoneAuthListener;
    private OnCompleteListener<Void> auth_updateEmailListener;
    private OnCompleteListener<Void> auth_updatePasswordListener;
    private OnCompleteListener<Void> auth_updateProfileListener;
    private ImageView imageview1;
    private LinearLayout linear1;
    private LinearLayout linear2;
    private LinearLayout linear3;
    private LottieAnimationView lottie_login;
    private RequestNetwork network;
    private TextView textview1;
    private TimerTask timer;
    private SharedPreferences users;
    private Timer _timer = new Timer();
    private FirebaseDatabase _firebase = FirebaseDatabase.getInstance();
    private boolean data1 = false;
    private boolean data2 = false;
    private boolean data3 = false;
    private String maintenanc = "";
    private String app_version = "";
    private String packageName = "";
    private HashMap<String, Object> map = new HashMap<>();
    private DatabaseReference Users = this._firebase.getReference("Users");
    private DatabaseReference update = this._firebase.getReference("other/update");
    private DatabaseReference maintenance = this._firebase.getReference("other/maintenance");
    private Intent intent = new Intent();
    private Intent web = new Intent();

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.main);
        initialize(bundle);
        FirebaseApp.initializeApp(this);
        initializeLogic();
    }

    private void initialize(Bundle bundle) {
        this.linear1 = (LinearLayout) findViewById(R.id.linear1);
        this.linear3 = (LinearLayout) findViewById(R.id.linear3);
        this.imageview1 = (ImageView) findViewById(R.id.imageview1);
        this.linear2 = (LinearLayout) findViewById(R.id.linear2);
        this.lottie_login = (LottieAnimationView) findViewById(R.id.lottie_login);
        this.textview1 = (TextView) findViewById(R.id.textview1);
        this.auth = FirebaseAuth.getInstance();
        this.users = getSharedPreferences("users", 0);
        this.network = new RequestNetwork(this);
        ChildEventListener childEventListener = new ChildEventListener() {
            @Override
            public void onChildMoved(DataSnapshot dataSnapshot, String str) {
            }

            @Override
            public void onChildAdded(DataSnapshot dataSnapshot, String str) {
                GenericTypeIndicator<HashMap<String, Object>> genericTypeIndicator = new GenericTypeIndicator<HashMap<String, Object>>() {
                };
                String key = dataSnapshot.getKey();
                HashMap hashMap = (HashMap) dataSnapshot.getValue(genericTypeIndicator);
                MainActivity.this.data3 = true;
                if (key.equals(FirebaseAuth.getInstance().getCurrentUser().getUid())) {
                    if (hashMap.containsKey("name")) {
                        MainActivity.this.users.edit().putString("name", hashMap.get("name").toString()).commit();
                    }
                    if (hashMap.containsKey(Scopes.PROFILE)) {
                        MainActivity.this.users.edit().putString(Scopes.PROFILE, hashMap.get(Scopes.PROFILE).toString()).commit();
                    }
                    if (hashMap.containsKey(TypedValues.Custom.S_COLOR)) {
                        MainActivity.this.users.edit().putString(TypedValues.Custom.S_COLOR, hashMap.get(TypedValues.Custom.S_COLOR).toString()).commit();
                    }
                }
            }

            @Override
            public void onChildChanged(DataSnapshot dataSnapshot, String str) {
                GenericTypeIndicator<HashMap<String, Object>> genericTypeIndicator = new GenericTypeIndicator<HashMap<String, Object>>() {
                };
                dataSnapshot.getKey();
            }

            @Override
            public void onChildRemoved(DataSnapshot dataSnapshot) {
                GenericTypeIndicator<HashMap<String, Object>> genericTypeIndicator = new GenericTypeIndicator<HashMap<String, Object>>() {
                };
                dataSnapshot.getKey();
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {
                databaseError.getCode();
                databaseError.getMessage();
            }
        };
        this._Users_child_listener = childEventListener;
        this.Users.addChildEventListener(childEventListener);
        ChildEventListener childEventListener2 = new ChildEventListener() {
            @Override
            public void onChildMoved(DataSnapshot dataSnapshot, String str) {
            }

            @Override
            public void onChildAdded(DataSnapshot dataSnapshot, String str) {
                GenericTypeIndicator<HashMap<String, Object>> genericTypeIndicator = new GenericTypeIndicator<HashMap<String, Object>>() {
                };
                String key = dataSnapshot.getKey();
                final HashMap hashMap = (HashMap) dataSnapshot.getValue(genericTypeIndicator);
                if (key.equals("update") && hashMap.containsKey(ClientCookie.VERSION_ATTR)) {
                    if (Double.parseDouble(MainActivity.this.app_version) >= Double.parseDouble(hashMap.get(ClientCookie.VERSION_ATTR).toString())) {
                        if (Double.parseDouble(MainActivity.this.app_version) == Double.parseDouble(hashMap.get(ClientCookie.VERSION_ATTR).toString())) {
                            MainActivity.this.data2 = true;
                            return;
                        } else if (Double.parseDouble(MainActivity.this.app_version) > Double.parseDouble(hashMap.get(ClientCookie.VERSION_ATTR).toString())) {
                            MainActivity.this.data2 = true;
                            SketchwareUtil.showMessage(MainActivity.this.getApplicationContext(), "Obrigado por utilizar a versão beta.");
                            return;
                        } else {
                            SketchwareUtil.showMessage(MainActivity.this.getApplicationContext(), "Algo deu errado");
                            MainActivity.this.finishAffinity();
                            return;
                        }
                    }
                    MainActivity.this.lottie_login.setVisibility(4);
                    BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(MainActivity.this);
                    View inflate = MainActivity.this.getLayoutInflater().inflate(R.layout.update_cus, (ViewGroup) null);
                    bottomSheetDialog.setContentView(inflate);
                    bottomSheetDialog.getWindow().findViewById(R.id.design_bottom_sheet).setBackgroundResource(android.R.color.transparent);
                    LinearLayout linearLayout = (LinearLayout) inflate.findViewById(R.id.bg);
                    TextView textView = (TextView) inflate.findViewById(R.id.now);
                    textView.setText("INSTALAR AGORA");
                    ((TextView) inflate.findViewById(R.id.whats_new)).setText(hashMap.get("whats_new").toString());
                    ((TextView) inflate.findViewById(R.id.version)).setText("Versão: ".concat(hashMap.get(ClientCookie.VERSION_ATTR).toString()));
                    TextView textView2 = (TextView) inflate.findViewById(R.id.later);
                    textView2.setText("DEPOIS");
                    MainActivity.this._round_corner_and_ripple(linearLayout, 30.0d, 0.0d, "#FFFFFF", false);
                    MainActivity.this._round_corner_and_ripple(textView, 15.0d, 10.0d, "#1361F5", true);
                    MainActivity.this._round_corner_and_ripple(textView2, 15.0d, 0.0d, "#E0E0E0", true);
                    if (hashMap.get("cancelable").toString().equals("false")) {
                        textView2.setVisibility(8);
                    }
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            MainActivity.this.web.setAction("android.intent.action.VIEW");
                            MainActivity.this.web.setData(Uri.parse(hashMap.get("download_url").toString()));
                            MainActivity.this.startActivity(MainActivity.this.web);
                        }
                    });
                    textView2.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            MainActivity.this.intent.setClass(MainActivity.this.getApplicationContext(), HomeActivity.class);
                            MainActivity.this.startActivity(MainActivity.this.intent);
                            MainActivity.this.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
                        }
                    });
                    bottomSheetDialog.show();
                }
            }

            @Override
            public void onChildChanged(DataSnapshot dataSnapshot, String str) {
                GenericTypeIndicator<HashMap<String, Object>> genericTypeIndicator = new GenericTypeIndicator<HashMap<String, Object>>() {
                };
                String key = dataSnapshot.getKey();
                final HashMap hashMap = (HashMap) dataSnapshot.getValue(genericTypeIndicator);
                if (key.equals("update") && hashMap.containsKey(ClientCookie.VERSION_ATTR)) {
                    if (Double.parseDouble(MainActivity.this.app_version) >= Double.parseDouble(hashMap.get(ClientCookie.VERSION_ATTR).toString())) {
                        if (Double.parseDouble(MainActivity.this.app_version) == Double.parseDouble(hashMap.get(ClientCookie.VERSION_ATTR).toString())) {
                            MainActivity.this.data2 = true;
                            return;
                        } else if (Double.parseDouble(MainActivity.this.app_version) > Double.parseDouble(hashMap.get(ClientCookie.VERSION_ATTR).toString())) {
                            MainActivity.this.data2 = true;
                            SketchwareUtil.showMessage(MainActivity.this.getApplicationContext(), "Obrigado por utilizar a versão beta");
                            return;
                        } else {
                            SketchwareUtil.showMessage(MainActivity.this.getApplicationContext(), "Algo deu errado");
                            MainActivity.this.finishAffinity();
                            return;
                        }
                    }
                    MainActivity.this.lottie_login.setVisibility(4);
                    BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(MainActivity.this);
                    View inflate = MainActivity.this.getLayoutInflater().inflate(R.layout.update_cus, (ViewGroup) null);
                    bottomSheetDialog.setContentView(inflate);
                    bottomSheetDialog.getWindow().findViewById(R.id.design_bottom_sheet).setBackgroundResource(android.R.color.transparent);
                    LinearLayout linearLayout = (LinearLayout) inflate.findViewById(R.id.bg);
                    TextView textView = (TextView) inflate.findViewById(R.id.now);
                    textView.setText("INSTALAR AGORA");
                    ((TextView) inflate.findViewById(R.id.whats_new)).setText(hashMap.get("whats_new").toString());
                    ((TextView) inflate.findViewById(R.id.version)).setText("Versão: ".concat(hashMap.get(ClientCookie.VERSION_ATTR).toString()));
                    TextView textView2 = (TextView) inflate.findViewById(R.id.later);
                    textView2.setText("DEPOIS");
                    MainActivity.this._round_corner_and_ripple(linearLayout, 30.0d, 0.0d, "#FFFFFF", false);
                    MainActivity.this._round_corner_and_ripple(textView, 15.0d, 10.0d, "#1361F5", true);
                    MainActivity.this._round_corner_and_ripple(textView2, 15.0d, 0.0d, "#E0E0E0", true);
                    if (hashMap.get("cancelable").toString().equals("false")) {
                        textView2.setVisibility(8);
                    }
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            MainActivity.this.web.setAction("android.intent.action.VIEW");
                            MainActivity.this.web.setData(Uri.parse(hashMap.get("download_url").toString()));
                            MainActivity.this.startActivity(MainActivity.this.web);
                        }
                    });
                    textView2.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            MainActivity.this.intent.setClass(MainActivity.this.getApplicationContext(), HomeActivity.class);
                            MainActivity.this.startActivity(MainActivity.this.intent);
                            MainActivity.this.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
                        }
                    });
                    bottomSheetDialog.show();
                }
            }

            @Override
            public void onChildRemoved(DataSnapshot dataSnapshot) {
                GenericTypeIndicator<HashMap<String, Object>> genericTypeIndicator = new GenericTypeIndicator<HashMap<String, Object>>() {
                };
                dataSnapshot.getKey();
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {
                databaseError.getCode();
                databaseError.getMessage();
            }
        };
        this._update_child_listener = childEventListener2;
        this.update.addChildEventListener(childEventListener2);
        ChildEventListener childEventListener3 = new ChildEventListener() {
            @Override
            public void onChildMoved(DataSnapshot dataSnapshot, String str) {
            }

            @Override
            public void onChildAdded(DataSnapshot dataSnapshot, String str) {
                GenericTypeIndicator<HashMap<String, Object>> genericTypeIndicator = new GenericTypeIndicator<HashMap<String, Object>>() {
                };
                dataSnapshot.getKey();
                HashMap hashMap = (HashMap) dataSnapshot.getValue(genericTypeIndicator);
                if (hashMap.containsKey("maintenance")) {
                    MainActivity.this.maintenanc = hashMap.get("maintenance").toString();
                }
            }

            @Override
            public void onChildChanged(DataSnapshot dataSnapshot, String str) {
                GenericTypeIndicator<HashMap<String, Object>> genericTypeIndicator = new GenericTypeIndicator<HashMap<String, Object>>() {
                };
                dataSnapshot.getKey();
                HashMap hashMap = (HashMap) dataSnapshot.getValue(genericTypeIndicator);
                if (hashMap.containsKey("maintenance")) {
                    MainActivity.this.maintenanc = hashMap.get("maintenance").toString();
                }
            }

            @Override
            public void onChildRemoved(DataSnapshot dataSnapshot) {
                GenericTypeIndicator<HashMap<String, Object>> genericTypeIndicator = new GenericTypeIndicator<HashMap<String, Object>>() {
                };
                dataSnapshot.getKey();
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {
                databaseError.getCode();
                databaseError.getMessage();
            }
        };
        this._maintenance_child_listener = childEventListener3;
        this.maintenance.addChildEventListener(childEventListener3);
        this._network_request_listener = new RequestNetwork.RequestListener() {
            @Override
            public void onResponse(String str, String str2, HashMap<String, Object> hashMap) {
            }

            @Override
            public void onErrorResponse(String str, String str2) {
                MainActivity.this.intent.setClass(MainActivity.this.getApplicationContext(), NoInternetActivity.class);
                MainActivity mainActivity = MainActivity.this;
                mainActivity.startActivity(mainActivity.intent);
                MainActivity.this.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
            }
        };
        this.auth_updateEmailListener = new OnCompleteListener<Void>() {
            @Override
            public void onComplete(Task<Void> task) {
                task.isSuccessful();
                if (task.getException() != null) {
                    task.getException().getMessage();
                }
            }
        };
        this.auth_updatePasswordListener = new OnCompleteListener<Void>() {
            @Override
            public void onComplete(Task<Void> task) {
                task.isSuccessful();
                if (task.getException() != null) {
                    task.getException().getMessage();
                }
            }
        };
        this.auth_emailVerificationSentListener = new OnCompleteListener<Void>() {
            @Override
            public void onComplete(Task<Void> task) {
                task.isSuccessful();
                if (task.getException() != null) {
                    task.getException().getMessage();
                }
            }
        };
        this.auth_deleteUserListener = new OnCompleteListener<Void>() {
            @Override
            public void onComplete(Task<Void> task) {
                task.isSuccessful();
                if (task.getException() != null) {
                    task.getException().getMessage();
                }
            }
        };
        this.auth_phoneAuthListener = new OnCompleteListener<AuthResult>() {
            @Override
            public void onComplete(Task<AuthResult> task) {
                task.isSuccessful();
                if (task.getException() != null) {
                    task.getException().getMessage();
                }
            }
        };
        this.auth_updateProfileListener = new OnCompleteListener<Void>() {
            @Override
            public void onComplete(Task<Void> task) {
                task.isSuccessful();
                if (task.getException() != null) {
                    task.getException().getMessage();
                }
            }
        };
        this.auth_googleSignInListener = new OnCompleteListener<AuthResult>() {
            @Override
            public void onComplete(Task<AuthResult> task) {
                task.isSuccessful();
                if (task.getException() != null) {
                    task.getException().getMessage();
                }
            }
        };
        this._auth_create_user_listener = new OnCompleteListener<AuthResult>() {
            @Override
            public void onComplete(Task<AuthResult> task) {
                task.isSuccessful();
                if (task.getException() != null) {
                    task.getException().getMessage();
                }
            }
        };
        this._auth_sign_in_listener = new OnCompleteListener<AuthResult>() {
            @Override
            public void onComplete(Task<AuthResult> task) {
                task.isSuccessful();
                if (task.getException() != null) {
                    task.getException().getMessage();
                }
            }
        };
        this._auth_reset_password_listener = new OnCompleteListener<Void>() {
            @Override
            public void onComplete(Task<Void> task) {
                task.isSuccessful();
            }
        };
    }

    private void initializeLogic() {
        this.textview1.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/product.ttf"), 0);
        if (Build.VERSION.SDK_INT > 19) {
            Window window = getWindow();
            window.clearFlags(67108864);
            window.addFlags(Integer.MIN_VALUE);
            window.setStatusBarColor(-1);
        }
        this.network.startRequestNetwork("GET", "http://www.google.com", "ZStore Yt", this._network_request_listener);
        this.packageName = new MainActivity().getClass().getPackage().getName();
        try {
            this.app_version = getPackageManager().getPackageInfo("com.zackiestudios.zstore", 1).versionName;
        } catch (PackageManager.NameNotFoundException unused) {
        }
        TimerTask timerTask = new TimerTask() {
            @Override
            public void run() {
                MainActivity.this.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        if (MainActivity.this.maintenanc.equals("on")) {
                            MainActivity.this.intent.setClass(MainActivity.this.getApplicationContext(), MaintenanceActivity.class);
                            MainActivity.this.startActivity(MainActivity.this.intent);
                            MainActivity.this.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
                            MainActivity.this.finish();
                        } else {
                            MainActivity.this.intent.setClass(MainActivity.this.getApplicationContext(), HomeActivity.class);
                            MainActivity.this.startActivity(MainActivity.this.intent);
                            MainActivity.this.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
                            MainActivity.this.finish();
                        }
                        MainActivity.this.timer.cancel();
                    }
                });
            }
        };
        this.timer = timerTask;
        this._timer.scheduleAtFixedRate(timerTask, 0L, 400L);
        this.data1 = false;
        this.data2 = false;
        this.data3 = false;
    }

    public void _round_corner_and_ripple(View view, double d, double d2, String str, boolean z) {
        if (z) {
            GradientDrawable gradientDrawable = new GradientDrawable();
            gradientDrawable.setColor(Color.parseColor(str));
            gradientDrawable.setCornerRadius((int) d);
            view.setElevation((int) d2);
            Drawable rippleDrawable = new RippleDrawable(new ColorStateList(new int[][]{new int[0]}, new int[]{Color.parseColor("#9e9e9e")}), gradientDrawable, null);
            view.setClickable(true);
            view.setBackground(rippleDrawable);
            return;
        }
        GradientDrawable gradientDrawable2 = new GradientDrawable();
        gradientDrawable2.setColor(Color.parseColor(str));
        gradientDrawable2.setCornerRadius((int) d);
        view.setBackground(gradientDrawable2);
        view.setElevation((int) d2);
    }

    @Deprecated
    public void showMessage(String str) {
        Toast.makeText(getApplicationContext(), str, 0).show();
    }

    @Deprecated
    public int getLocationX(View view) {
        int[] iArr = new int[2];
        view.getLocationInWindow(iArr);
        return iArr[0];
    }

    @Deprecated
    public int getLocationY(View view) {
        int[] iArr = new int[2];
        view.getLocationInWindow(iArr);
        return iArr[1];
    }

    @Deprecated
    public int getRandom(int i, int i2) {
        return new Random().nextInt((i2 - i) + 1) + i;
    }

    @Deprecated
    public ArrayList<Double> getCheckedItemPositionsToArray(ListView listView) {
        ArrayList<Double> arrayList = new ArrayList<>();
        SparseBooleanArray checkedItemPositions = listView.getCheckedItemPositions();
        for (int i = 0; i < checkedItemPositions.size(); i++) {
            if (checkedItemPositions.valueAt(i)) {
                arrayList.add(Double.valueOf(checkedItemPositions.keyAt(i)));
            }
        }
        return arrayList;
    }

    @Deprecated
    public float getDip(int i) {
        return TypedValue.applyDimension(1, i, getResources().getDisplayMetrics());
    }

    @Deprecated
    public int getDisplayWidthPixels() {
        return getResources().getDisplayMetrics().widthPixels;
    }

    @Deprecated
    public int getDisplayHeightPixels() {
        return getResources().getDisplayMetrics().heightPixels;
    }
}