From Russia v1.0版本的 MD5 值为:52aeb8738ddf971390ea1486e59c6ccd

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


package com.brorders.launcher.fragment;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
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.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.widget.AppCompatButton;
import androidx.fragment.app.Fragment;
import com.brorders.game.R;
import com.brorders.game.core.GTASA;
import java.io.File;
import java.io.IOException;
import java.util.Timer;
import java.util.TimerTask;
import org.ini4j.Wini;

public class MainFragment extends Fragment {
    ImageButton ib_info;
    EditText nickname;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        final View inflate = inflater.inflate(R.layout.fragment_main, container, false);
        final Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.button_click);
        InitLogic();
        this.nickname = (EditText) inflate.findViewById(R.id.edit_text_name);
        this.ib_info = (ImageButton) inflate.findViewById(R.id.ib_info);
        ((AppCompatButton) inflate.findViewById(R.id.button_play)).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                v.startAnimation(animation);
                Timer t = new Timer();
                t.schedule(new TimerTask() {
                    @Override
                    public void run() {
                        MainFragment.this.onClickPlay();
                    }
                }, 200L);
            }
        });
        this.ib_info.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                v.startAnimation(animation);
                TextView info_nick = (TextView) inflate.findViewById(R.id.text_view_info_about_nickname);
                if (info_nick.getVisibility() == 4) {
                    info_nick.setVisibility(0);
                } else {
                    info_nick.setVisibility(4);
                }
            }
        });
        ((ImageButton) inflate.findViewById(R.id.button_vk)).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                v.startAnimation(animation);
                Timer t = new Timer();
                t.schedule(new TimerTask() {
                    @Override
                    public void run() {
                        MainFragment.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://vk.com/")));
                    }
                }, 200L);
            }
        });
        ((ImageButton) inflate.findViewById(R.id.button_discord)).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                v.startAnimation(animation);
                Timer t = new Timer();
                t.schedule(new TimerTask() {
                    @Override
                    public void run() {
                        MainFragment.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://discrord.com/")));
                    }
                }, 200L);
            }
        });
        ((ImageButton) inflate.findViewById(R.id.button_telegram)).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                v.startAnimation(animation);
                Timer t = new Timer();
                t.schedule(new TimerTask() {
                    @Override
                    public void run() {
                        MainFragment.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://t.me/")));
                    }
                }, 200L);
            }
        });
        ((AppCompatButton) inflate.findViewById(R.id.button_clean_game)).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                v.startAnimation(animation);
                Timer t = new Timer();
                t.schedule(new TimerTask() {
                    @Override
                    public void run() {
                    }
                }, 200L);
            }
        });
        this.nickname.setOnEditorActionListener(new TextView.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                if (actionId == 3 || actionId == 6 || (event.getAction() == 0 && event.getKeyCode() == 66)) {
                    try {
                        File f = new File(Environment.getExternalStorageDirectory() + "/Reytiz/SAMP/settings.ini");
                        if (!f.exists()) {
                            f.createNewFile();
                            f.mkdirs();
                        }
                        Wini w = new Wini(new File(Environment.getExternalStorageDirectory() + "/Reytiz/SAMP/settings.ini"));
                        if (MainFragment.this.checkValidNick()) {
                            w.put("client", "name", MainFragment.this.nickname.getText().toString());
                            Toast.makeText(MainFragment.this.getActivity(), "Ваш новый никнейм успешно сохранен!", 0).show();
                        } else {
                            MainFragment.this.checkValidNick();
                        }
                        w.store();
                    } catch (IOException e) {
                        e.printStackTrace();
                        Toast.makeText(MainFragment.this.getActivity(), "Установите игру!", 0).show();
                    }
                }
                return false;
            }
        });
        this.nickname.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
                try {
                    File f = new File(Environment.getExternalStorageDirectory() + "/Reytiz/SAMP/settings.ini");
                    if (!f.exists()) {
                        f.createNewFile();
                        f.mkdirs();
                    }
                    Wini w = new Wini(new File(Environment.getExternalStorageDirectory() + "/Reytiz/SAMP/settings.ini"));
                    if (MainFragment.this.checkValidNick()) {
                        w.put("client", "name", MainFragment.this.nickname.getText().toString());
                    } else {
                        MainFragment.this.checkValidNick();
                    }
                    w.store();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

            @Override
            public void afterTextChanged(Editable editable) {
            }
        });
        return inflate;
    }

    public void onClickPlay() {
        if (IsGameInstalled()) {
            startActivity(new Intent(getActivity(), (Class<?>) GTASA.class));
        }
    }

    private boolean IsGameInstalled() {
        String CheckFile = Environment.getExternalStorageDirectory() + "/Reytiz/texdb/gta3.img";
        File file = new File(CheckFile);
        return file.exists();
    }

    private void InitLogic() {
        try {
            Wini w = new Wini(new File(Environment.getExternalStorageDirectory() + "/Reytiz/SAMP/settings.ini"));
            this.nickname.setText(w.get("client", "name"));
            w.store();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public boolean checkValidNick() {
        EditText nick = (EditText) getActivity().findViewById(R.id.editText);
        if (nick.getText().toString().isEmpty()) {
            Toast.makeText(getActivity(), "Введите ник", 0).show();
            return false;
        }
        if (!nick.getText().toString().contains("_")) {
            Toast.makeText(getActivity(), "Ник должен содержать символ \"_\"", 0).show();
            return false;
        }
        if (nick.getText().toString().length() < 4) {
            Toast.makeText(getActivity(), "Длина ника должна быть не менее 4 символов", 0).show();
            return false;
        }
        return true;
    }
}