修复闪退BUG
This commit is contained in:
parent
f44943d726
commit
9b7de6544d
|
@ -19,8 +19,12 @@ public class resource {
|
||||||
|
|
||||||
public static void recommend(List<xm> list) {
|
public static void recommend(List<xm> list) {
|
||||||
try {
|
try {
|
||||||
String hq = wj.dqwb(wj.gd_json);
|
list.clear();
|
||||||
|
String hq;
|
||||||
JSONObject json;
|
JSONObject json;
|
||||||
|
hq = wl.hq("/recommend/resource?cookie=" + wl.Cookie);
|
||||||
|
if (hq == null) {
|
||||||
|
hq = wj.dqwb(wj.gd_json);
|
||||||
if (hq != null) {
|
if (hq != null) {
|
||||||
json = new JSONObject(hq);
|
json = new JSONObject(hq);
|
||||||
if (json.getInt("code") == 200) {
|
if (json.getInt("code") == 200) {
|
||||||
|
@ -33,11 +37,8 @@ public class resource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hq = wl.hq("/recommend/resource?cookie=" + wl.Cookie);
|
|
||||||
if (hq == null) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
list.clear();
|
|
||||||
json = new JSONObject(hq);
|
json = new JSONObject(hq);
|
||||||
if (json.getInt("code") == 200) {
|
if (json.getInt("code") == 200) {
|
||||||
wj.xrwb(wj.gd_json, hq);
|
wj.xrwb(wj.gd_json, hq);
|
||||||
|
|
|
@ -58,14 +58,7 @@ public class bfqkz extends Service {
|
||||||
}
|
}
|
||||||
bfqkz.list.remove(bfqkz.xm);
|
bfqkz.list.remove(bfqkz.xm);
|
||||||
bfqkz.xm = bfqkz.list.get(bfqkz.getmti(bfqkz.ms));
|
bfqkz.xm = bfqkz.list.get(bfqkz.getmti(bfqkz.ms));
|
||||||
new Thread() {
|
new mp3(id);
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
super.run();
|
|
||||||
bfqkz.mp3(com.muqingbfq.api.
|
|
||||||
url.hq(bfqkz.xm));
|
|
||||||
}
|
|
||||||
}.start();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (TextUtils.isEmpty(xm.picurl)) {
|
if (TextUtils.isEmpty(xm.picurl)) {
|
||||||
|
@ -74,17 +67,28 @@ public class bfqkz extends Service {
|
||||||
if (bfqkz.lishi_list.size() >= 100) {
|
if (bfqkz.lishi_list.size() >= 100) {
|
||||||
bfqkz.lishi_list.remove(0);
|
bfqkz.lishi_list.remove(0);
|
||||||
}
|
}
|
||||||
|
if (bfqkz.lishi_list.size() > 0) {
|
||||||
bfqkz.lishi_list.remove(bfqkz.xm);
|
bfqkz.lishi_list.remove(bfqkz.xm);
|
||||||
bfqkz.lishi_list.add(0, 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));
|
wj.xrwb(wj.gd + "mp3_hc.json", new com.google.gson.Gson().toJson(bfqkz.lishi_list));
|
||||||
|
}
|
||||||
mt.setDataSource(id);
|
mt.setDataSource(id);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
yc.start(home.appCompatActivity, "bfqkz mp3(" + id + ") :" + e);
|
yc.start(home.appCompatActivity, "bfqkz mp3(" + id + ") :" + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void mp3(Uri id) {
|
public static class mp3 extends Thread {
|
||||||
mp3(id.toString());
|
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_PLAYING:
|
||||||
case PlaybackStateCompat.STATE_PAUSED:
|
case PlaybackStateCompat.STATE_PAUSED:
|
||||||
case PlaybackStateCompat.STATE_NONE:
|
case PlaybackStateCompat.STATE_NONE:
|
||||||
mp3(uri);
|
// mp3(uri);/
|
||||||
playback = new PlaybackStateCompat.Builder()
|
playback = new PlaybackStateCompat.Builder()
|
||||||
.setState(PlaybackStateCompat.STATE_CONNECTING, 0, 1.0f)
|
.setState(PlaybackStateCompat.STATE_CONNECTING, 0, 1.0f)
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -47,12 +47,12 @@ public class gd_adapter extends Fragment {
|
||||||
public void run() {
|
public void run() {
|
||||||
super.run();
|
super.run();
|
||||||
resource.recommend(list);
|
resource.recommend(list);
|
||||||
main.handler.postDelayed(new sx(baseadapter),500);
|
main.handler.post(new sx(baseadapter));
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
private static class sx implements Runnable {
|
private class sx implements Runnable {
|
||||||
gd.baseadapter baseadapter;
|
gd.baseadapter baseadapter;
|
||||||
|
|
||||||
public sx(gd.baseadapter baseadapter) {
|
public sx(gd.baseadapter baseadapter) {
|
||||||
|
|
|
@ -16,7 +16,6 @@ public class MyViewHoder extends RecyclerView.ViewHolder {
|
||||||
name = itemView.findViewById(R.id.wb1);
|
name = itemView.findViewById(R.id.wb1);
|
||||||
zz = itemView.findViewById(R.id.zz);
|
zz = itemView.findViewById(R.id.zz);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Context getContext() {
|
public Context getContext() {
|
||||||
return itemView.getContext();
|
return itemView.getContext();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user