更改喜欢音乐逻辑和储存
This commit is contained in:
parent
08c50983aa
commit
48f469eab7
|
@ -1,4 +1,3 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK" />
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK" />
|
||||||
|
|
|
@ -18,7 +18,7 @@ android {
|
||||||
//noinspection OldTargetApi
|
//noinspection OldTargetApi
|
||||||
targetSdk 31
|
targetSdk 31
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.7.5"
|
versionName "1.7.6"
|
||||||
|
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
|
|
|
@ -76,5 +76,4 @@
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
31
app/src/main/java/com/muqingbfq/MP3.java
Normal file
31
app/src/main/java/com/muqingbfq/MP3.java
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
package com.muqingbfq;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class MP3 {
|
||||||
|
public String id, name, zz;
|
||||||
|
// 音乐的贴图
|
||||||
|
public Object picurl;
|
||||||
|
public MP3(String id, String name, String zz, String picurl) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.zz = zz;
|
||||||
|
this.picurl = picurl;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (!(o instanceof MP3)) return false;
|
||||||
|
MP3 mp3 = (MP3) o;
|
||||||
|
return Objects.equals(id, mp3.id) &&
|
||||||
|
Objects.equals(name, mp3.name) &&
|
||||||
|
Objects.equals(zz, mp3.zz) &&
|
||||||
|
Objects.equals(picurl, mp3.picurl);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, name, zz, picurl);
|
||||||
|
}
|
||||||
|
}
|
|
@ -100,15 +100,16 @@ public class MediaPlayer {
|
||||||
Media.setbf(isPlaying);
|
Media.setbf(isPlaying);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// build.setShuffleModeEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pause(){
|
public void pause() {
|
||||||
if (build.isPlaying()) {
|
if (build.isPlaying()) {
|
||||||
build.pause();
|
build.pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start(){
|
public void start() {
|
||||||
if (bfqkz.xm == null) {
|
if (bfqkz.xm == null) {
|
||||||
if (bfqkz.list != null && bfqkz.list.size() > 0) {
|
if (bfqkz.list != null && bfqkz.list.size() > 0) {
|
||||||
bfq_an.xyq();
|
bfq_an.xyq();
|
||||||
|
@ -118,17 +119,35 @@ public class MediaPlayer {
|
||||||
build.play();
|
build.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 创建 MediaItem 列表
|
||||||
|
// public static List<MediaItem> list = new ArrayList<>();
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
public void setDataSource(String path) {
|
public void setDataSource(String path) {
|
||||||
MediaItem mediaItem = MediaItem.fromUri(path);
|
DataSource(path);
|
||||||
main.handler.post(() -> {
|
main.handler.post(() -> {
|
||||||
build.setMediaItem(mediaItem);
|
|
||||||
build.prepare();
|
|
||||||
build.setPlayWhenReady(true);
|
build.setPlayWhenReady(true);
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
public void DataSource(String path) {
|
||||||
|
if (path == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MediaItem mediaItem = MediaItem.fromUri(path);
|
||||||
|
/* if (!list.contains(mediaItem)) {
|
||||||
|
list.add(mediaItem);
|
||||||
|
}*/
|
||||||
|
main.handler.post(() -> {
|
||||||
|
// build.setMediaItems(list);
|
||||||
|
// build.seekToDefaultPosition(getmti(bfqkz.ms));
|
||||||
|
build.setMediaItem(mediaItem);
|
||||||
|
build.prepare();
|
||||||
|
gj.sc(build.getMediaItemCount());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isPlaying() {
|
public boolean isPlaying() {
|
||||||
if (build == null) {
|
if (build == null) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -153,6 +172,7 @@ public class MediaPlayer {
|
||||||
bfqkz.notify.setBitmap();
|
bfqkz.notify.setBitmap();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onResourceReady(@NonNull Bitmap bitmap, @NonNull Object model, Target<Bitmap> target,
|
public boolean onResourceReady(@NonNull Bitmap bitmap, @NonNull Object model, Target<Bitmap> target,
|
||||||
@NonNull DataSource dataSource, boolean isFirstResource) {
|
@NonNull DataSource dataSource, boolean isFirstResource) {
|
||||||
|
@ -169,7 +189,7 @@ public class MediaPlayer {
|
||||||
Media.setzz(zz);
|
Media.setzz(zz);
|
||||||
bfq_an.islike();
|
bfq_an.islike();
|
||||||
}
|
}
|
||||||
bfq_db.setname(name+"/"+zz);
|
bfq_db.setname(name + "/" + zz);
|
||||||
if (com.muqingbfq.fragment.mp3.lbspq != null) {
|
if (com.muqingbfq.fragment.mp3.lbspq != null) {
|
||||||
com.muqingbfq.fragment.mp3.lbspq.notifyDataSetChanged();
|
com.muqingbfq.fragment.mp3.lbspq.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,30 @@
|
||||||
package com.muqingbfq;
|
package com.muqingbfq;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||||
|
import com.muqingbfq.databinding.ListKaifazheBinding;
|
||||||
import com.muqingbfq.mq.gj;
|
import com.muqingbfq.mq.gj;
|
||||||
import com.muqingbfq.mq.wj;
|
import com.muqingbfq.mq.wj;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class activity_about_software extends AppCompatActivity {
|
public class activity_about_software extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -25,7 +39,6 @@ public class activity_about_software extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
findViewById(R.id.button1).setOnClickListener(view -> {
|
findViewById(R.id.button1).setOnClickListener(view -> {
|
||||||
wj.sc(wj.filesdri + "gx.mq");
|
wj.sc(wj.filesdri + "gx.mq");
|
||||||
new Thread() {
|
new Thread() {
|
||||||
|
@ -43,13 +56,84 @@ public class activity_about_software extends AppCompatActivity {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MenuItem itemA;
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
itemA= menu.add("特别鸣谢");
|
||||||
|
itemA.setTitle("特别鸣谢");
|
||||||
|
return super.onCreateOptionsMenu(menu);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||||
int itemId = item.getItemId();
|
int itemId = item.getItemId();
|
||||||
if (itemId == android.R.id.home) {
|
if (itemId == android.R.id.home) {
|
||||||
finish();
|
finish();
|
||||||
|
} else if (item == itemA) {
|
||||||
|
new botton(this);
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class botton extends BottomSheetDialog {
|
||||||
|
|
||||||
|
List<Object[]> list = new ArrayList<>();
|
||||||
|
public botton(@NonNull Context context) {
|
||||||
|
super(context);
|
||||||
|
setTitle("特别鸣谢");
|
||||||
|
list.add(new Object[]{"http://139.196.224.229/muqing/picurl/mint.jpg","薄荷今天吃什么?", "维护开发者", "QQ"});
|
||||||
|
list.add(new Object[]{"http://139.196.224.229/muqing/picurl/weilian.jpg","威廉", "主要测试BUG", "QQ"});
|
||||||
|
show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
RecyclerView recyclerView = new RecyclerView(getContext());
|
||||||
|
recyclerView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
|
recyclerView.setPadding(50,100,50,500);
|
||||||
|
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
|
recyclerView.setAdapter(new RecyclerView.Adapter<VH>() {
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public VH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
ListKaifazheBinding binding = ListKaifazheBinding.inflate(getLayoutInflater());
|
||||||
|
return new VH(binding.getRoot());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull VH holder, int position) {
|
||||||
|
Object[] objects = list.get(position);
|
||||||
|
holder.name.setText(objects[1].toString());
|
||||||
|
holder.zz.setText(objects[2].toString());
|
||||||
|
Glide.with(getContext())
|
||||||
|
.load(objects[0])
|
||||||
|
.error(R.drawable.icon)
|
||||||
|
.into(holder.imageView);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return list.size();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setContentView(recyclerView);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class VH extends RecyclerView.ViewHolder {
|
||||||
|
public TextView name, zz;
|
||||||
|
public ImageView imageView;
|
||||||
|
public VH(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
name = itemView.findViewById(R.id.text1);
|
||||||
|
zz = itemView.findViewById(R.id.text2);
|
||||||
|
imageView = itemView.findViewById(R.id.imageView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -17,6 +17,7 @@ import com.mpatric.mp3agic.ID3v2;
|
||||||
import com.mpatric.mp3agic.InvalidDataException;
|
import com.mpatric.mp3agic.InvalidDataException;
|
||||||
import com.mpatric.mp3agic.Mp3File;
|
import com.mpatric.mp3agic.Mp3File;
|
||||||
import com.mpatric.mp3agic.UnsupportedTagException;
|
import com.mpatric.mp3agic.UnsupportedTagException;
|
||||||
|
import com.muqingbfq.MP3;
|
||||||
import com.muqingbfq.R;
|
import com.muqingbfq.R;
|
||||||
import com.muqingbfq.mq.gj;
|
import com.muqingbfq.mq.gj;
|
||||||
import com.muqingbfq.mq.wj;
|
import com.muqingbfq.mq.wj;
|
||||||
|
@ -36,7 +37,7 @@ public class FileDownloader {
|
||||||
private static final String CHANNEL_ID = "download_channel";
|
private static final String CHANNEL_ID = "download_channel";
|
||||||
private static final int NOTIFICATION_ID = 3;
|
private static final int NOTIFICATION_ID = 3;
|
||||||
|
|
||||||
public static void downloadFile(Context context, String url,com.muqingbfq.xm x) {
|
public static void downloadFile(Context context, String url, MP3 x) {
|
||||||
OkHttpClient client = new OkHttpClient();
|
OkHttpClient client = new OkHttpClient();
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url(url)
|
.url(url)
|
||||||
|
|
|
@ -2,33 +2,36 @@ package com.muqingbfq.api;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.mpatric.mp3agic.ID3v2;
|
import com.mpatric.mp3agic.ID3v2;
|
||||||
import com.mpatric.mp3agic.Mp3File;
|
import com.mpatric.mp3agic.Mp3File;
|
||||||
|
import com.muqingbfq.MP3;
|
||||||
import com.muqingbfq.fragment.gd;
|
import com.muqingbfq.fragment.gd;
|
||||||
import com.muqingbfq.fragment.mp3;
|
|
||||||
import com.muqingbfq.main;
|
|
||||||
import com.muqingbfq.mq.gj;
|
import com.muqingbfq.mq.gj;
|
||||||
import com.muqingbfq.mq.wj;
|
import com.muqingbfq.mq.wj;
|
||||||
import com.muqingbfq.mq.wl;
|
import com.muqingbfq.mq.wl;
|
||||||
import com.muqingbfq.xm;
|
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class playlist extends Thread {
|
public class playlist extends Thread {
|
||||||
public static final String api = "/playlist/track/all?id=";
|
public static final String api = "/playlist/track/all?id=";
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
public static boolean hq(List<xm> list, String uid) {
|
public static boolean hq(List<MP3> list, String uid) {
|
||||||
if (uid.equals("mp3_xz.json")) {
|
switch (uid) {
|
||||||
return playlist.hq_xz(list);
|
case "mp3_xz.json":
|
||||||
} else if (uid.equals("mp3_like.json")) {
|
return playlist.hq_xz(list);
|
||||||
return playlist.hq_like(list);
|
case "mp3_like.json":
|
||||||
} else if (uid.equals("mp3_hc.json")) {
|
return playlist.hq_like(list);
|
||||||
return hq_hc(list);
|
case "mp3_hc.json":
|
||||||
|
return hq_hc(list);
|
||||||
}
|
}
|
||||||
list.clear();
|
list.clear();
|
||||||
try {
|
try {
|
||||||
|
@ -56,7 +59,7 @@ public class playlist extends Thread {
|
||||||
}
|
}
|
||||||
zz.append("-").append(al.getString("name"));
|
zz.append("-").append(al.getString("name"));
|
||||||
String picUrl = al.getString("picUrl");
|
String picUrl = al.getString("picUrl");
|
||||||
list.add(new xm(id, name, zz.toString(), picUrl));
|
list.add(new MP3(id, name, zz.toString(), picUrl));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -65,21 +68,17 @@ public class playlist extends Thread {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hq_like(List<xm> list) {
|
public static boolean hq_like(List<MP3> list) {
|
||||||
list.clear();
|
list.clear();
|
||||||
try {
|
try {
|
||||||
JSONObject json = gd.like;
|
String dqwb = wj.dqwb(wj.gd + "mp3_like.json");
|
||||||
if (json == null || json.length() < 1) {
|
if (dqwb == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (Iterator<String> it = json.keys(); it.hasNext(); ) {
|
Type type = new TypeToken<List<MP3>>() {
|
||||||
String id = it.next();
|
}.getType();
|
||||||
JSONObject jsonObject = json.getJSONObject(id);
|
Gson gson = new Gson();
|
||||||
String name = jsonObject.getString("name");
|
list.addAll(gson.fromJson(dqwb, type));
|
||||||
String zz = jsonObject.getString("zz");
|
|
||||||
String picUrl = jsonObject.getString("picUrl");
|
|
||||||
list.add(new xm(id, name, zz, picUrl));
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gj.sc("失败的错误 " + e);
|
gj.sc("失败的错误 " + e);
|
||||||
|
@ -87,18 +86,18 @@ public class playlist extends Thread {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hq_xz(List<xm> list) {
|
public static boolean hq_xz(List<MP3> list) {
|
||||||
list.clear();
|
list.clear();
|
||||||
try {
|
try {
|
||||||
File file = new File(wj.filesdri + "mp3");
|
File file = new File(wj.filesdri + "mp3");
|
||||||
File[] files = file.listFiles();
|
File[] files = file.listFiles();
|
||||||
for (int i = 0; i < files.length; i++) {
|
for (File value : files) {
|
||||||
ID3v2 mp3File = new Mp3File(files[i]).getId3v2Tag();
|
ID3v2 mp3File = new Mp3File(value).getId3v2Tag();
|
||||||
String id = files[i].getName();
|
String id = value.getName();
|
||||||
String name = mp3File.getTitle();
|
String name = mp3File.getTitle();
|
||||||
String zz = mp3File.getArtist();
|
String zz = mp3File.getArtist();
|
||||||
String picUrl = mp3File.getUrl();
|
String picUrl = mp3File.getUrl();
|
||||||
list.add(new xm(id, name, zz, picUrl));
|
list.add(new MP3(id, name, zz, picUrl));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -107,19 +106,18 @@ public class playlist extends Thread {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public static boolean hq_hc(List<xm> list) {
|
|
||||||
|
public static boolean hq_hc(List<MP3> list) {
|
||||||
list.clear();
|
list.clear();
|
||||||
try {
|
try {
|
||||||
File file = new File(wj.filesdri + "hc");
|
String dqwb = wj.dqwb(wj.gd + "mp3_hc.json");
|
||||||
File[] files = file.listFiles();
|
if (dqwb == null) {
|
||||||
for (int i = 0; i < files.length; i++) {
|
return false;
|
||||||
ID3v2 mp3File = new Mp3File(files[i]).getId3v2Tag();
|
|
||||||
String id = files[i].getName();
|
|
||||||
String name = mp3File.getTitle();
|
|
||||||
String zz = mp3File.getArtist();
|
|
||||||
String picUrl = mp3File.getUrl();
|
|
||||||
list.add(new xm(id, name, zz, picUrl));
|
|
||||||
}
|
}
|
||||||
|
Type type = new TypeToken<List<MP3>>() {
|
||||||
|
}.getType();
|
||||||
|
Gson gson = new Gson();
|
||||||
|
list.addAll(gson.fromJson(dqwb, type));
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gj.sc("失败的错误 " + e);
|
gj.sc("失败的错误 " + e);
|
||||||
|
|
|
@ -18,13 +18,26 @@ import com.muqingbfq.xm;
|
||||||
public class resource {
|
public class resource {
|
||||||
|
|
||||||
public static void recommend(List<xm> list) {
|
public static void recommend(List<xm> list) {
|
||||||
String hq;
|
|
||||||
JSONObject json;
|
|
||||||
try {
|
try {
|
||||||
hq = wl.hq("/recommend/resource?cookie=" + wl.Cookie);
|
String hq = wj.dqwb(wj.gd_json);
|
||||||
if (TextUtils.isEmpty(hq) && wj.cz(wj.gd_json)) {
|
JSONObject json;
|
||||||
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
hq = wl.hq("/recommend/resource?cookie=" + wl.Cookie);
|
||||||
|
if (hq == null) {
|
||||||
|
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);
|
||||||
|
@ -75,9 +88,9 @@ public class resource {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void 下载(List<xm> list) {
|
public static void 下载(List<xm> list) {
|
||||||
list.add(new xm("mp3_like.json", "喜欢", R.mipmap.like, true));
|
list.add(new xm("mp3_hc.json", "最近播放", R.drawable.zt, true));
|
||||||
list.add(new xm("mp3_xz.json", "下载", R.drawable.icon, true));
|
list.add(new xm("mp3_like.json", "喜欢", R.drawable.like, true));
|
||||||
list.add(new xm("mp3_hc.json", "缓存", R.drawable.icon, true));
|
list.add(new xm("mp3_xz.json", "下载", R.drawable.download, true));
|
||||||
try {
|
try {
|
||||||
JSONObject date = new JSONObject(wj.dqwb(wj.gd_xz));
|
JSONObject date = new JSONObject(wj.dqwb(wj.gd_xz));
|
||||||
for (Iterator<String> it = date.keys(); it.hasNext(); ) {
|
for (Iterator<String> it = date.keys(); it.hasNext(); ) {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.muqingbfq.api;
|
||||||
|
|
||||||
import com.mpatric.mp3agic.ID3v2;
|
import com.mpatric.mp3agic.ID3v2;
|
||||||
import com.mpatric.mp3agic.Mp3File;
|
import com.mpatric.mp3agic.Mp3File;
|
||||||
|
import com.muqingbfq.MP3;
|
||||||
import com.muqingbfq.fragment.Media;
|
import com.muqingbfq.fragment.Media;
|
||||||
import com.muqingbfq.mq.gj;
|
import com.muqingbfq.mq.gj;
|
||||||
import com.muqingbfq.mq.wj;
|
import com.muqingbfq.mq.wj;
|
||||||
|
@ -25,14 +26,14 @@ import okhttp3.ResponseBody;
|
||||||
|
|
||||||
public class url extends Thread {
|
public class url extends Thread {
|
||||||
public static String api = "/song/url/v1";
|
public static String api = "/song/url/v1";
|
||||||
xm x;
|
MP3 x;
|
||||||
|
|
||||||
public url(xm x) {
|
public url(MP3 x) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String hq(xm x) {
|
public static String hq(MP3 x) {
|
||||||
if (Media.lrcview != null) {
|
if (Media.lrcview != null) {
|
||||||
gc(x.id);
|
gc(x.id);
|
||||||
}
|
}
|
||||||
|
@ -40,6 +41,9 @@ public class url extends Thread {
|
||||||
if (wj.cz(wj.filesdri + "hc/" + x.id)) {
|
if (wj.cz(wj.filesdri + "hc/" + x.id)) {
|
||||||
return wj.filesdri + "hc/" + x.id;
|
return wj.filesdri + "hc/" + x.id;
|
||||||
}
|
}
|
||||||
|
if (wj.cz(wj.mp3+x.id)) {
|
||||||
|
return wj.mp3 + x.id;
|
||||||
|
}
|
||||||
String level = "standard";
|
String level = "standard";
|
||||||
boolean wiFiConnected = gj.isWiFiConnected();
|
boolean wiFiConnected = gj.isWiFiConnected();
|
||||||
if (wiFiConnected) {
|
if (wiFiConnected) {
|
||||||
|
|
|
@ -20,6 +20,8 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.muqingbfq.api.FileDownloader;
|
import com.muqingbfq.api.FileDownloader;
|
||||||
import com.muqingbfq.api.url;
|
import com.muqingbfq.api.url;
|
||||||
import com.muqingbfq.databinding.ActivityBfqBinding;
|
import com.muqingbfq.databinding.ActivityBfqBinding;
|
||||||
|
@ -32,6 +34,10 @@ import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class bfq extends AppCompatActivity {
|
public class bfq extends AppCompatActivity {
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
public static AppCompatActivity context;
|
public static AppCompatActivity context;
|
||||||
|
@ -76,22 +82,26 @@ public class bfq extends AppCompatActivity {
|
||||||
text();
|
text();
|
||||||
inflate.like.setOnClickListener(view1 -> {
|
inflate.like.setOnClickListener(view1 -> {
|
||||||
try {
|
try {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
Type type = new TypeToken<List<MP3>>() {
|
||||||
|
}.getType();
|
||||||
|
List<MP3> list = gson.fromJson(wj.dqwb(wj.gd + "mp3_like.json"), type);
|
||||||
|
if (list == null) {
|
||||||
|
list = new ArrayList<>();
|
||||||
|
}
|
||||||
if (bfqkz.like_bool) {
|
if (bfqkz.like_bool) {
|
||||||
|
list.remove(bfqkz.xm);
|
||||||
inflate.like
|
inflate.like
|
||||||
.setImageTintList(ContextCompat.getColorStateList(bfq.this, R.color.text));
|
.setImageTintList(ContextCompat.getColorStateList(bfq.this, R.color.text));
|
||||||
com.muqingbfq.fragment.gd.like.remove(String.valueOf(bfqkz.xm.id));
|
|
||||||
} else {
|
} else {
|
||||||
inflate.like.setImageTintList(ContextCompat.
|
if (!list.contains(bfqkz.xm)) {
|
||||||
getColorStateList(bfq.this, android.R.color.holo_red_dark));
|
list.add(bfqkz.xm);
|
||||||
JSONObject json = new JSONObject();
|
inflate.like.setImageTintList(ContextCompat.
|
||||||
json.put("name", bfqkz.xm.name);
|
getColorStateList(bfq.this, android.R.color.holo_red_dark));
|
||||||
json.put("zz", bfqkz.xm.zz);
|
}
|
||||||
json.put("picUrl", bfqkz.xm.picurl);
|
|
||||||
com.muqingbfq.fragment.gd.like.put(String.valueOf(bfqkz.xm.id), json);
|
|
||||||
}
|
}
|
||||||
com.muqingbfq.mq.wj.xrwb(com.muqingbfq.mq.wj.mp3_like,
|
|
||||||
com.muqingbfq.fragment.gd.like.toString());
|
|
||||||
bfqkz.like_bool = !bfqkz.like_bool;
|
bfqkz.like_bool = !bfqkz.like_bool;
|
||||||
|
wj.xrwb(wj.gd + "mp3_like.json", gson.toJson(list));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -111,7 +121,7 @@ public class bfq extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
super.run();
|
super.run();
|
||||||
xm x = bfqkz.xm;
|
MP3 x = bfqkz.xm;
|
||||||
String hq = wl.hq(url.api + "?id=" + x.id + "&level=exhigh" + "&cookie=" + wl.Cookie);
|
String hq = wl.hq(url.api + "?id=" + x.id + "&level=exhigh" + "&cookie=" + wl.Cookie);
|
||||||
if (hq == null) {
|
if (hq == null) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -5,12 +5,18 @@ import android.content.Context;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.muqingbfq.api.url;
|
import com.muqingbfq.api.url;
|
||||||
import com.muqingbfq.fragment.Media;
|
import com.muqingbfq.fragment.Media;
|
||||||
import com.muqingbfq.fragment.gd;
|
import com.muqingbfq.fragment.gd;
|
||||||
|
import com.muqingbfq.mq.gj;
|
||||||
|
import com.muqingbfq.mq.wj;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class bfq_an {
|
public class bfq_an {
|
||||||
public static class kz implements View.OnClickListener {
|
public static class kz implements View.OnClickListener {
|
||||||
|
@ -49,6 +55,7 @@ public class bfq_an {
|
||||||
bfqkz.xm = bfqkz.list.get(bfqkz.getmti(ms));
|
bfqkz.xm = bfqkz.list.get(bfqkz.getmti(ms));
|
||||||
new url(bfqkz.xm);
|
new url(bfqkz.xm);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class control implements View.OnClickListener {
|
public static class control implements View.OnClickListener {
|
||||||
public control(ImageView imageView) {
|
public control(ImageView imageView) {
|
||||||
switch (bfqkz.ms) {
|
switch (bfqkz.ms) {
|
||||||
|
@ -92,17 +99,27 @@ public class bfq_an {
|
||||||
|
|
||||||
@SuppressLint("SimpleDateFormat")
|
@SuppressLint("SimpleDateFormat")
|
||||||
static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("mm:ss");
|
static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("mm:ss");
|
||||||
|
|
||||||
public static String getTime(long time) {
|
public static String getTime(long time) {
|
||||||
return simpleDateFormat.format(new Date(time));
|
return simpleDateFormat.format(new Date(time));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void islike() {
|
public static void islike() {
|
||||||
try {
|
boolean contains = false;
|
||||||
gd.like.getJSONObject(String.valueOf(bfqkz.xm.id));
|
String dqwb = wj.dqwb(wj.gd + "mp3_like.json");
|
||||||
bfqkz.like_bool = true;
|
if (dqwb != null) {
|
||||||
Media.setlike(true);
|
try {
|
||||||
} catch (Exception e) {
|
Type type = new TypeToken<List<MP3>>() {
|
||||||
bfqkz.like_bool = false;
|
}.getType();
|
||||||
Media.setlike(false);
|
List<MP3> o = new Gson().fromJson(dqwb, type);
|
||||||
|
if (o != null) {
|
||||||
|
contains = o.contains(bfqkz.xm);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
wj.sc(wj.gd + "mp3_like.json");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
bfqkz.like_bool = contains;
|
||||||
|
Media.setlike(contains);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,6 @@ package com.muqingbfq;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Service;
|
import android.app.Service;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.graphics.BitmapFactory;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -21,17 +19,19 @@ import androidx.media3.common.MediaItem;
|
||||||
import com.muqingbfq.api.url;
|
import com.muqingbfq.api.url;
|
||||||
import com.muqingbfq.mq.BluetoothMusicController;
|
import com.muqingbfq.mq.BluetoothMusicController;
|
||||||
import com.muqingbfq.mq.gj;
|
import com.muqingbfq.mq.gj;
|
||||||
|
import com.muqingbfq.mq.wj;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class bfqkz extends Service {
|
public class bfqkz extends Service {
|
||||||
public static com.muqingbfq.MediaPlayer mt;
|
public static MediaPlayer mt;
|
||||||
public static List<xm> list = new ArrayList<>();
|
public static List<MP3> list = new ArrayList<>();
|
||||||
|
public static List<MP3> lishi_list = new ArrayList<>();
|
||||||
public static int ms;
|
public static int ms;
|
||||||
// 0 循环 1 顺序 2 随机
|
// 0 循环 1 顺序 2 随机
|
||||||
public static xm xm;
|
public static MP3 xm;
|
||||||
public static boolean like_bool;
|
public static boolean like_bool;
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
public static com.muqingbfq.mq.NotificationManagerCompat notify;
|
public static com.muqingbfq.mq.NotificationManagerCompat notify;
|
||||||
|
@ -46,6 +46,7 @@ public class bfqkz extends Service {
|
||||||
} else if (s == 2) {
|
} else if (s == 2) {
|
||||||
i = new Random().nextInt(bfqkz.list.size());
|
i = new Random().nextInt(bfqkz.list.size());
|
||||||
}
|
}
|
||||||
|
mt.build.seekToDefaultPosition(i);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,58 +59,39 @@ public class bfqkz extends Service {
|
||||||
if (TextUtils.isEmpty(xm.picurl.toString())) {
|
if (TextUtils.isEmpty(xm.picurl.toString())) {
|
||||||
xm.picurl = url.picurl(xm.id);
|
xm.picurl = url.picurl(xm.id);
|
||||||
}
|
}
|
||||||
|
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));
|
||||||
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 void mp3(Uri id) {
|
||||||
try {
|
mp3(id.toString());
|
||||||
if (TextUtils.isEmpty(id.toString())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
gj.sc(xm.picurl);
|
|
||||||
if (TextUtils.isEmpty(xm.picurl.toString())) {
|
|
||||||
xm.picurl = url.picurl(xm.id);
|
|
||||||
}
|
|
||||||
MediaItem mediaItem = MediaItem.fromUri(id);
|
|
||||||
main.handler.post(() -> {
|
|
||||||
mt.build.setMediaItem(mediaItem);
|
|
||||||
mt.build.prepare();
|
|
||||||
mt.build.setPlayWhenReady(true);
|
|
||||||
mt.start();
|
|
||||||
});
|
|
||||||
} catch (Exception e) {
|
|
||||||
yc.start(home.appCompatActivity, "bfqkz mp3(" + id + ") :" + e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static MediaSessionCompat mSession;
|
public static MediaSessionCompat mSession;
|
||||||
public static MediaMetadataCompat build;
|
public static MediaMetadataCompat build;
|
||||||
public static PlaybackStateCompat playback;
|
public static PlaybackStateCompat playback;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
if (mt == null) {
|
com.muqingbfq.api.playlist.hq_hc(bfqkz.lishi_list);
|
||||||
mt = new com.muqingbfq.MediaPlayer();
|
new BluetoothMusicController(this);
|
||||||
new BluetoothMusicController(this);
|
|
||||||
}
|
|
||||||
mSession = new MediaSessionCompat(this, "MusicService");
|
mSession = new MediaSessionCompat(this, "MusicService");
|
||||||
playback=new PlaybackStateCompat.Builder()
|
playback = new PlaybackStateCompat.Builder()
|
||||||
.setState(PlaybackStateCompat.STATE_NONE,0,1.0f)
|
.setState(PlaybackStateCompat.STATE_NONE, 0, 1.0f)
|
||||||
.build();
|
.build();
|
||||||
mSession.setCallback(new callback());
|
mSession.setCallback(new callback());
|
||||||
mSession.setFlags(MediaSessionCompat.FLAG_HANDLES_TRANSPORT_CONTROLS);
|
mSession.setFlags(MediaSessionCompat.FLAG_HANDLES_TRANSPORT_CONTROLS);
|
||||||
mSession.setPlaybackState(playback);
|
mSession.setPlaybackState(playback);
|
||||||
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
|
|
||||||
|
|
||||||
build = new MediaMetadataCompat.Builder()
|
|
||||||
.putString(MediaMetadataCompat.METADATA_KEY_TITLE, "Song Title")
|
|
||||||
.putString(MediaMetadataCompat.METADATA_KEY_ARTIST, "Artist Name")
|
|
||||||
.putBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART, bitmap)
|
|
||||||
.putLong(MediaMetadataCompat.METADATA_KEY_DURATION, 1000) // 单位为毫秒
|
|
||||||
.build();
|
|
||||||
mSession.setMetadata(build);
|
mSession.setMetadata(build);
|
||||||
mSession.setActive(true);
|
mSession.setActive(true);
|
||||||
notify = new com.muqingbfq.mq.NotificationManagerCompat(this);
|
notify = new com.muqingbfq.mq.NotificationManagerCompat(this);
|
||||||
|
@ -125,10 +107,10 @@ public class bfqkz extends Service {
|
||||||
@Override
|
@Override
|
||||||
public void onPlay() {
|
public void onPlay() {
|
||||||
super.onPlay();
|
super.onPlay();
|
||||||
if(playback.getState() == PlaybackStateCompat.STATE_PAUSED){
|
if (playback.getState() == PlaybackStateCompat.STATE_PAUSED) {
|
||||||
mt.start();
|
mt.start();
|
||||||
playback = new PlaybackStateCompat.Builder()
|
playback = new PlaybackStateCompat.Builder()
|
||||||
.setState(PlaybackStateCompat.STATE_PLAYING,0,1.0f)
|
.setState(PlaybackStateCompat.STATE_PLAYING, 0, 1.0f)
|
||||||
.build();
|
.build();
|
||||||
mSession.setPlaybackState(playback);
|
mSession.setPlaybackState(playback);
|
||||||
}
|
}
|
||||||
|
@ -137,43 +119,46 @@ public class bfqkz extends Service {
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
if(playback.getState() == PlaybackStateCompat.STATE_PLAYING){
|
if (playback.getState() == PlaybackStateCompat.STATE_PLAYING) {
|
||||||
mt.pause();
|
mt.pause();
|
||||||
playback = new PlaybackStateCompat.Builder()
|
playback = new PlaybackStateCompat.Builder()
|
||||||
.setState(PlaybackStateCompat.STATE_PAUSED,0,1.0f)
|
.setState(PlaybackStateCompat.STATE_PAUSED, 0, 1.0f)
|
||||||
.build();
|
.build();
|
||||||
mSession.setPlaybackState(playback);
|
mSession.setPlaybackState(playback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayFromUri(Uri uri, Bundle extras) {
|
public void onPlayFromUri(Uri uri, Bundle extras) {
|
||||||
try {
|
try {
|
||||||
switch (playback.getState()){
|
switch (playback.getState()) {
|
||||||
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();
|
||||||
mSession.setPlaybackState(playback);
|
mSession.setPlaybackState(playback);
|
||||||
//我们可以保存当前播放音乐的信息,以便客户端刷新UI
|
//我们可以保存当前播放音乐的信息,以便客户端刷新UI
|
||||||
mSession.setMetadata(new MediaMetadataCompat.Builder()
|
mSession.setMetadata(new MediaMetadataCompat.Builder()
|
||||||
.putString(MediaMetadataCompat.METADATA_KEY_TITLE,extras.getString("title"))
|
.putString(MediaMetadataCompat.METADATA_KEY_TITLE, extras.getString("title"))
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public IBinder onBind(Intent intent) {
|
public IBinder onBind(Intent intent) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MyBinder extends Binder {
|
public class MyBinder extends Binder {
|
||||||
bfqkz getService() {
|
bfqkz getService() {
|
||||||
return bfqkz.this;
|
return bfqkz.this;
|
||||||
|
|
|
@ -87,17 +87,9 @@ public class Media extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||||
@Nullable Bundle savedInstanceState) {
|
@Nullable Bundle savedInstanceState) {
|
||||||
if (view != null) {
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
FragmentBfqBinding inflate = FragmentBfqBinding.inflate(inflater, container, false);
|
FragmentBfqBinding inflate = FragmentBfqBinding.inflate(inflater, container, false);
|
||||||
view = inflate.getRoot();
|
view = inflate.getRoot();
|
||||||
inflate.cardview.addView(home.imageView);
|
inflate.cardview.addView(home.imageView);
|
||||||
|
|
||||||
LinearLayout.LayoutParams layoutParams =
|
|
||||||
new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
|
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,2);
|
|
||||||
inflate.linearlayout.addView(lrcview,layoutParams);
|
|
||||||
tdt = inflate.tdt;
|
tdt = inflate.tdt;
|
||||||
tdt.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
tdt.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -135,6 +127,15 @@ public class Media extends Fragment {
|
||||||
kp.setVisibility(View.VISIBLE);
|
kp.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
LinearLayout.LayoutParams layoutParams =
|
||||||
|
new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT,2);
|
||||||
|
inflate.linearlayout.addView(lrcview,layoutParams);
|
||||||
|
}else{
|
||||||
|
LinearLayout.LayoutParams layoutParams =
|
||||||
|
new LinearLayout.LayoutParams(0,
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT,1);
|
||||||
|
inflate.linearlayout.addView(lrcview,layoutParams);
|
||||||
}
|
}
|
||||||
//初始化播放器列表
|
//初始化播放器列表
|
||||||
if (bfqkz.xm != null) {
|
if (bfqkz.xm != null) {
|
||||||
|
@ -145,14 +146,6 @@ public class Media extends Fragment {
|
||||||
long position = bfqkz.mt.build.getCurrentPosition();
|
long position = bfqkz.mt.build.getCurrentPosition();
|
||||||
setProgress((int) position);
|
setProgress((int) position);
|
||||||
main.handler.post(bfqkz.mt.updateSeekBar); // 在播放开始时启动更新进度
|
main.handler.post(bfqkz.mt.updateSeekBar); // 在播放开始时启动更新进度
|
||||||
|
|
||||||
new Thread() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
super.run();
|
|
||||||
url.gc(bfqkz.xm.id);
|
|
||||||
}
|
|
||||||
}.start();
|
|
||||||
}
|
}
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,16 +11,19 @@ import androidx.core.content.ContextCompat;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||||
|
import com.muqingbfq.MP3;
|
||||||
import com.muqingbfq.R;
|
import com.muqingbfq.R;
|
||||||
import com.muqingbfq.api.url;
|
import com.muqingbfq.api.url;
|
||||||
import com.muqingbfq.bfqkz;
|
import com.muqingbfq.bfqkz;
|
||||||
import com.muqingbfq.list.MyViewHoder;
|
import com.muqingbfq.list.MyViewHoder;
|
||||||
import com.muqingbfq.main;
|
import com.muqingbfq.main;
|
||||||
|
import com.muqingbfq.mq.gj;
|
||||||
import com.muqingbfq.xm;
|
import com.muqingbfq.xm;
|
||||||
import com.muqingbfq.yc;
|
import com.muqingbfq.yc;
|
||||||
|
|
||||||
public class bflb_db extends BottomSheetDialog {
|
public class bflb_db extends BottomSheetDialog {
|
||||||
public static RecyclerView.Adapter<MyViewHoder> adapter;
|
public static RecyclerView.Adapter<MyViewHoder> adapter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -32,12 +35,12 @@ public class bflb_db extends BottomSheetDialog {
|
||||||
RecyclerView lb = findViewById(R.id.lb);
|
RecyclerView lb = findViewById(R.id.lb);
|
||||||
lb.setAdapter(new spq());
|
lb.setAdapter(new spq());
|
||||||
if (bfqkz.xm != null) {
|
if (bfqkz.xm != null) {
|
||||||
lb.smoothScrollToPosition(bfqkz.list.indexOf(bfqkz.xm));
|
lb.smoothScrollToPosition(getI());
|
||||||
}
|
}
|
||||||
findViewById(R.id.xxbj).
|
findViewById(R.id.xxbj).
|
||||||
setOnClickListener(v -> {
|
setOnClickListener(v -> {
|
||||||
if (bfqkz.xm != null) {
|
if (bfqkz.xm != null) {
|
||||||
lb.smoothScrollToPosition(bfqkz.list.indexOf(bfqkz.xm));
|
lb.smoothScrollToPosition(getI());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -45,6 +48,13 @@ public class bflb_db extends BottomSheetDialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getI() {
|
||||||
|
int i = bfqkz.list.indexOf(bfqkz.xm);
|
||||||
|
if (i == -1) {
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
public bflb_db(Context context) {
|
public bflb_db(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
|
@ -57,6 +67,7 @@ public class bflb_db extends BottomSheetDialog {
|
||||||
public spq() {
|
public spq() {
|
||||||
adapter = this;
|
adapter = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public MyViewHoder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public MyViewHoder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
@ -66,7 +77,7 @@ public class bflb_db extends BottomSheetDialog {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull MyViewHoder holder, int position) {
|
public void onBindViewHolder(@NonNull MyViewHoder holder, int position) {
|
||||||
xm x = bfqkz.list.get(position);
|
MP3 x = bfqkz.list.get(position);
|
||||||
holder.name.setText(x.name);
|
holder.name.setText(x.name);
|
||||||
holder.zz.setText(x.zz);
|
holder.zz.setText(x.zz);
|
||||||
int color = ContextCompat.getColor(holder.getContext(), R.color.text);
|
int color = ContextCompat.getColor(holder.getContext(), R.color.text);
|
||||||
|
|
|
@ -12,8 +12,12 @@ import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
import com.muqingbfq.MP3;
|
||||||
|
import com.muqingbfq.MediaPlayer;
|
||||||
import com.muqingbfq.R;
|
import com.muqingbfq.R;
|
||||||
|
import com.muqingbfq.api.url;
|
||||||
import com.muqingbfq.bfq;
|
import com.muqingbfq.bfq;
|
||||||
import com.muqingbfq.bfq_an;
|
import com.muqingbfq.bfq_an;
|
||||||
import com.muqingbfq.bfqkz;
|
import com.muqingbfq.bfqkz;
|
||||||
|
@ -35,11 +39,24 @@ public class bfq_db extends Fragment {
|
||||||
String jsonList = this.getContext().getSharedPreferences("list", Context.MODE_PRIVATE)
|
String jsonList = this.getContext().getSharedPreferences("list", Context.MODE_PRIVATE)
|
||||||
.getString("listData", null); // 获取保存的 JSON 字符串
|
.getString("listData", null); // 获取保存的 JSON 字符串
|
||||||
if (jsonList != null) {
|
if (jsonList != null) {
|
||||||
Type type = new TypeToken<List<xm>>() {
|
Type type = new TypeToken<List<MP3>>() {
|
||||||
}.getType();
|
}.getType();
|
||||||
bfqkz.list = new com.google.gson.Gson().fromJson(jsonList, type);
|
bfqkz.list = new com.google.gson.Gson().fromJson(jsonList, type);
|
||||||
// 将 JSON 字符串转换回列表数据
|
// 将 JSON 字符串转换回列表数据
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bfqkz.xm = wj.getMP3FromFile();
|
||||||
|
bfqkz.mt = new MediaPlayer();
|
||||||
|
if (bfqkz.xm != null) {
|
||||||
|
new Thread(){
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
super.run();
|
||||||
|
String hq = url.hq(bfqkz.xm);
|
||||||
|
bfqkz.mt.DataSource(hq);
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
view = inflater.inflate(R.layout.fragment_bfq_db, container, false);
|
view = inflater.inflate(R.layout.fragment_bfq_db, container, false);
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,8 @@ package com.muqingbfq.fragment;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.TypedValue;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -22,27 +20,21 @@ import androidx.viewpager2.widget.ViewPager2;
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.bumptech.glide.request.RequestOptions;
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
import com.google.android.material.card.MaterialCardView;
|
import com.google.android.material.card.MaterialCardView;
|
||||||
|
import com.muqingbfq.MP3;
|
||||||
import com.muqingbfq.R;
|
import com.muqingbfq.R;
|
||||||
import com.muqingbfq.api.playlist;
|
import com.muqingbfq.api.playlist;
|
||||||
import com.muqingbfq.api.resource;
|
|
||||||
import com.muqingbfq.bfq_an;
|
import com.muqingbfq.bfq_an;
|
||||||
import com.muqingbfq.bfqkz;
|
import com.muqingbfq.bfqkz;
|
||||||
import com.muqingbfq.databinding.FragmentGdBinding;
|
import com.muqingbfq.databinding.FragmentGdBinding;
|
||||||
import com.muqingbfq.list.list_gd;
|
import com.muqingbfq.list.list_gd;
|
||||||
import com.muqingbfq.main;
|
import com.muqingbfq.main;
|
||||||
import com.muqingbfq.mq.gj;
|
|
||||||
import com.muqingbfq.mq.wj;
|
|
||||||
import com.muqingbfq.xm;
|
import com.muqingbfq.xm;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import java.util.ArrayList;
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class gd extends Fragment {
|
public class gd extends Fragment {
|
||||||
public static String gdid;
|
public static String gdid;
|
||||||
public static JSONObject like = new JSONObject();
|
|
||||||
FragmentGdBinding binding;
|
FragmentGdBinding binding;
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
|
@ -105,13 +97,6 @@ public class gd extends Fragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
try {
|
|
||||||
if (wj.cz(wj.mp3_like)) {
|
|
||||||
like = new JSONObject(wj.dqwb(wj.mp3_like));
|
|
||||||
}
|
|
||||||
} catch (JSONException e) {
|
|
||||||
gj.sc(e);
|
|
||||||
}
|
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
}
|
}
|
||||||
public static class baseadapter extends RecyclerView.Adapter<VH> {
|
public static class baseadapter extends RecyclerView.Adapter<VH> {
|
||||||
|
|
|
@ -14,6 +14,7 @@ import androidx.core.content.ContextCompat;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.muqingbfq.MP3;
|
||||||
import com.muqingbfq.R;
|
import com.muqingbfq.R;
|
||||||
import com.muqingbfq.api.playlist;
|
import com.muqingbfq.api.playlist;
|
||||||
import com.muqingbfq.api.url;
|
import com.muqingbfq.api.url;
|
||||||
|
@ -29,7 +30,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class mp3 extends FragmentActivity {
|
public class mp3 extends FragmentActivity {
|
||||||
private final List<xm> list = new ArrayList<>();
|
private final List<MP3> list = new ArrayList<>();
|
||||||
public static RecyclerView.Adapter<MyViewHoder> lbspq;
|
public static RecyclerView.Adapter<MyViewHoder> lbspq;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -94,7 +95,7 @@ public class mp3 extends FragmentActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull MyViewHoder holder, int position) {
|
public void onBindViewHolder(@NonNull MyViewHoder holder, int position) {
|
||||||
xm x = list.get(position);
|
MP3 x = list.get(position);
|
||||||
holder.name.setText(x.name);
|
holder.name.setText(x.name);
|
||||||
holder.zz.setText(x.zz);
|
holder.zz.setText(x.zz);
|
||||||
int color = ContextCompat.getColor(holder.getContext(), R.color.text);
|
int color = ContextCompat.getColor(holder.getContext(), R.color.text);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
import com.muqingbfq.MP3;
|
||||||
import com.muqingbfq.R;
|
import com.muqingbfq.R;
|
||||||
import com.muqingbfq.api.url;
|
import com.muqingbfq.api.url;
|
||||||
import com.muqingbfq.bfq;
|
import com.muqingbfq.bfq;
|
||||||
|
@ -36,7 +37,8 @@ import java.util.List;
|
||||||
|
|
||||||
public class search extends Fragment {
|
public class search extends Fragment {
|
||||||
public static RecyclerView.Adapter<MyViewHoder> lbspq;
|
public static RecyclerView.Adapter<MyViewHoder> lbspq;
|
||||||
List<xm> list = new ArrayList<>();
|
List<MP3> list = new ArrayList<>();
|
||||||
|
List<xm> xmList = new ArrayList<>();
|
||||||
gd.baseadapter adapter_gd;
|
gd.baseadapter adapter_gd;
|
||||||
public String name;
|
public String name;
|
||||||
|
|
||||||
|
@ -53,7 +55,7 @@ public class search extends Fragment {
|
||||||
TypedValue typedValue = new TypedValue();
|
TypedValue typedValue = new TypedValue();
|
||||||
requireContext().getTheme().resolveAttribute(android.R.attr.windowBackground, typedValue, true);
|
requireContext().getTheme().resolveAttribute(android.R.attr.windowBackground, typedValue, true);
|
||||||
// 设置背景颜色
|
// 设置背景颜色
|
||||||
adapter_gd = new gd.baseadapter(getContext(), list);
|
adapter_gd = new gd.baseadapter(getContext(), xmList);
|
||||||
view.setBackgroundColor(typedValue.data);
|
view.setBackgroundColor(typedValue.data);
|
||||||
inflate.tablayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
inflate.tablayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -107,6 +109,7 @@ public class search extends Fragment {
|
||||||
public class start extends Thread {
|
public class start extends Thread {
|
||||||
public start(String name) {
|
public start(String name) {
|
||||||
list.clear();
|
list.clear();
|
||||||
|
xmList.clear();
|
||||||
search.this.name = name;
|
search.this.name = name;
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
@ -153,7 +156,7 @@ public class search extends Fragment {
|
||||||
zz.append("/").append(name_zz);
|
zz.append("/").append(name_zz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
list.add(new xm(id, name, zz.toString(), ""));
|
list.add(new MP3(id, name, zz.toString(), ""));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gj.sc(e);
|
gj.sc(e);
|
||||||
|
@ -172,7 +175,8 @@ public class search extends Fragment {
|
||||||
String name = jsonObject.getString("name");
|
String name = jsonObject.getString("name");
|
||||||
String coverImgUrl = jsonObject.getString("coverImgUrl");
|
String coverImgUrl = jsonObject.getString("coverImgUrl");
|
||||||
// gj.sc(name);
|
// gj.sc(name);
|
||||||
list.add(new xm(id, name, coverImgUrl, wj.cz(wj.gd + id)));
|
xmList.add(new xm(id, name, coverImgUrl, false));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -195,7 +199,7 @@ public class search extends Fragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull MyViewHoder holder, int position) {
|
public void onBindViewHolder(@NonNull MyViewHoder holder, int position) {
|
||||||
xm x = list.get(position);
|
MP3 x = list.get(position);
|
||||||
holder.name.setText(x.name);
|
holder.name.setText(x.name);
|
||||||
holder.zz.setText(x.zz);
|
holder.zz.setText(x.zz);
|
||||||
int color = ContextCompat.getColor(holder.getContext(), R.color.text);
|
int color = ContextCompat.getColor(holder.getContext(), R.color.text);
|
||||||
|
|
|
@ -21,6 +21,10 @@ import com.muqingbfq.fragment.Media;
|
||||||
import com.muqingbfq.fragment.bfq_db;
|
import com.muqingbfq.fragment.bfq_db;
|
||||||
import com.muqingbfq.fragment.gd;
|
import com.muqingbfq.fragment.gd;
|
||||||
import com.muqingbfq.mq.gj;
|
import com.muqingbfq.mq.gj;
|
||||||
|
import com.muqingbfq.mq.wj;
|
||||||
|
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.ObjectOutputStream;
|
||||||
|
|
||||||
import me.wcy.lrcview.LrcView;
|
import me.wcy.lrcview.LrcView;
|
||||||
|
|
||||||
|
@ -104,6 +108,7 @@ public class home extends AppCompatActivity {
|
||||||
String jsonList = new com.google.gson.Gson().toJson(bfqkz.list);
|
String jsonList = new com.google.gson.Gson().toJson(bfqkz.list);
|
||||||
editor.putString("listData", jsonList);
|
editor.putString("listData", jsonList);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
|
wj.setMP3ToFile(bfqkz.xm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,6 @@ public class NotificationManagerCompat {
|
||||||
.setOngoing(bfqkz.mt.isPlaying());
|
.setOngoing(bfqkz.mt.isPlaying());
|
||||||
notificationManager_notify();
|
notificationManager_notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
private PendingIntent pendingIntent_kg,
|
private PendingIntent pendingIntent_kg,
|
||||||
pendingIntent_syq,
|
pendingIntent_syq,
|
||||||
pendingIntent_xyq;
|
pendingIntent_xyq;
|
||||||
|
|
|
@ -2,15 +2,20 @@ package com.muqingbfq.mq;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.muqingbfq.MP3;
|
||||||
import com.muqingbfq.yc;
|
import com.muqingbfq.yc;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.ObjectInputStream;
|
||||||
|
import java.io.ObjectOutputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
@ -156,4 +161,31 @@ public class wj {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 保存MP3对象到文件
|
||||||
|
public static void setMP3ToFile(MP3 mp3) {
|
||||||
|
if (mp3 == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Gson gson = new Gson();
|
||||||
|
String json = gson.toJson(mp3);
|
||||||
|
xrwb(filesdri + "mp3.dat", json);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从文件中加载MP3对象
|
||||||
|
public static MP3 getMP3FromFile() {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
MP3 mp3 = null;
|
||||||
|
try {
|
||||||
|
File file = new File(filesdri + "mp3.dat");
|
||||||
|
if (file.exists() && file.length() > 0) {
|
||||||
|
FileReader reader = new FileReader(file);
|
||||||
|
mp3 = gson.fromJson(reader, MP3.class);
|
||||||
|
reader.close();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return mp3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,15 +13,15 @@ import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
import com.muqingbfq.databinding.ActivityYcBinding;
|
||||||
|
|
||||||
public class yc extends AppCompatActivity {
|
public class yc extends AppCompatActivity {
|
||||||
public static Object exception;
|
public static Object exception;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_yc);
|
ActivityYcBinding binding = ActivityYcBinding.inflate(getLayoutInflater());
|
||||||
TextView text = findViewById(R.id.text);
|
setContentView(binding.getRoot());
|
||||||
|
|
||||||
String deviceModel = Build.MODEL;
|
String deviceModel = Build.MODEL;
|
||||||
String deviceManufacturer = Build.MANUFACTURER;
|
String deviceManufacturer = Build.MANUFACTURER;
|
||||||
|
@ -44,7 +44,7 @@ public class yc extends AppCompatActivity {
|
||||||
+ "屏幕密度:" + density + "\n"
|
+ "屏幕密度:" + density + "\n"
|
||||||
+ "密度DPI:" + densityDpi + "\n" +
|
+ "密度DPI:" + densityDpi + "\n" +
|
||||||
"异常信息: " + exception.toString();
|
"异常信息: " + exception.toString();
|
||||||
text.setText(wb);
|
binding.text.setText(wb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void start(Object e) {
|
public static void start(Object e) {
|
||||||
|
|
|
@ -5,5 +5,5 @@
|
||||||
android:viewportHeight="1024">
|
android:viewportHeight="1024">
|
||||||
<path
|
<path
|
||||||
android:pathData="M490.7,644.3L490.7,469.3h85.3v174.9l46.9,-46.9 59.7,59.7 -68.3,68.3h132.3c59.7,-8.5 106.7,-64 106.7,-128 0,-72.5 -55.5,-128 -128,-128 -17.1,0 -29.9,4.3 -42.7,8.5L682.7,469.3c0,-93.9 -76.8,-170.7 -170.7,-170.7s-170.7,76.8 -170.7,170.7c0,17.1 4.3,29.9 4.3,46.9 -8.5,-4.3 -17.1,-4.3 -25.6,-4.3C260.3,512 213.3,558.9 213.3,618.7S260.3,725.3 320,725.3h132.3L384,657.1l59.7,-59.7 46.9,46.9zM614.4,725.3l-81.1,81.1 -81.1,-81.1L405.3,725.3v85.3h-85.3C213.3,810.7 128,725.3 128,618.7c0,-85.3 55.5,-157.9 128,-183.5C273.1,311.5 379.7,213.3 512,213.3c110.9,0 209.1,72.5 243.2,170.7 102.4,12.8 183.5,102.4 183.5,213.3s-85.3,200.5 -192,213.3h-85.3v-85.3h-46.9z"
|
android:pathData="M490.7,644.3L490.7,469.3h85.3v174.9l46.9,-46.9 59.7,59.7 -68.3,68.3h132.3c59.7,-8.5 106.7,-64 106.7,-128 0,-72.5 -55.5,-128 -128,-128 -17.1,0 -29.9,4.3 -42.7,8.5L682.7,469.3c0,-93.9 -76.8,-170.7 -170.7,-170.7s-170.7,76.8 -170.7,170.7c0,17.1 4.3,29.9 4.3,46.9 -8.5,-4.3 -17.1,-4.3 -25.6,-4.3C260.3,512 213.3,558.9 213.3,618.7S260.3,725.3 320,725.3h132.3L384,657.1l59.7,-59.7 46.9,46.9zM614.4,725.3l-81.1,81.1 -81.1,-81.1L405.3,725.3v85.3h-85.3C213.3,810.7 128,725.3 128,618.7c0,-85.3 55.5,-157.9 128,-183.5C273.1,311.5 379.7,213.3 512,213.3c110.9,0 209.1,72.5 243.2,170.7 102.4,12.8 183.5,102.4 183.5,213.3s-85.3,200.5 -192,213.3h-85.3v-85.3h-46.9z"
|
||||||
android:fillColor="#444444"/>
|
android:fillColor="@color/text"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
|
9
app/src/main/res/drawable/like.xml
Normal file
9
app/src/main/res/drawable/like.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="200dp"
|
||||||
|
android:height="200dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:pathData="M667.8,117.3C832.9,117.3 938.7,249.7 938.7,427.9c0,138.3 -125.1,290.5 -371.6,461.6a96.8,96.8 0,0 1,-110.2 0C210.4,718.4 85.3,566.1 85.3,427.9 85.3,249.7 191.1,117.3 356.2,117.3c59.6,0 100.1,20.8 155.8,68.1C567.7,138.2 608.2,117.3 667.8,117.3z"
|
||||||
|
android:fillColor="@color/text"/>
|
||||||
|
</vector>
|
|
@ -132,10 +132,10 @@
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/like"
|
android:id="@+id/like"
|
||||||
android:layout_width="36dp"
|
android:layout_width="36dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="36dp"
|
||||||
android:layout_marginEnd="26dp"
|
android:layout_marginEnd="26dp"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||||
android:src="@mipmap/like"
|
android:src="@drawable/like"
|
||||||
app:tint="@color/text"
|
app:tint="@color/text"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/linearlayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
歌曲搜索和在线播放:用户可以通过关键词搜索自己喜欢的歌曲,也可以在线播放音乐,无需下载。\n
|
歌曲搜索和在线播放:用户可以通过关键词搜索自己喜欢的歌曲,也可以在线播放音乐,无需下载。\n
|
||||||
歌曲收藏和创建歌单:用户可以将喜欢的歌曲收藏起来,创建自己的歌单,方便随时收听。\n
|
歌曲收藏和创建歌单:用户可以将喜欢的歌曲收藏起来,创建自己的歌单,方便随时收听。\n
|
||||||
超清音质:云音乐支持高品质的音乐播放,让用户感受更加真实、清晰的音乐体验。\n
|
超清音质:云音乐支持高品质的音乐播放,让用户感受更加真实、清晰的音乐体验。\n
|
||||||
歌词显示和歌曲分享:云音乐还提供歌词显示功能,让用户可以跟随歌词唱歌。同时,用户也可以将自己喜欢的歌曲分享给朋友。\n
|
歌词显示和歌曲分享:云音乐提供歌词显示功能的同时用户也可以将自己喜欢的歌曲分享给朋友。\n
|
||||||
无论你是需要放松身心、工作休闲,或者在旅途中享受音乐,云音乐都能满足你的需求。欢迎下载使用云音乐,让音乐成为你生活的一部分。\n
|
无论你是需要放松身心、工作休闲,或者在旅途中享受音乐,云音乐都能满足你的需求。欢迎下载使用云音乐,让音乐成为你生活的一部分。\n
|
||||||
\n
|
\n
|
||||||
请注意,以上只是一个软件介绍的示例,软件具体开发工程还没有完善,具体的介绍内容可以根据实际情况进行体验软件。\n"
|
请注意,以上只是一个软件介绍的示例,软件具体开发工程还没有完善,具体的介绍内容可以根据实际情况进行体验软件。\n"
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
android:layout_width="36dp"
|
android:layout_width="36dp"
|
||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||||
android:src="@mipmap/like"
|
android:src="@drawable/like"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:tint="@color/text"
|
app:tint="@color/text"
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:minHeight="?attr/actionBarSize"/>
|
android:minHeight="?attr/actionBarSize"/>
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
|
||||||
<androidx.fragment.app.FragmentContainerView
|
<androidx.fragment.app.FragmentContainerView
|
||||||
android:id="@+id/gd"
|
android:id="@+id/gd"
|
||||||
android:name="com.muqingbfq.fragment.gd"
|
android:name="com.muqingbfq.fragment.gd"
|
||||||
|
|
42
app/src/main/res/layout/list_kaifazhe.xml
Normal file
42
app/src/main/res/layout/list_kaifazhe.xml
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingBottom="16dp">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<com.google.android.material.card.MaterialCardView
|
||||||
|
android:id="@+id/cardview"
|
||||||
|
app:cardUseCompatPadding="true"
|
||||||
|
android:layout_width="56dp"
|
||||||
|
android:layout_height="56dp">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:src="@drawable/icon" />
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<com.muqingbfq.view.Text
|
||||||
|
android:id="@+id/text1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/app_name" />
|
||||||
|
|
||||||
|
<com.muqingbfq.view.Text
|
||||||
|
android:id="@+id/text2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/app_name" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
Binary file not shown.
Before Width: | Height: | Size: 601 B |
|
@ -12,7 +12,7 @@
|
||||||
<item name="windowNoTitle">true</item>
|
<item name="windowNoTitle">true</item>
|
||||||
<item name="android:statusBarColor">@color/bj</item>
|
<item name="android:statusBarColor">@color/bj</item>
|
||||||
<!-- 控件选中时的颜色,默认使用colorAccent -->
|
<!-- 控件选中时的颜色,默认使用colorAccent -->
|
||||||
<!-- <item name="android:colorControlActivated">#FF7F50</item>-->
|
<!-- <item name="android:colorControlActivated">#FF7F50</item>-->
|
||||||
<!-- 设置文本颜色 -->
|
<!-- 设置文本颜色 -->
|
||||||
<item name="android:textColorPrimary">@color/text</item>
|
<item name="android:textColorPrimary">@color/text</item>
|
||||||
<item name="android:colorPrimary">#00BCD4</item>
|
<item name="android:colorPrimary">#00BCD4</item>
|
||||||
|
@ -23,23 +23,26 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Widget.App.Toolbar" parent="Widget.Material3.Toolbar">
|
<style name="Widget.App.Toolbar" parent="Widget.Material3.Toolbar">
|
||||||
|
<item name="android:background">@drawable/background</item>
|
||||||
<item name="materialThemeOverlay">@style/ThemeOverlay.App.Toolbar</item>
|
<item name="materialThemeOverlay">@style/ThemeOverlay.App.Toolbar</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="ThemeOverlay.App.Toolbar" parent="">
|
<style name="ThemeOverlay.App.Toolbar" parent="">
|
||||||
<item name="android:background">@color/bj</item>
|
<item name="colorSurface">@color/bj</item>
|
||||||
|
<item name="colorOnSurface">@color/bj</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Widget.App.TabLayout" parent="Widget.Material3.TabLayout">
|
<style name="Widget.App.TabLayout" parent="Widget.Material3.TabLayout">
|
||||||
<item name="materialThemeOverlay">@style/ThemeOverlay.App.TabLayout</item>
|
<item name="materialThemeOverlay">@style/ThemeOverlay.App.TabLayout</item>
|
||||||
<!-- <item name="tabTextAppearance">@style/TextAppearance.App.LabelLarge</item>-->
|
<!-- <item name="tabTextAppearance">@style/TextAppearance.App.LabelLarge</item>-->
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="ThemeOverlay.App.TabLayout" parent="">
|
<style name="ThemeOverlay.App.TabLayout" parent="">
|
||||||
<item name="colorPrimary">#00BCD4</item>
|
<item name="colorPrimary">#00BCD4</item>
|
||||||
<item name="colorOnSurface">#ADD8E6</item>
|
<item name="colorOnSurface">#ADD8E6</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<style name="fragment_dialog" parent="Theme.muqing">
|
<style name="fragment_dialog" parent="Theme.muqing">
|
||||||
<item name="android:windowIsTranslucent">true</item>
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
<item name="android:windowBackground">@android:color/transparent</item>
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
|
@ -57,7 +60,7 @@
|
||||||
<item name="android:windowBackground">@drawable/start</item>
|
<item name="android:windowBackground">@drawable/start</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- 按钮主题-->
|
<!-- 按钮主题-->
|
||||||
<style name="Button">
|
<style name="Button">
|
||||||
<item name="android:backgroundTint">#1C71A9</item>
|
<item name="android:backgroundTint">#1C71A9</item>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user