更改喜欢音乐逻辑和储存
This commit is contained in:
parent
08c50983aa
commit
48f469eab7
|
@ -1,4 +1,3 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<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
|
||||
targetSdk 31
|
||||
versionCode 1
|
||||
versionName "1.7.5"
|
||||
versionName "1.7.6"
|
||||
|
||||
}
|
||||
compileOptions {
|
||||
|
|
|
@ -76,5 +76,4 @@
|
|||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
|
||||
</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,6 +100,7 @@ public class MediaPlayer {
|
|||
Media.setbf(isPlaying);
|
||||
}
|
||||
});
|
||||
// build.setShuffleModeEnabled(true);
|
||||
}
|
||||
|
||||
public void pause() {
|
||||
|
@ -118,17 +119,35 @@ public class MediaPlayer {
|
|||
build.play();
|
||||
}
|
||||
|
||||
// 创建 MediaItem 列表
|
||||
// public static List<MediaItem> list = new ArrayList<>();
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
public void setDataSource(String path) {
|
||||
MediaItem mediaItem = MediaItem.fromUri(path);
|
||||
DataSource(path);
|
||||
main.handler.post(() -> {
|
||||
build.setMediaItem(mediaItem);
|
||||
build.prepare();
|
||||
build.setPlayWhenReady(true);
|
||||
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() {
|
||||
if (build == null) {
|
||||
return false;
|
||||
|
@ -153,6 +172,7 @@ public class MediaPlayer {
|
|||
bfqkz.notify.setBitmap();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onResourceReady(@NonNull Bitmap bitmap, @NonNull Object model, Target<Bitmap> target,
|
||||
@NonNull DataSource dataSource, boolean isFirstResource) {
|
||||
|
|
|
@ -1,16 +1,30 @@
|
|||
package com.muqingbfq;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
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.appcompat.app.AppCompatActivity;
|
||||
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.wj;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class activity_about_software extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -25,7 +39,6 @@ public class activity_about_software extends AppCompatActivity {
|
|||
}
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
findViewById(R.id.button1).setOnClickListener(view -> {
|
||||
wj.sc(wj.filesdri + "gx.mq");
|
||||
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
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == android.R.id.home) {
|
||||
finish();
|
||||
} else if (item == itemA) {
|
||||
new botton(this);
|
||||
}
|
||||
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.Mp3File;
|
||||
import com.mpatric.mp3agic.UnsupportedTagException;
|
||||
import com.muqingbfq.MP3;
|
||||
import com.muqingbfq.R;
|
||||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.mq.wj;
|
||||
|
@ -36,7 +37,7 @@ public class FileDownloader {
|
|||
private static final String CHANNEL_ID = "download_channel";
|
||||
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();
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
|
|
|
@ -2,32 +2,35 @@ package com.muqingbfq.api;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.mpatric.mp3agic.ID3v2;
|
||||
import com.mpatric.mp3agic.Mp3File;
|
||||
import com.muqingbfq.MP3;
|
||||
import com.muqingbfq.fragment.gd;
|
||||
import com.muqingbfq.fragment.mp3;
|
||||
import com.muqingbfq.main;
|
||||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.mq.wj;
|
||||
import com.muqingbfq.mq.wl;
|
||||
import com.muqingbfq.xm;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class playlist extends Thread {
|
||||
public static final String api = "/playlist/track/all?id=";
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
public static boolean hq(List<xm> list, String uid) {
|
||||
if (uid.equals("mp3_xz.json")) {
|
||||
public static boolean hq(List<MP3> list, String uid) {
|
||||
switch (uid) {
|
||||
case "mp3_xz.json":
|
||||
return playlist.hq_xz(list);
|
||||
} else if (uid.equals("mp3_like.json")) {
|
||||
case "mp3_like.json":
|
||||
return playlist.hq_like(list);
|
||||
} else if (uid.equals("mp3_hc.json")) {
|
||||
case "mp3_hc.json":
|
||||
return hq_hc(list);
|
||||
}
|
||||
list.clear();
|
||||
|
@ -56,7 +59,7 @@ public class playlist extends Thread {
|
|||
}
|
||||
zz.append("-").append(al.getString("name"));
|
||||
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;
|
||||
} catch (Exception e) {
|
||||
|
@ -65,21 +68,17 @@ public class playlist extends Thread {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static boolean hq_like(List<xm> list) {
|
||||
public static boolean hq_like(List<MP3> list) {
|
||||
list.clear();
|
||||
try {
|
||||
JSONObject json = gd.like;
|
||||
if (json == null || json.length() < 1) {
|
||||
String dqwb = wj.dqwb(wj.gd + "mp3_like.json");
|
||||
if (dqwb == null) {
|
||||
return false;
|
||||
}
|
||||
for (Iterator<String> it = json.keys(); it.hasNext(); ) {
|
||||
String id = it.next();
|
||||
JSONObject jsonObject = json.getJSONObject(id);
|
||||
String name = jsonObject.getString("name");
|
||||
String zz = jsonObject.getString("zz");
|
||||
String picUrl = jsonObject.getString("picUrl");
|
||||
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;
|
||||
} catch (Exception e) {
|
||||
gj.sc("失败的错误 " + e);
|
||||
|
@ -87,18 +86,18 @@ public class playlist extends Thread {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static boolean hq_xz(List<xm> list) {
|
||||
public static boolean hq_xz(List<MP3> list) {
|
||||
list.clear();
|
||||
try {
|
||||
File file = new File(wj.filesdri + "mp3");
|
||||
File[] files = file.listFiles();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
ID3v2 mp3File = new Mp3File(files[i]).getId3v2Tag();
|
||||
String id = files[i].getName();
|
||||
for (File value : files) {
|
||||
ID3v2 mp3File = new Mp3File(value).getId3v2Tag();
|
||||
String id = value.getName();
|
||||
String name = mp3File.getTitle();
|
||||
String zz = mp3File.getArtist();
|
||||
String picUrl = mp3File.getUrl();
|
||||
list.add(new xm(id, name, zz, picUrl));
|
||||
list.add(new MP3(id, name, zz, picUrl));
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
|
@ -107,19 +106,18 @@ public class playlist extends Thread {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean hq_hc(List<xm> list) {
|
||||
|
||||
public static boolean hq_hc(List<MP3> list) {
|
||||
list.clear();
|
||||
try {
|
||||
File file = new File(wj.filesdri + "hc");
|
||||
File[] files = file.listFiles();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
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));
|
||||
String dqwb = wj.dqwb(wj.gd + "mp3_hc.json");
|
||||
if (dqwb == null) {
|
||||
return false;
|
||||
}
|
||||
Type type = new TypeToken<List<MP3>>() {
|
||||
}.getType();
|
||||
Gson gson = new Gson();
|
||||
list.addAll(gson.fromJson(dqwb, type));
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
gj.sc("失败的错误 " + e);
|
||||
|
|
|
@ -18,13 +18,26 @@ import com.muqingbfq.xm;
|
|||
public class resource {
|
||||
|
||||
public static void recommend(List<xm> list) {
|
||||
String hq;
|
||||
JSONObject json;
|
||||
try {
|
||||
hq = wl.hq("/recommend/resource?cookie=" + wl.Cookie);
|
||||
if (TextUtils.isEmpty(hq) && wj.cz(wj.gd_json)) {
|
||||
hq = wj.dqwb(wj.gd_json);
|
||||
String hq = wj.dqwb(wj.gd_json);
|
||||
JSONObject 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);
|
||||
if (json.getInt("code") == 200) {
|
||||
wj.xrwb(wj.gd_json, hq);
|
||||
|
@ -75,9 +88,9 @@ public class resource {
|
|||
}
|
||||
|
||||
public static void 下载(List<xm> list) {
|
||||
list.add(new xm("mp3_like.json", "喜欢", R.mipmap.like, true));
|
||||
list.add(new xm("mp3_xz.json", "下载", R.drawable.icon, true));
|
||||
list.add(new xm("mp3_hc.json", "缓存", R.drawable.icon, true));
|
||||
list.add(new xm("mp3_hc.json", "最近播放", R.drawable.zt, true));
|
||||
list.add(new xm("mp3_like.json", "喜欢", R.drawable.like, true));
|
||||
list.add(new xm("mp3_xz.json", "下载", R.drawable.download, true));
|
||||
try {
|
||||
JSONObject date = new JSONObject(wj.dqwb(wj.gd_xz));
|
||||
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.Mp3File;
|
||||
import com.muqingbfq.MP3;
|
||||
import com.muqingbfq.fragment.Media;
|
||||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.mq.wj;
|
||||
|
@ -25,14 +26,14 @@ import okhttp3.ResponseBody;
|
|||
|
||||
public class url extends Thread {
|
||||
public static String api = "/song/url/v1";
|
||||
xm x;
|
||||
MP3 x;
|
||||
|
||||
public url(xm x) {
|
||||
public url(MP3 x) {
|
||||
this.x = x;
|
||||
start();
|
||||
}
|
||||
|
||||
public static String hq(xm x) {
|
||||
public static String hq(MP3 x) {
|
||||
if (Media.lrcview != null) {
|
||||
gc(x.id);
|
||||
}
|
||||
|
@ -40,6 +41,9 @@ public class url extends Thread {
|
|||
if (wj.cz(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";
|
||||
boolean wiFiConnected = gj.isWiFiConnected();
|
||||
if (wiFiConnected) {
|
||||
|
|
|
@ -20,6 +20,8 @@ import androidx.appcompat.app.AppCompatActivity;
|
|||
import androidx.appcompat.widget.Toolbar;
|
||||
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.url;
|
||||
import com.muqingbfq.databinding.ActivityBfqBinding;
|
||||
|
@ -32,6 +34,10 @@ import org.json.JSONArray;
|
|||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class bfq extends AppCompatActivity {
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
public static AppCompatActivity context;
|
||||
|
@ -76,22 +82,26 @@ public class bfq extends AppCompatActivity {
|
|||
text();
|
||||
inflate.like.setOnClickListener(view1 -> {
|
||||
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) {
|
||||
list.remove(bfqkz.xm);
|
||||
inflate.like
|
||||
.setImageTintList(ContextCompat.getColorStateList(bfq.this, R.color.text));
|
||||
com.muqingbfq.fragment.gd.like.remove(String.valueOf(bfqkz.xm.id));
|
||||
} else {
|
||||
if (!list.contains(bfqkz.xm)) {
|
||||
list.add(bfqkz.xm);
|
||||
inflate.like.setImageTintList(ContextCompat.
|
||||
getColorStateList(bfq.this, android.R.color.holo_red_dark));
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("name", bfqkz.xm.name);
|
||||
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;
|
||||
wj.xrwb(wj.gd + "mp3_like.json", gson.toJson(list));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -111,7 +121,7 @@ public class bfq extends AppCompatActivity {
|
|||
@Override
|
||||
public void 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);
|
||||
if (hq == null) {
|
||||
return;
|
||||
|
|
|
@ -5,12 +5,18 @@ import android.content.Context;
|
|||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.muqingbfq.api.url;
|
||||
import com.muqingbfq.fragment.Media;
|
||||
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.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class bfq_an {
|
||||
public static class kz implements View.OnClickListener {
|
||||
|
@ -49,6 +55,7 @@ public class bfq_an {
|
|||
bfqkz.xm = bfqkz.list.get(bfqkz.getmti(ms));
|
||||
new url(bfqkz.xm);
|
||||
}
|
||||
|
||||
public static class control implements View.OnClickListener {
|
||||
public control(ImageView imageView) {
|
||||
switch (bfqkz.ms) {
|
||||
|
@ -92,17 +99,27 @@ public class bfq_an {
|
|||
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("mm:ss");
|
||||
|
||||
public static String getTime(long time) {
|
||||
return simpleDateFormat.format(new Date(time));
|
||||
}
|
||||
|
||||
public static void islike() {
|
||||
boolean contains = false;
|
||||
String dqwb = wj.dqwb(wj.gd + "mp3_like.json");
|
||||
if (dqwb != null) {
|
||||
try {
|
||||
gd.like.getJSONObject(String.valueOf(bfqkz.xm.id));
|
||||
bfqkz.like_bool = true;
|
||||
Media.setlike(true);
|
||||
Type type = new TypeToken<List<MP3>>() {
|
||||
}.getType();
|
||||
List<MP3> o = new Gson().fromJson(dqwb, type);
|
||||
if (o != null) {
|
||||
contains = o.contains(bfqkz.xm);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
bfqkz.like_bool = false;
|
||||
Media.setlike(false);
|
||||
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.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
|
@ -21,17 +19,19 @@ import androidx.media3.common.MediaItem;
|
|||
import com.muqingbfq.api.url;
|
||||
import com.muqingbfq.mq.BluetoothMusicController;
|
||||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.mq.wj;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class bfqkz extends Service {
|
||||
public static com.muqingbfq.MediaPlayer mt;
|
||||
public static List<xm> list = new ArrayList<>();
|
||||
public static MediaPlayer mt;
|
||||
public static List<MP3> list = new ArrayList<>();
|
||||
public static List<MP3> lishi_list = new ArrayList<>();
|
||||
public static int ms;
|
||||
// 0 循环 1 顺序 2 随机
|
||||
public static xm xm;
|
||||
public static MP3 xm;
|
||||
public static boolean like_bool;
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
public static com.muqingbfq.mq.NotificationManagerCompat notify;
|
||||
|
@ -46,6 +46,7 @@ public class bfqkz extends Service {
|
|||
} else if (s == 2) {
|
||||
i = new Random().nextInt(bfqkz.list.size());
|
||||
}
|
||||
mt.build.seekToDefaultPosition(i);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -58,43 +59,32 @@ public class bfqkz extends Service {
|
|||
if (TextUtils.isEmpty(xm.picurl.toString())) {
|
||||
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);
|
||||
} catch (Exception e) {
|
||||
yc.start(home.appCompatActivity, "bfqkz mp3(" + id + ") :" + e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void mp3(Uri id) {
|
||||
try {
|
||||
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);
|
||||
}
|
||||
mp3(id.toString());
|
||||
}
|
||||
|
||||
|
||||
public static MediaSessionCompat mSession;
|
||||
public static MediaMetadataCompat build;
|
||||
public static PlaybackStateCompat playback;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
if (mt == null) {
|
||||
mt = new com.muqingbfq.MediaPlayer();
|
||||
com.muqingbfq.api.playlist.hq_hc(bfqkz.lishi_list);
|
||||
new BluetoothMusicController(this);
|
||||
}
|
||||
mSession = new MediaSessionCompat(this, "MusicService");
|
||||
playback = new PlaybackStateCompat.Builder()
|
||||
.setState(PlaybackStateCompat.STATE_NONE, 0, 1.0f)
|
||||
|
@ -102,14 +92,6 @@ public class bfqkz extends Service {
|
|||
mSession.setCallback(new callback());
|
||||
mSession.setFlags(MediaSessionCompat.FLAG_HANDLES_TRANSPORT_CONTROLS);
|
||||
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.setActive(true);
|
||||
notify = new com.muqingbfq.mq.NotificationManagerCompat(this);
|
||||
|
@ -145,6 +127,7 @@ public class bfqkz extends Service {
|
|||
mSession.setPlaybackState(playback);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayFromUri(Uri uri, Bundle extras) {
|
||||
try {
|
||||
|
@ -169,11 +152,13 @@ public class bfqkz extends Service {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public class MyBinder extends Binder {
|
||||
bfqkz getService() {
|
||||
return bfqkz.this;
|
||||
|
|
|
@ -87,17 +87,9 @@ public class Media extends Fragment {
|
|||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
if (view != null) {
|
||||
return view;
|
||||
}
|
||||
FragmentBfqBinding inflate = FragmentBfqBinding.inflate(inflater, container, false);
|
||||
view = inflate.getRoot();
|
||||
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.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
|
@ -135,6 +127,15 @@ public class Media extends Fragment {
|
|||
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) {
|
||||
|
@ -145,14 +146,6 @@ public class Media extends Fragment {
|
|||
long position = bfqkz.mt.build.getCurrentPosition();
|
||||
setProgress((int) position);
|
||||
main.handler.post(bfqkz.mt.updateSeekBar); // 在播放开始时启动更新进度
|
||||
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
url.gc(bfqkz.xm.id);
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
|
|
@ -11,16 +11,19 @@ import androidx.core.content.ContextCompat;
|
|||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
import com.muqingbfq.MP3;
|
||||
import com.muqingbfq.R;
|
||||
import com.muqingbfq.api.url;
|
||||
import com.muqingbfq.bfqkz;
|
||||
import com.muqingbfq.list.MyViewHoder;
|
||||
import com.muqingbfq.main;
|
||||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.xm;
|
||||
import com.muqingbfq.yc;
|
||||
|
||||
public class bflb_db extends BottomSheetDialog {
|
||||
public static RecyclerView.Adapter<MyViewHoder> adapter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -32,12 +35,12 @@ public class bflb_db extends BottomSheetDialog {
|
|||
RecyclerView lb = findViewById(R.id.lb);
|
||||
lb.setAdapter(new spq());
|
||||
if (bfqkz.xm != null) {
|
||||
lb.smoothScrollToPosition(bfqkz.list.indexOf(bfqkz.xm));
|
||||
lb.smoothScrollToPosition(getI());
|
||||
}
|
||||
findViewById(R.id.xxbj).
|
||||
setOnClickListener(v -> {
|
||||
if (bfqkz.xm != null) {
|
||||
lb.smoothScrollToPosition(bfqkz.list.indexOf(bfqkz.xm));
|
||||
lb.smoothScrollToPosition(getI());
|
||||
}
|
||||
});
|
||||
} 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) {
|
||||
super(context);
|
||||
}
|
||||
|
@ -57,6 +67,7 @@ public class bflb_db extends BottomSheetDialog {
|
|||
public spq() {
|
||||
adapter = this;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MyViewHoder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
|
@ -66,7 +77,7 @@ public class bflb_db extends BottomSheetDialog {
|
|||
|
||||
@Override
|
||||
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.zz.setText(x.zz);
|
||||
int color = ContextCompat.getColor(holder.getContext(), R.color.text);
|
||||
|
|
|
@ -12,8 +12,12 @@ import android.widget.TextView;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.muqingbfq.MP3;
|
||||
import com.muqingbfq.MediaPlayer;
|
||||
import com.muqingbfq.R;
|
||||
import com.muqingbfq.api.url;
|
||||
import com.muqingbfq.bfq;
|
||||
import com.muqingbfq.bfq_an;
|
||||
import com.muqingbfq.bfqkz;
|
||||
|
@ -35,11 +39,24 @@ public class bfq_db extends Fragment {
|
|||
String jsonList = this.getContext().getSharedPreferences("list", Context.MODE_PRIVATE)
|
||||
.getString("listData", null); // 获取保存的 JSON 字符串
|
||||
if (jsonList != null) {
|
||||
Type type = new TypeToken<List<xm>>() {
|
||||
Type type = new TypeToken<List<MP3>>() {
|
||||
}.getType();
|
||||
bfqkz.list = new com.google.gson.Gson().fromJson(jsonList, type);
|
||||
// 将 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);
|
||||
|
||||
|
|
|
@ -2,10 +2,8 @@ package com.muqingbfq.fragment;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -22,27 +20,21 @@ import androidx.viewpager2.widget.ViewPager2;
|
|||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.google.android.material.card.MaterialCardView;
|
||||
import com.muqingbfq.MP3;
|
||||
import com.muqingbfq.R;
|
||||
import com.muqingbfq.api.playlist;
|
||||
import com.muqingbfq.api.resource;
|
||||
import com.muqingbfq.bfq_an;
|
||||
import com.muqingbfq.bfqkz;
|
||||
import com.muqingbfq.databinding.FragmentGdBinding;
|
||||
import com.muqingbfq.list.list_gd;
|
||||
import com.muqingbfq.main;
|
||||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.mq.wj;
|
||||
import com.muqingbfq.xm;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class gd extends Fragment {
|
||||
public static String gdid;
|
||||
public static JSONObject like = new JSONObject();
|
||||
FragmentGdBinding binding;
|
||||
@Override
|
||||
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();
|
||||
}
|
||||
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.RecyclerView;
|
||||
|
||||
import com.muqingbfq.MP3;
|
||||
import com.muqingbfq.R;
|
||||
import com.muqingbfq.api.playlist;
|
||||
import com.muqingbfq.api.url;
|
||||
|
@ -29,7 +30,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
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;
|
||||
|
||||
@Override
|
||||
|
@ -94,7 +95,7 @@ public class mp3 extends FragmentActivity {
|
|||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MyViewHoder holder, int position) {
|
||||
xm x = list.get(position);
|
||||
MP3 x = list.get(position);
|
||||
holder.name.setText(x.name);
|
||||
holder.zz.setText(x.zz);
|
||||
int color = ContextCompat.getColor(holder.getContext(), R.color.text);
|
||||
|
|
|
@ -16,6 +16,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
|||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.muqingbfq.MP3;
|
||||
import com.muqingbfq.R;
|
||||
import com.muqingbfq.api.url;
|
||||
import com.muqingbfq.bfq;
|
||||
|
@ -36,7 +37,8 @@ import java.util.List;
|
|||
|
||||
public class search extends Fragment {
|
||||
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;
|
||||
public String name;
|
||||
|
||||
|
@ -53,7 +55,7 @@ public class search extends Fragment {
|
|||
TypedValue typedValue = new TypedValue();
|
||||
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);
|
||||
inflate.tablayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
|
@ -107,6 +109,7 @@ public class search extends Fragment {
|
|||
public class start extends Thread {
|
||||
public start(String name) {
|
||||
list.clear();
|
||||
xmList.clear();
|
||||
search.this.name = name;
|
||||
start();
|
||||
}
|
||||
|
@ -153,7 +156,7 @@ public class search extends Fragment {
|
|||
zz.append("/").append(name_zz);
|
||||
}
|
||||
}
|
||||
list.add(new xm(id, name, zz.toString(), ""));
|
||||
list.add(new MP3(id, name, zz.toString(), ""));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
gj.sc(e);
|
||||
|
@ -172,7 +175,8 @@ public class search extends Fragment {
|
|||
String name = jsonObject.getString("name");
|
||||
String coverImgUrl = jsonObject.getString("coverImgUrl");
|
||||
// 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) {
|
||||
|
@ -195,7 +199,7 @@ public class search extends Fragment {
|
|||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MyViewHoder holder, int position) {
|
||||
xm x = list.get(position);
|
||||
MP3 x = list.get(position);
|
||||
holder.name.setText(x.name);
|
||||
holder.zz.setText(x.zz);
|
||||
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.gd;
|
||||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.mq.wj;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
import me.wcy.lrcview.LrcView;
|
||||
|
||||
|
@ -104,6 +108,7 @@ public class home extends AppCompatActivity {
|
|||
String jsonList = new com.google.gson.Gson().toJson(bfqkz.list);
|
||||
editor.putString("listData", jsonList);
|
||||
editor.apply();
|
||||
wj.setMP3ToFile(bfqkz.xm);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -111,7 +111,6 @@ public class NotificationManagerCompat {
|
|||
.setOngoing(bfqkz.mt.isPlaying());
|
||||
notificationManager_notify();
|
||||
}
|
||||
|
||||
private PendingIntent pendingIntent_kg,
|
||||
pendingIntent_syq,
|
||||
pendingIntent_xyq;
|
||||
|
|
|
@ -2,15 +2,20 @@ package com.muqingbfq.mq;
|
|||
|
||||
import android.content.Context;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.muqingbfq.MP3;
|
||||
import com.muqingbfq.yc;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.Files;
|
||||
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 com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.muqingbfq.databinding.ActivityYcBinding;
|
||||
|
||||
public class yc extends AppCompatActivity {
|
||||
public static Object exception;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_yc);
|
||||
TextView text = findViewById(R.id.text);
|
||||
ActivityYcBinding binding = ActivityYcBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
String deviceModel = Build.MODEL;
|
||||
String deviceManufacturer = Build.MANUFACTURER;
|
||||
|
@ -44,7 +44,7 @@ public class yc extends AppCompatActivity {
|
|||
+ "屏幕密度:" + density + "\n"
|
||||
+ "密度DPI:" + densityDpi + "\n" +
|
||||
"异常信息: " + exception.toString();
|
||||
text.setText(wb);
|
||||
binding.text.setText(wb);
|
||||
}
|
||||
|
||||
public static void start(Object e) {
|
||||
|
|
|
@ -5,5 +5,5 @@
|
|||
android:viewportHeight="1024">
|
||||
<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:fillColor="#444444"/>
|
||||
android:fillColor="@color/text"/>
|
||||
</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
|
||||
android:id="@+id/like"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginEnd="26dp"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:src="@mipmap/like"
|
||||
android:src="@drawable/like"
|
||||
app:tint="@color/text"
|
||||
tools:ignore="ContentDescription" />
|
||||
</LinearLayout>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:id="@+id/linearlayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
歌曲搜索和在线播放:用户可以通过关键词搜索自己喜欢的歌曲,也可以在线播放音乐,无需下载。\n
|
||||
歌曲收藏和创建歌单:用户可以将喜欢的歌曲收藏起来,创建自己的歌单,方便随时收听。\n
|
||||
超清音质:云音乐支持高品质的音乐播放,让用户感受更加真实、清晰的音乐体验。\n
|
||||
歌词显示和歌曲分享:云音乐还提供歌词显示功能,让用户可以跟随歌词唱歌。同时,用户也可以将自己喜欢的歌曲分享给朋友。\n
|
||||
歌词显示和歌曲分享:云音乐提供歌词显示功能的同时用户也可以将自己喜欢的歌曲分享给朋友。\n
|
||||
无论你是需要放松身心、工作休闲,或者在旅途中享受音乐,云音乐都能满足你的需求。欢迎下载使用云音乐,让音乐成为你生活的一部分。\n
|
||||
\n
|
||||
请注意,以上只是一个软件介绍的示例,软件具体开发工程还没有完善,具体的介绍内容可以根据实际情况进行体验软件。\n"
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:src="@mipmap/like"
|
||||
android:src="@drawable/like"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:tint="@color/text"
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:minHeight="?attr/actionBarSize"/>
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/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 |
|
@ -23,23 +23,26 @@
|
|||
</style>
|
||||
|
||||
<style name="Widget.App.Toolbar" parent="Widget.Material3.Toolbar">
|
||||
<item name="android:background">@drawable/background</item>
|
||||
<item name="materialThemeOverlay">@style/ThemeOverlay.App.Toolbar</item>
|
||||
</style>
|
||||
|
||||
<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 name="Widget.App.TabLayout" parent="Widget.Material3.TabLayout">
|
||||
<item name="materialThemeOverlay">@style/ThemeOverlay.App.TabLayout</item>
|
||||
<!-- <item name="tabTextAppearance">@style/TextAppearance.App.LabelLarge</item>-->
|
||||
</style>
|
||||
|
||||
<style name="ThemeOverlay.App.TabLayout" parent="">
|
||||
<item name="colorPrimary">#00BCD4</item>
|
||||
<item name="colorOnSurface">#ADD8E6</item>
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<style name="fragment_dialog" parent="Theme.muqing">
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
|
|
Loading…
Reference in New Issue
Block a user