fix bugs
add new bug
This commit is contained in:
parent
2b6f73b1ca
commit
e2019ded66
@ -86,9 +86,6 @@ public class AlbumsRecyclerAdapter extends RecyclerView.Adapter<AlbumsRecyclerAd
|
|||||||
holder.icon.setOnClickListener(new View.OnClickListener() {
|
holder.icon.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
System.out.println(data.getFile());
|
|
||||||
System.out.println(data.getImageUrl());
|
|
||||||
System.out.println(data.getImg(-1, -1));
|
|
||||||
if (data.getImg(-1, -1) != null) {
|
if (data.getImg(-1, -1) != null) {
|
||||||
Glide.with(context).load(data.getImg(-1, -1))
|
Glide.with(context).load(data.getImg(-1, -1))
|
||||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(25, 3)))
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(25, 3)))
|
||||||
|
@ -232,6 +232,7 @@ public class MusicLibsAdapter extends ArrayAdapter<MusicData> {
|
|||||||
} else {
|
} else {
|
||||||
holder.collection.setVisibility(View.VISIBLE);
|
holder.collection.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data.isDir()) {
|
if (!data.isDir()) {
|
||||||
if (model != LIBS_MODEL_Album && model != LIBS_MODEL_Artist) {
|
if (model != LIBS_MODEL_Album && model != LIBS_MODEL_Artist) {
|
||||||
if (model == LIBS_MODEL_PLAY_Collection) {
|
if (model == LIBS_MODEL_PLAY_Collection) {
|
||||||
@ -256,9 +257,6 @@ public class MusicLibsAdapter extends ArrayAdapter<MusicData> {
|
|||||||
holder.icon.setOnClickListener(new View.OnClickListener() {
|
holder.icon.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
System.out.println(data.getFile());
|
|
||||||
System.out.println(data.getImageUrl());
|
|
||||||
System.out.println(data.getImg(-1, -1));
|
|
||||||
if (data.getImg(-1, -1) != null) {
|
if (data.getImg(-1, -1) != null) {
|
||||||
Glide.with(getContext()).load(data.getImg(-1, -1))
|
Glide.with(getContext()).load(data.getImg(-1, -1))
|
||||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(25, 3)))
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(25, 3)))
|
||||||
|
@ -198,7 +198,7 @@ public class MusicData {
|
|||||||
public String getFileBase64() {
|
public String getFileBase64() {
|
||||||
if (StringUtil.isEmpty(file))
|
if (StringUtil.isEmpty(file))
|
||||||
return null;
|
return null;
|
||||||
return new String(Base64.encode(file.getBytes(), Base64.DEFAULT)).replace("\n", "");
|
return AppTools.getUrlBase64(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ public class MusicData {
|
|||||||
if (isDownloadImg) {
|
if (isDownloadImg) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (StringUtil.isEmpty(file)) {
|
if (StringUtil.isEmpty(file)&&StringUtil.isEmpty(title)&&StringUtil.isEmpty(album)) {
|
||||||
img = BitmapFactory.decodeResource(MyApplication.application.getResources(), R.mipmap.ic_launcher);
|
img = BitmapFactory.decodeResource(MyApplication.application.getResources(), R.mipmap.ic_launcher);
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
@ -255,8 +255,14 @@ public class MusicData {
|
|||||||
img = null;
|
img = null;
|
||||||
isDownloadImg = true;
|
isDownloadImg = true;
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
json.put("fileName", getFile());
|
if(StringUtil.isEmpty(getAlbum())) {
|
||||||
NetworkTool.init().download(NetworkTool.NetworkAPI.MUSIC_IMAGE,json, "image_cache" + File.separator + imageSaveName,"post", new DownloadInterface() {
|
json.put("fileName", getFile());
|
||||||
|
}else{
|
||||||
|
json.put("fileName",AppTools.getUrlBase64(getAlbum()));
|
||||||
|
json.put("type","album");
|
||||||
|
}
|
||||||
|
System.out.println("下载图片:"+ NetworkTool.NetworkAPI.MUSIC_IMAGE+"?"+NetworkTool.toGetSplice(json));
|
||||||
|
NetworkTool.init().downloadImage(NetworkTool.NetworkAPI.MUSIC_IMAGE,json, imageSaveName,"post", new DownloadInterface() {
|
||||||
@Override
|
@Override
|
||||||
public void onDownloadOver(File oldJar) {
|
public void onDownloadOver(File oldJar) {
|
||||||
AppTools.saveBitmap(oldJar,imageSaveName);
|
AppTools.saveBitmap(oldJar,imageSaveName);
|
||||||
|
@ -20,6 +20,7 @@ import com.yutou.nas_music_player.Datas.MusicData;
|
|||||||
import com.yutou.nas_music_player.Datas.PreviousPlayerList;
|
import com.yutou.nas_music_player.Datas.PreviousPlayerList;
|
||||||
import com.yutou.nas_music_player.Interfaces.NetworkInterface;
|
import com.yutou.nas_music_player.Interfaces.NetworkInterface;
|
||||||
import com.yutou.nas_music_player.MyApplication;
|
import com.yutou.nas_music_player.MyApplication;
|
||||||
|
import com.yutou.nas_music_player.tools.AppTools;
|
||||||
import com.yutou.nas_music_player.tools.CollectionTools;
|
import com.yutou.nas_music_player.tools.CollectionTools;
|
||||||
import com.yutou.nas_music_player.tools.ConfigTools;
|
import com.yutou.nas_music_player.tools.ConfigTools;
|
||||||
import com.yutou.nas_music_player.tools.NetworkTool;
|
import com.yutou.nas_music_player.tools.NetworkTool;
|
||||||
@ -389,7 +390,12 @@ public class MusicContainer {
|
|||||||
} else {
|
} else {
|
||||||
playIndex = 0;
|
playIndex = 0;
|
||||||
}
|
}
|
||||||
play(libs.mainData.get(playIndex));
|
if(libs.mainData.isEmpty()){
|
||||||
|
playOfAllRandom();
|
||||||
|
AppTools.toast("当前播放列表为空,随机播放");
|
||||||
|
}else {
|
||||||
|
play(libs.mainData.get(playIndex));
|
||||||
|
}
|
||||||
} else {//播放列表中的歌单
|
} else {//播放列表中的歌单
|
||||||
if (playList.size() > (playIndex + 1)) {
|
if (playList.size() > (playIndex + 1)) {
|
||||||
playIndex++;
|
playIndex++;
|
||||||
@ -583,6 +589,10 @@ public class MusicContainer {
|
|||||||
NetworkTool.init().httpGet(url, json, new NetworkInterface() {
|
NetworkTool.init().httpGet(url, json, new NetworkInterface() {
|
||||||
@Override
|
@Override
|
||||||
public void httpGetData(Object data, int state) {
|
public void httpGetData(Object data, int state) {
|
||||||
|
if(StringUtil.isEmpty((String)data)){
|
||||||
|
networkInterface.httpGetData(new ArrayList<>(), 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
JSONObject json = JSONObject.parseObject((String) data);
|
JSONObject json = JSONObject.parseObject((String) data);
|
||||||
if (json.getInteger("code") == 0) {
|
if (json.getInteger("code") == 0) {
|
||||||
if (json.getJSONArray("data").toJSONString().contains("md5")) {
|
if (json.getJSONArray("data").toJSONString().contains("md5")) {
|
||||||
|
@ -3,6 +3,7 @@ package com.yutou.nas_music_player.tools;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.util.Base64;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.kaopiz.kprogresshud.KProgressHUD;
|
import com.kaopiz.kprogresshud.KProgressHUD;
|
||||||
@ -92,7 +93,9 @@ public class AppTools {
|
|||||||
imageLoader.init(builder.build());
|
imageLoader.init(builder.build());
|
||||||
return imageLoader;
|
return imageLoader;
|
||||||
}
|
}
|
||||||
|
public static String getUrlBase64(String text){
|
||||||
|
return new String(Base64.encode(text.getBytes(), Base64.DEFAULT)).replace("\n", "");
|
||||||
|
}
|
||||||
public static void toast(String s) {
|
public static void toast(String s) {
|
||||||
AppData.handler.post(new Runnable() {
|
AppData.handler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,8 +20,10 @@ import java.net.HttpURLConnection;
|
|||||||
import java.net.SocketTimeoutException;
|
import java.net.SocketTimeoutException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -44,7 +46,7 @@ public class NetworkTool {
|
|||||||
public static String MUSIC_Collection_Remove = HOME + "/music/favorite/remove.do";
|
public static String MUSIC_Collection_Remove = HOME + "/music/favorite/remove.do";
|
||||||
public static String MUSIC_ALL = HOME + "/music/all.do";
|
public static String MUSIC_ALL = HOME + "/music/all.do";
|
||||||
public static String MUSIC_METADATA = HOME + "/music/find/file.do";
|
public static String MUSIC_METADATA = HOME + "/music/find/file.do";
|
||||||
public static String MUSIC_IMAGE = HOME + "/music/image.do";
|
public static String MUSIC_IMAGE = HOME + "/music/web/image.do";
|
||||||
public static String MUSIC_PLAY = HOME + "/music/play.do";
|
public static String MUSIC_PLAY = HOME + "/music/play.do";
|
||||||
public static String MUSIC_RANDOM = HOME + "/music/random.do";
|
public static String MUSIC_RANDOM = HOME + "/music/random.do";
|
||||||
|
|
||||||
@ -61,14 +63,14 @@ public class NetworkTool {
|
|||||||
ping("http://192.168.31.88:8000/public/version.do", new NetworkInterface() {
|
ping("http://192.168.31.88:8000/public/version.do", new NetworkInterface() {
|
||||||
@Override
|
@Override
|
||||||
public void httpGetData(Object data, int state) {
|
public void httpGetData(Object data, int state) {
|
||||||
HOME="http://192.168.31.88:8000/nas";
|
HOME = "http://192.168.31.88:8000/nas";
|
||||||
AppTools.toast("检测到局域网在线,使用局域网模式");
|
AppTools.toast("检测到局域网在线,使用局域网模式");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void httpError(Exception e) {
|
public void httpError(Exception e) {
|
||||||
System.out.println("局域网不在线,走互联网");
|
System.out.println("局域网不在线,走互联网");
|
||||||
httpGet("http://tools.yutou233.cn/nas/music/getlocalhost.do?token="+HTTP_KEY, new JSONObject(), new NetworkInterface() {
|
httpGet("http://tools.yutou233.cn/nas/music/getlocalhost.do?token=" + HTTP_KEY, new JSONObject(), new NetworkInterface() {
|
||||||
@Override
|
@Override
|
||||||
public void httpGetData(Object data, int state) {
|
public void httpGetData(Object data, int state) {
|
||||||
try {
|
try {
|
||||||
@ -102,23 +104,29 @@ public class NetworkTool {
|
|||||||
public void httpGet(String url, JSONObject body, NetworkInterface networkInterface) {
|
public void httpGet(String url, JSONObject body, NetworkInterface networkInterface) {
|
||||||
httpPost(url, body, networkInterface);
|
httpPost(url, body, networkInterface);
|
||||||
}
|
}
|
||||||
private void ping(String url,NetworkInterface networkInterface){
|
|
||||||
|
private void ping(String url, NetworkInterface networkInterface) {
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
HttpURLConnection connection = (HttpURLConnection) new URL(url ).openConnection();
|
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
||||||
|
connection.setConnectTimeout(50);
|
||||||
|
connection.setReadTimeout(50);
|
||||||
connection.connect();
|
connection.connect();
|
||||||
connection.setConnectTimeout(100);
|
InputStream inputStream = connection.getErrorStream();
|
||||||
connection.setReadTimeout(100);
|
System.out.println(inputStream.read());
|
||||||
|
inputStream.close();
|
||||||
System.out.println(connection.getResponseCode());
|
System.out.println(connection.getResponseCode());
|
||||||
networkInterface.httpGetData(null,0);
|
networkInterface.httpGetData(null, 0);
|
||||||
|
connection.disconnect();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
networkInterface.httpError(e);
|
networkInterface.httpError(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void httpGet_old(final String url, final JSONObject body, final NetworkInterface networkInterface) {
|
public void httpGet_old(final String url, final JSONObject body, final NetworkInterface networkInterface) {
|
||||||
if (!url.startsWith("http:") && !StringUtil.isEmpty(HOME)) {
|
if (!url.startsWith("http:") && !StringUtil.isEmpty(HOME)) {
|
||||||
@ -281,7 +289,7 @@ public class NetworkTool {
|
|||||||
return "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36";
|
return "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toGetSplice(JSONObject json) {
|
public static String toGetSplice(JSONObject json) {
|
||||||
try {
|
try {
|
||||||
json.put("token", NetworkAPI.HTTP_KEY);
|
json.put("token", NetworkAPI.HTTP_KEY);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
@ -307,15 +315,93 @@ public class NetworkTool {
|
|||||||
return string.toString();
|
return string.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void download(final String url, final String saveName) {
|
public void download(final String url, final String saveName) {
|
||||||
download(url,new JSONObject(), saveName,"GET", null);
|
download(url, new JSONObject(), saveName, "GET", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<String> downloadImageList = new ArrayList<>();
|
||||||
|
|
||||||
public void download(final String url,final JSONObject body, final String saveName,String method, final DownloadInterface downloadInterface) {
|
public synchronized void downloadImage(final String url, final JSONObject body, final String saveName, String method, final DownloadInterface downloadInterface) {
|
||||||
System.out.println(">>>>>>>>>>"+url);
|
System.out.println(">>>>>>>>>>" + url);
|
||||||
if (!url.startsWith("http:") && !StringUtil.isEmpty(HOME)) {
|
if (!url.startsWith("http:") && !StringUtil.isEmpty(HOME)) {
|
||||||
download(HOME+url,body,saveName,method,downloadInterface);
|
downloadImage(HOME + url, body, saveName, method, downloadInterface);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (downloadImageList.contains(url + "?" + toGetSplice(body))) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
downloadImageList.add(url + "?" + toGetSplice(body));
|
||||||
|
}
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
File jar = null;
|
||||||
|
try {
|
||||||
|
File savePath = new File(downloadPath + saveName + "_tmp.tmp");
|
||||||
|
if (!savePath.exists()) {
|
||||||
|
savePath.getParentFile().mkdirs();
|
||||||
|
}
|
||||||
|
Log.i(TAG, "下载文件:" + url + "?" + toGetSplice(body) + " 保存文件:" + saveName);
|
||||||
|
HttpURLConnection connection = (HttpURLConnection) new URL(url + "?" + toGetSplice(body)).openConnection();
|
||||||
|
|
||||||
|
// Log.i(TAG,"获取到网络请求:"+connection.getResponseCode());
|
||||||
|
if (method.toLowerCase().equals("post")) {
|
||||||
|
connection.setRequestMethod("POST");
|
||||||
|
connection.setDoOutput(true);
|
||||||
|
connection.setDoInput(true);
|
||||||
|
connection.setConnectTimeout(5 * 1000);
|
||||||
|
connection.setReadTimeout(10 * 1000);
|
||||||
|
// connection.addRequestProperty("content-type", "application/json");
|
||||||
|
connection.addRequestProperty("charset", "UTF-8");
|
||||||
|
/* OutputStream outputStream = connection.getOutputStream();
|
||||||
|
outputStream.write(body.toJSONString().getBytes());
|
||||||
|
outputStream.flush();
|
||||||
|
outputStream.close();*/
|
||||||
|
}
|
||||||
|
|
||||||
|
InputStream inputStream = connection.getInputStream();
|
||||||
|
jar = new File(downloadPath+File.separator+"image_cache"+File.separator+saveName + "_tmp.tmp");
|
||||||
|
if(!new File(downloadPath+File.separator+"image_cache").exists()){
|
||||||
|
new File(downloadPath+File.separator+"image_cache").mkdirs();
|
||||||
|
}
|
||||||
|
if(!jar.exists()){
|
||||||
|
jar.createNewFile();
|
||||||
|
}
|
||||||
|
Log.i(NetworkTool.class, "临时保存文件:" + jar.getAbsolutePath());
|
||||||
|
OutputStream outputStream = new FileOutputStream(jar);
|
||||||
|
byte[] bytes = new byte[1024];
|
||||||
|
int len;
|
||||||
|
while ((len = inputStream.read(bytes)) > 0) {
|
||||||
|
outputStream.write(bytes, 0, len);
|
||||||
|
}
|
||||||
|
outputStream.close();
|
||||||
|
inputStream.close();
|
||||||
|
File oldJar = new File(downloadPath + saveName);
|
||||||
|
/*if (oldJar.exists()) {
|
||||||
|
oldJar.delete();
|
||||||
|
}*/
|
||||||
|
jar.renameTo(oldJar);
|
||||||
|
Log.i(NetworkTool.class, "实际保存:" + oldJar.getAbsolutePath() + " " + oldJar.getName());
|
||||||
|
Log.toast(MyApplication.application, "下载完成,重启生效");
|
||||||
|
|
||||||
|
if (downloadInterface != null) {
|
||||||
|
downloadInterface.onDownloadOver(oldJar);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
if (downloadInterface != null)
|
||||||
|
downloadInterface.onError(e);
|
||||||
|
}
|
||||||
|
downloadImageList.remove(url + "?" + toGetSplice(body));
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void download(final String url, final JSONObject body, final String saveName, String method, final DownloadInterface downloadInterface) {
|
||||||
|
System.out.println(">>>>>>>>>>" + url);
|
||||||
|
if (!url.startsWith("http:") && !StringUtil.isEmpty(HOME)) {
|
||||||
|
download(HOME + url, body, saveName, method, downloadInterface);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@ -331,7 +417,7 @@ public class NetworkTool {
|
|||||||
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
||||||
|
|
||||||
// Log.i(TAG,"获取到网络请求:"+connection.getResponseCode());
|
// Log.i(TAG,"获取到网络请求:"+connection.getResponseCode());
|
||||||
if(method.toLowerCase().equals("post")){
|
if (method.toLowerCase().equals("post")) {
|
||||||
connection.setRequestMethod("POST");
|
connection.setRequestMethod("POST");
|
||||||
connection.setDoOutput(true);
|
connection.setDoOutput(true);
|
||||||
connection.setDoInput(true);
|
connection.setDoInput(true);
|
||||||
|
@ -99,6 +99,7 @@ public class MusicLibsFragment extends Fragment {
|
|||||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
System.out.println("点击列表:"+adapter.getModel());
|
||||||
switch (adapter.getModel()) {
|
switch (adapter.getModel()) {
|
||||||
case MusicLibsAdapter.LIBS_MODEL_ALL:
|
case MusicLibsAdapter.LIBS_MODEL_ALL:
|
||||||
clickAllList(position);
|
clickAllList(position);
|
||||||
@ -152,6 +153,8 @@ public class MusicLibsFragment extends Fragment {
|
|||||||
if (browserHelper != null) {
|
if (browserHelper != null) {
|
||||||
browserHelper.play(adapter.getItem(position));
|
browserHelper.play(adapter.getItem(position));
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
|
}else{
|
||||||
|
System.out.println("browserHelper为空");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,12 +57,12 @@ public class PlayLibsActivity extends AppCompatActivity {
|
|||||||
getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
|
getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_play_list);
|
setContentView(R.layout.activity_play_list);
|
||||||
|
PlayListener playListener = new PlayListener();
|
||||||
|
browserHelper = new MediaBrowserHelper(this);
|
||||||
|
browserHelper.regPlayListener(playListener);
|
||||||
initView();
|
initView();
|
||||||
bar_pos = getIntent().getIntExtra("bar_pos", 0);
|
bar_pos = getIntent().getIntExtra("bar_pos", 0);
|
||||||
setPlayData(MusicContainer.getInstance().getNowPlayData());
|
setPlayData(MusicContainer.getInstance().getNowPlayData());
|
||||||
browserHelper = new MediaBrowserHelper(this);
|
|
||||||
PlayListener playListener = new PlayListener();
|
|
||||||
browserHelper.regPlayListener(playListener);
|
|
||||||
handler = new Handler();
|
handler = new Handler();
|
||||||
play.setOnClickListener(new View.OnClickListener() {
|
play.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -123,6 +123,9 @@ public class PlayLibsActivity extends AppCompatActivity {
|
|||||||
fragments.add(new MusicLibsFragment(this,MusicLibsAdapter.LIBS_MODEL_Album));
|
fragments.add(new MusicLibsFragment(this,MusicLibsAdapter.LIBS_MODEL_Album));
|
||||||
fragments.add(new MusicLibsFragment(this,MusicLibsAdapter.LIBS_MODEL_PLAY_Collection));
|
fragments.add(new MusicLibsFragment(this,MusicLibsAdapter.LIBS_MODEL_PLAY_Collection));
|
||||||
fragments.add(new MusicLibsFragment(this,MusicLibsAdapter.LIBS_MODEL_Tmp));
|
fragments.add(new MusicLibsFragment(this,MusicLibsAdapter.LIBS_MODEL_Tmp));
|
||||||
|
for (MusicLibsFragment fragment : fragments) {
|
||||||
|
fragment.setPlayContainer(browserHelper);
|
||||||
|
}
|
||||||
viewPager.setAdapter(new FragmentStateAdapter(this) {
|
viewPager.setAdapter(new FragmentStateAdapter(this) {
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@ -143,7 +146,6 @@ public class PlayLibsActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTabUnselected(TabLayout.Tab tab) {
|
public void onTabUnselected(TabLayout.Tab tab) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user