|
@@ -1,13 +1,8 @@
|
|
|
package com.info666.app.infraredRemote;
|
|
|
|
|
|
-import androidx.annotation.NonNull;
|
|
|
-import androidx.annotation.Nullable;
|
|
|
-import androidx.appcompat.app.AppCompatActivity;
|
|
|
-
|
|
|
import android.app.Activity;
|
|
|
import android.app.AlertDialog;
|
|
|
import android.content.Context;
|
|
|
-import android.content.DialogInterface;
|
|
|
import android.content.Intent;
|
|
|
import android.content.SharedPreferences;
|
|
|
import android.content.pm.PackageManager;
|
|
@@ -21,6 +16,10 @@ import android.widget.Button;
|
|
|
import android.widget.EditText;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
+import androidx.annotation.NonNull;
|
|
|
+import androidx.annotation.Nullable;
|
|
|
+import androidx.appcompat.app.AppCompatActivity;
|
|
|
+
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
@@ -29,8 +28,9 @@ import com.info666.app.infraredRemote.activity.MyCaptureActivity;
|
|
|
import com.king.zxing.CameraScan;
|
|
|
import com.tencent.vasdolly.helper.ChannelReaderUtil;
|
|
|
|
|
|
-
|
|
|
-import cn.hutool.http.HttpUtil;
|
|
|
+import okhttp3.OkHttpClient;
|
|
|
+import okhttp3.Request;
|
|
|
+import okhttp3.Response;
|
|
|
|
|
|
public class MainActivity extends AppCompatActivity implements View.OnClickListener, Handler.Callback {
|
|
|
|
|
@@ -75,8 +75,11 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|
|
new Thread(()->{
|
|
|
Message message = new Message();
|
|
|
try {
|
|
|
- String result = HttpUtil.get("http://ykapi.sh-jh.cn/api/api/v1/appConfig/getAppConfig",10 * 1000);
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
+ OkHttpClient httpClient = new OkHttpClient();
|
|
|
+ Response response = httpClient.newCall(
|
|
|
+ new Request.Builder().url("http://ykapi.sh-jh.cn/api/api/v1/appConfig/getAppConfig").build()).
|
|
|
+ execute();
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(response.body().string());
|
|
|
JSONArray jsonArray = jsonObject.getJSONArray("data");
|
|
|
message.what = 200;
|
|
|
message.obj = jsonArray.getJSONObject(0).toJSONString();
|