Skip to content

Commit 7e26cc4

Browse files
committed
取消进入软件自动打开悬浮窗
1 parent fd865ed commit 7e26cc4

File tree

2 files changed

+4
-78
lines changed

2 files changed

+4
-78
lines changed

app/src/main/java/com/zmide/xuexiton/MainActivity.java

+3-77
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public void run() {
158158

159159

160160
// 悬浮窗开始
161-
if (Build.VERSION.SDK_INT >= 23) {
161+
/* if (Build.VERSION.SDK_INT >= 23) {
162162
if (Settings.canDrawOverlays(MainActivity.this)) {
163163
164164
Toast.makeText(MainActivity.this, "已开启悬浮窗权限!", Toast.LENGTH_SHORT).show();
@@ -173,7 +173,7 @@ public void run() {
173173
} else {
174174
175175
}
176-
176+
*/
177177
initView();
178178
getAnnouncement();
179179
showAnnouncement();
@@ -187,6 +187,7 @@ private void initView() {
187187
mVipText.setVisibility(View.VISIBLE);
188188
}
189189

190+
//绑定打开悬浮窗按钮
190191
mStartBtn = findViewById(R.id.main_start_btn);
191192
mStartBtn.setOnClickListener(new View.OnClickListener() {
192193
@Override
@@ -254,17 +255,14 @@ public void onClick(View view) {
254255
.build();
255256
FloatWindow.get().show();
256257

257-
258258
}
259259

260260
private void onFloat() {
261-
262261
// 显示球状态
263262
if (!isBall) {
264263
showBall();
265264
return;
266265
}
267-
268266
isBall = false;
269267
View view = LayoutInflater.from(getApplicationContext()).inflate(R.layout.layout_xfc, null);
270268
EditText edt = view.findViewById(R.id.xfc_seek_edt);
@@ -433,78 +431,6 @@ public void run() {
433431
});
434432
}
435433

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-
}*/
508434

509435
/**
510436
* 判断该字符串是否为中文

app/src/main/res/values/strings.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<resources>
22
<string name="app_name">学你🐎</string>
3-
<string name="main_start_btn">打开悬浮窗</string>
3+
<string name="main_start_btn">打开\\关闭悬浮窗</string>
44
<string name="paste">粘贴</string>
55
<string name="search">搜索</string>
66
<string name="clear">清空</string>

0 commit comments

Comments
 (0)