修复双击文件夹会显示所有音乐的问题
This commit is contained in:
@@ -89,15 +89,23 @@ public class MusicTools {
|
||||
}
|
||||
}
|
||||
|
||||
public List<MusicData> getPath(String path) {
|
||||
/**
|
||||
* 获取指定目录下的音乐
|
||||
* @param path 指定目录
|
||||
* @param isDir 是否扫描目录下的所有文件,false则仅为当前目录
|
||||
* @return 音乐列表
|
||||
*/
|
||||
public List<MusicData> getPath(String path,boolean isDir) {
|
||||
List<MusicData> list = new ArrayList<>();
|
||||
if (new File(path).isDirectory()&&!path.equals(MusicController.defaultMusicPath)) {
|
||||
for (String key : musicMap.keySet()) {
|
||||
if(key.startsWith(path)){
|
||||
list.addAll(musicMap.get(key));
|
||||
if(isDir) {
|
||||
if (new File(path).isDirectory() && !path.equals(MusicController.defaultMusicPath)) {
|
||||
for (String key : musicMap.keySet()) {
|
||||
if (key.startsWith(path)) {
|
||||
list.addAll(musicMap.get(key));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
if (musicMap.containsKey(path)) {
|
||||
MusicData tmp = musicMap.get(path).isEmpty() ? null : musicMap.get(path).get(0);
|
||||
|
||||
Reference in New Issue
Block a user