修复闪退BUG

This commit is contained in:
muqing 2023-12-26 20:55:07 +08:00
parent f44943d726
commit 9b7de6544d
4 changed files with 35 additions and 31 deletions

View File

@ -19,25 +19,26 @@ public class resource {
public static void recommend(List<xm> list) {
try {
String hq = wj.dqwb(wj.gd_json);
list.clear();
String hq;
JSONObject json;
if (hq != null) {
json = new JSONObject(hq);
if (json.getInt("code") == 200) {
wj.xrwb(wj.gd_json, hq);
JSONArray recommend = json.getJSONArray("recommend");
int length = recommend.length();
for (int i = 0; i < length; i++) {
JSONObject jsonObject = recommend.getJSONObject(i);
add(jsonObject, list);
}
}
}
hq = wl.hq("/recommend/resource?cookie=" + wl.Cookie);
if (hq == null) {
hq = wj.dqwb(wj.gd_json);
if (hq != null) {
json = new JSONObject(hq);
if (json.getInt("code") == 200) {
wj.xrwb(wj.gd_json, hq);
JSONArray recommend = json.getJSONArray("recommend");
int length = recommend.length();
for (int i = 0; i < length; i++) {
JSONObject jsonObject = recommend.getJSONObject(i);
add(jsonObject, list);
}
}
}
return;
}
list.clear();
json = new JSONObject(hq);
if (json.getInt("code") == 200) {
wj.xrwb(wj.gd_json, hq);

View File

@ -58,14 +58,7 @@ public class bfqkz extends Service {
}
bfqkz.list.remove(bfqkz.xm);
bfqkz.xm = bfqkz.list.get(bfqkz.getmti(bfqkz.ms));
new Thread() {
@Override
public void run() {
super.run();
bfqkz.mp3(com.muqingbfq.api.
url.hq(bfqkz.xm));
}
}.start();
new mp3(id);
return;
}
if (TextUtils.isEmpty(xm.picurl)) {
@ -74,17 +67,28 @@ public class bfqkz extends Service {
if (bfqkz.lishi_list.size() >= 100) {
bfqkz.lishi_list.remove(0);
}
bfqkz.lishi_list.remove(bfqkz.xm);
bfqkz.lishi_list.add(0, bfqkz.xm);
wj.xrwb(wj.gd + "mp3_hc.json", new com.google.gson.Gson().toJson(bfqkz.lishi_list));
if (bfqkz.lishi_list.size() > 0) {
bfqkz.lishi_list.remove(bfqkz.xm);
bfqkz.lishi_list.add(0, bfqkz.xm);
wj.xrwb(wj.gd + "mp3_hc.json", new com.google.gson.Gson().toJson(bfqkz.lishi_list));
}
mt.setDataSource(id);
} catch (Exception e) {
yc.start(home.appCompatActivity, "bfqkz mp3(" + id + ") :" + e);
}
}
public static void mp3(Uri id) {
mp3(id.toString());
public static class mp3 extends Thread {
String id;
public mp3(String id) {
this.id = id;
start();
}
@Override
public void run() {
super.run();
mp3(id);
}
}
@ -147,7 +151,7 @@ public class bfqkz extends Service {
case PlaybackStateCompat.STATE_PLAYING:
case PlaybackStateCompat.STATE_PAUSED:
case PlaybackStateCompat.STATE_NONE:
mp3(uri);
// mp3(uri);/
playback = new PlaybackStateCompat.Builder()
.setState(PlaybackStateCompat.STATE_CONNECTING, 0, 1.0f)
.build();

View File

@ -47,12 +47,12 @@ public class gd_adapter extends Fragment {
public void run() {
super.run();
resource.recommend(list);
main.handler.postDelayed(new sx(baseadapter),500);
main.handler.post(new sx(baseadapter));
}
}.start();
return layout;
}
private static class sx implements Runnable {
private class sx implements Runnable {
gd.baseadapter baseadapter;
public sx(gd.baseadapter baseadapter) {

View File

@ -16,7 +16,6 @@ public class MyViewHoder extends RecyclerView.ViewHolder {
name = itemView.findViewById(R.id.wb1);
zz = itemView.findViewById(R.id.zz);
}
public Context getContext() {
return itemView.getContext();
}