@@ -158,7 +158,7 @@ public void run() {
158
158
159
159
160
160
// 悬浮窗开始
161
- if (Build .VERSION .SDK_INT >= 23 ) {
161
+ /* if (Build.VERSION.SDK_INT >= 23) {
162
162
if (Settings.canDrawOverlays(MainActivity.this)) {
163
163
164
164
Toast.makeText(MainActivity.this, "已开启悬浮窗权限!", Toast.LENGTH_SHORT).show();
@@ -173,7 +173,7 @@ public void run() {
173
173
} else {
174
174
175
175
}
176
-
176
+ */
177
177
initView ();
178
178
getAnnouncement ();
179
179
showAnnouncement ();
@@ -187,6 +187,7 @@ private void initView() {
187
187
mVipText .setVisibility (View .VISIBLE );
188
188
}
189
189
190
+ //绑定打开悬浮窗按钮
190
191
mStartBtn = findViewById (R .id .main_start_btn );
191
192
mStartBtn .setOnClickListener (new View .OnClickListener () {
192
193
@ Override
@@ -254,17 +255,14 @@ public void onClick(View view) {
254
255
.build ();
255
256
FloatWindow .get ().show ();
256
257
257
-
258
258
}
259
259
260
260
private void onFloat () {
261
-
262
261
// 显示球状态
263
262
if (!isBall ) {
264
263
showBall ();
265
264
return ;
266
265
}
267
-
268
266
isBall = false ;
269
267
View view = LayoutInflater .from (getApplicationContext ()).inflate (R .layout .layout_xfc , null );
270
268
EditText edt = view .findViewById (R .id .xfc_seek_edt );
@@ -433,78 +431,6 @@ public void run() {
433
431
});
434
432
}
435
433
436
- /*String apiSeekTT0(String tt) throws IOException, JSONException {
437
- Request request = new Request.Builder()
438
- .url("http://tool.chaoxing.zmorg.cn/api/search.php?q=" + tt)
439
- .method("GET", null)
440
- .build();
441
- Response response = client.newCall(request).execute();
442
- String data = response.body().string();
443
- JSONObject jsonObject = new JSONObject(data).getJSONObject("msg");
444
- String resStr = "【专属题库】 " + jsonObject.getString("answer");
445
- return resStr;
446
- }
447
-
448
- String apiSeekTT1(String tt) throws IOException, JSONException {
449
- MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
450
- RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
451
- .addFormDataPart("question", tt)
452
- .build();
453
- Request request = new Request.Builder()
454
- .url("http://cx.icodef.com/wyn-nb?v=2")
455
- .method("POST", body)
456
- .addHeader("Content-type", "application/x-www-form-urlencoded")
457
- .build();
458
- Response response = client.newCall(request).execute();
459
- String data = response.body().string();
460
- JSONObject jsonObject = new JSONObject(data);
461
- String resStr = "【题库1】 " + jsonObject.getString("data");
462
- return resStr;
463
- }
464
-
465
- String apiSeekTT2(String tt) throws IOException, JSONException {
466
- MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
467
- RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
468
- .addFormDataPart("question", tt)
469
- .build();
470
- Request request = new Request.Builder()
471
- .url("http://exam.tk/search")
472
- .method("POST", body)
473
- .addHeader("Content-type", "application/x-www-form-urlencoded")
474
- .build();
475
- Response response = client.newCall(request).execute();
476
- String data = response.body().string();
477
- JSONObject jsonObject = new JSONObject(data);
478
- String resStr = "【题库2】 " + jsonObject.getString("data");
479
- return resStr;
480
-
481
- }
482
-
483
- String apiSeekTT3(String tt) throws IOException, JSONException {
484
- MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
485
- Request request = new Request.Builder()
486
- .url("http://imnu.52king.cn/api/wk/index.php?c=" + tt)
487
- .method("GET", null)
488
- .build();
489
- Response response = client.newCall(request).execute();
490
- String data = response.body().string();
491
- JSONObject jsonObject = new JSONObject(data);
492
- String resStr = "【题库3】" + jsonObject.getString("answer");
493
- return resStr;
494
- }
495
-
496
-
497
- String apiFY(String text) throws IOException, JSONException {
498
- Request request = new Request.Builder()
499
- .url("http://tool.chaoxing.zmorg.cn/api/tx_fy.php?q=" + text)
500
- .method("GET", null)
501
- .build();
502
- Response response = client.newCall(request).execute();
503
- String data = response.body().string();
504
- JSONObject jsonObject = new JSONObject(data).getJSONObject("msg");
505
- String resStr = "【翻译】" + jsonObject.getString("TargetText");
506
- return resStr;
507
- }*/
508
434
509
435
/**
510
436
* 判断该字符串是否为中文
0 commit comments