修复闪退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,8 +19,12 @@ public class resource {
public static void recommend(List<xm> list) {
try {
String hq = wj.dqwb(wj.gd_json);
list.clear();
String hq;
JSONObject json;
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) {
@ -33,11 +37,8 @@ public class resource {
}
}
}
hq = wl.hq("/recommend/resource?cookie=" + wl.Cookie);
if (hq == null) {
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);
}
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();
}