更改喜欢音乐逻辑和储存
This commit is contained in:
parent
a1e0a80ac6
commit
22cd5b5e30
|
@ -18,7 +18,7 @@ android {
|
||||||
//noinspection OldTargetApi
|
//noinspection OldTargetApi
|
||||||
targetSdk 31
|
targetSdk 31
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.7.6"
|
versionName "1.7.8"
|
||||||
|
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
|
@ -56,7 +56,6 @@ dependencies {
|
||||||
|
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
|
|
||||||
implementation("androidx.media3:media3-exoplayer:1.2.0")
|
|
||||||
//修改音乐标签库
|
//修改音乐标签库
|
||||||
implementation 'com.mpatric:mp3agic:0.9.1'
|
implementation 'com.mpatric:mp3agic:0.9.1'
|
||||||
}
|
}
|
|
@ -12,8 +12,8 @@
|
||||||
"filters": [],
|
"filters": [],
|
||||||
"attributes": [],
|
"attributes": [],
|
||||||
"versionCode": 1,
|
"versionCode": 1,
|
||||||
"versionName": "1.7.6",
|
"versionName": "1.7.8",
|
||||||
"outputFile": "Cloud_music-debug-v1.7.6.apk"
|
"outputFile": "Cloud_music-debug-v1.7.8.apk"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"elementType": "File"
|
"elementType": "File"
|
||||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Objects;
|
||||||
public class MP3 {
|
public class MP3 {
|
||||||
public String id, name, zz;
|
public String id, name, zz;
|
||||||
// 音乐的贴图
|
// 音乐的贴图
|
||||||
public Object picurl;
|
public String picurl;
|
||||||
public MP3(String id, String name, String zz, String picurl) {
|
public MP3(String id, String name, String zz, String picurl) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
|
@ -4,33 +4,35 @@ import static com.muqingbfq.bfqkz.xm;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.media.AudioAttributes;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.MediaItem;
|
|
||||||
import androidx.media3.common.PlaybackException;
|
|
||||||
import androidx.media3.common.Player;
|
|
||||||
import androidx.media3.exoplayer.ExoPlayer;
|
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.bumptech.glide.load.DataSource;
|
import com.bumptech.glide.load.DataSource;
|
||||||
import com.bumptech.glide.load.engine.GlideException;
|
import com.bumptech.glide.load.engine.GlideException;
|
||||||
import com.bumptech.glide.request.RequestListener;
|
import com.bumptech.glide.request.RequestListener;
|
||||||
import com.bumptech.glide.request.target.Target;
|
import com.bumptech.glide.request.target.Target;
|
||||||
|
import com.mpatric.mp3agic.ID3v2;
|
||||||
|
import com.mpatric.mp3agic.Mp3File;
|
||||||
import com.muqingbfq.fragment.Media;
|
import com.muqingbfq.fragment.Media;
|
||||||
import com.muqingbfq.fragment.bflb_db;
|
import com.muqingbfq.fragment.bflb_db;
|
||||||
import com.muqingbfq.fragment.bfq_db;
|
import com.muqingbfq.fragment.bfq_db;
|
||||||
import com.muqingbfq.fragment.search;
|
import com.muqingbfq.fragment.search;
|
||||||
import com.muqingbfq.mq.gj;
|
import com.muqingbfq.mq.gj;
|
||||||
|
import com.muqingbfq.mq.wj;
|
||||||
|
|
||||||
public class MediaPlayer {
|
import java.io.IOException;
|
||||||
public ExoPlayer build;
|
|
||||||
|
public class MediaPlayer extends android.media.MediaPlayer {
|
||||||
// 每秒更新一次进度
|
// 每秒更新一次进度
|
||||||
public Runnable updateSeekBar = new Runnable() {
|
public Runnable updateSeekBar = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (build != null && build.isPlaying() && Media.lrcview != null) {
|
if (isPlaying() && Media.view != null) {
|
||||||
long position = build.getCurrentPosition();
|
long position = getCurrentPosition();
|
||||||
Media.setProgress((int) position);
|
Media.setProgress((int) position);
|
||||||
}
|
}
|
||||||
main.handler.postDelayed(this, 1000); // 每秒更新一次进度
|
main.handler.postDelayed(this, 1000); // 每秒更新一次进度
|
||||||
|
@ -39,50 +41,26 @@ public class MediaPlayer {
|
||||||
|
|
||||||
@SuppressLint("UnsafeOptInUsageError")
|
@SuppressLint("UnsafeOptInUsageError")
|
||||||
public MediaPlayer() {
|
public MediaPlayer() {
|
||||||
build = new ExoPlayer.Builder(home.appCompatActivity).build();
|
setOnErrorListener(new OnErrorListener() {
|
||||||
build.addListener(new Player.Listener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlaybackStateChanged(@Player.State int state) {
|
public boolean onError(android.media.MediaPlayer mediaPlayer, int i, int i1) {
|
||||||
switch (state) {
|
//针对错误进行相应的处理
|
||||||
case Player.STATE_READY:
|
|
||||||
bfui();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Player.STATE_ENDED:
|
|
||||||
int i = bfqkz.getmti(bfqkz.ms);
|
|
||||||
bfqkz.xm = bfqkz.list.get(i);
|
|
||||||
new Thread() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
super.run();
|
|
||||||
bfqkz.mp3(com.muqingbfq.api.
|
|
||||||
url.hq(bfqkz.xm));
|
|
||||||
}
|
|
||||||
}.start();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Player.STATE_BUFFERING:
|
|
||||||
case Player.STATE_IDLE:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (Media.view != null) {
|
|
||||||
main.handler.removeCallbacks(updateSeekBar); // 在播放开始时启动更新进度
|
|
||||||
long duration = build.getDuration();
|
|
||||||
Media.setMax((int) build.getDuration());
|
|
||||||
Media.setTime_a(bfq_an.getTime(duration));
|
|
||||||
long position = build.getCurrentPosition();
|
|
||||||
Media.setProgress((int) position);
|
|
||||||
main.handler.post(updateSeekBar); // 在播放开始时启动更新进度
|
|
||||||
}
|
|
||||||
// 在这里将进度更新到UI上
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPlayerError(@NonNull PlaybackException error) {
|
|
||||||
gj.sc(error);
|
|
||||||
bfqkz.list.remove(bfqkz.xm);
|
bfqkz.list.remove(bfqkz.xm);
|
||||||
Player.Listener.super.onPlayerError(error);
|
bfqkz.xm = bfqkz.list.get(bfqkz.getmti(bfqkz.ms));
|
||||||
|
new Thread() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
super.run();
|
||||||
|
bfqkz.mp3(com.muqingbfq.api.
|
||||||
|
url.hq(bfqkz.xm));
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setOnCompletionListener(new OnCompletionListener() {
|
||||||
|
@Override
|
||||||
|
public void onCompletion(android.media.MediaPlayer mediaPlayer) {
|
||||||
int i = bfqkz.getmti(bfqkz.ms);
|
int i = bfqkz.getmti(bfqkz.ms);
|
||||||
bfqkz.xm = bfqkz.list.get(i);
|
bfqkz.xm = bfqkz.list.get(i);
|
||||||
new Thread() {
|
new Thread() {
|
||||||
|
@ -94,73 +72,64 @@ public class MediaPlayer {
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onIsPlayingChanged(boolean isPlaying) {
|
|
||||||
Media.setbf(isPlaying);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
// build.setShuffleModeEnabled(true);
|
setAudioAttributes(new AudioAttributes
|
||||||
|
.Builder()
|
||||||
|
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
|
||||||
|
.build());
|
||||||
|
main.handler.post(updateSeekBar); // 在播放开始时启动更新进度
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pause() {
|
@Override
|
||||||
if (build.isPlaying()) {
|
public void pause() throws IllegalStateException {
|
||||||
build.pause();
|
if (isPlaying()) {
|
||||||
|
super.pause();
|
||||||
|
Media.setbf(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
@Override
|
||||||
|
public void start() throws IllegalStateException {
|
||||||
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();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
build.play();
|
super.start();
|
||||||
|
Media.setbf(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建 MediaItem 列表
|
// 创建 MediaItem 列表
|
||||||
// public static List<MediaItem> list = new ArrayList<>();
|
// public static List<MediaItem> list = new ArrayList<>();
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@Override
|
||||||
public void setDataSource(String path) {
|
public void setDataSource(String path) throws IOException {
|
||||||
DataSource(path);
|
reset();
|
||||||
|
super.setDataSource(path);
|
||||||
|
prepare();
|
||||||
|
start();
|
||||||
main.handler.post(() -> {
|
main.handler.post(() -> {
|
||||||
build.setPlayWhenReady(true);
|
bfui();
|
||||||
start();
|
if (Media.view != null) {
|
||||||
|
main.handler.removeCallbacks(updateSeekBar); // 在播放开始时启动更新进度
|
||||||
|
long duration = getDuration();
|
||||||
|
Media.setMax((int) getDuration());
|
||||||
|
Media.setTime_a(bfq_an.getTime(duration));
|
||||||
|
long position = getCurrentPosition();
|
||||||
|
Media.setProgress((int) position);
|
||||||
|
main.handler.post(updateSeekBar); // 在播放开始时启动更新进度
|
||||||
|
}
|
||||||
|
// 在这里将进度更新到UI上
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
public void DataSource(String path) throws Exception {
|
||||||
public void DataSource(String path) {
|
reset();
|
||||||
if (path == null) {
|
super.setDataSource(path);
|
||||||
return;
|
prepare();
|
||||||
}
|
|
||||||
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 void setTX() {
|
||||||
if (build == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return build.isPlaying();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void seekTo(long a) {
|
|
||||||
build.seekTo(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
|
||||||
private void bfui() {
|
|
||||||
Glide.with(main.application)
|
Glide.with(main.application)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.load(bfqkz.xm.picurl)
|
.load(bfqkz.xm.picurl)
|
||||||
|
@ -169,6 +138,17 @@ public class MediaPlayer {
|
||||||
public boolean onLoadFailed(@Nullable GlideException e, Object model,
|
public boolean onLoadFailed(@Nullable GlideException e, Object model,
|
||||||
@NonNull Target<Bitmap> target, boolean isFirstResource) {
|
@NonNull Target<Bitmap> target, boolean isFirstResource) {
|
||||||
bfq.bitmap = null;
|
bfq.bitmap = null;
|
||||||
|
try {
|
||||||
|
Mp3File mp3file = new Mp3File(wj.mp3 + bfqkz.xm.id);
|
||||||
|
if (mp3file.hasId3v2Tag()) {
|
||||||
|
ID3v2 id3v2Tag = mp3file.getId3v2Tag();
|
||||||
|
byte[] albumImage = id3v2Tag.getAlbumImage();
|
||||||
|
bfq.bitmap=
|
||||||
|
BitmapFactory.decodeByteArray(albumImage, 0, albumImage.length);
|
||||||
|
}
|
||||||
|
} catch (Exception a) {
|
||||||
|
gj.sc(a);
|
||||||
|
}
|
||||||
bfqkz.notify.setBitmap();
|
bfqkz.notify.setBitmap();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -182,12 +162,15 @@ public class MediaPlayer {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.submit();
|
.submit();
|
||||||
|
}
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
public void bfui() {
|
||||||
|
setTX();
|
||||||
String name = xm.name, zz = bfqkz.xm.zz;
|
String name = xm.name, zz = bfqkz.xm.zz;
|
||||||
if (Media.view != null) {
|
if (Media.view != null) {
|
||||||
Media.setProgress(0);
|
Media.setProgress(0);
|
||||||
Media.setname(name);
|
Media.setname(name);
|
||||||
Media.setzz(zz);
|
Media.setzz(zz);
|
||||||
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) {
|
||||||
|
@ -198,7 +181,6 @@ public class MediaPlayer {
|
||||||
}
|
}
|
||||||
if (bflb_db.adapter != null) {
|
if (bflb_db.adapter != null) {
|
||||||
bflb_db.adapter.notifyDataSetChanged();
|
bflb_db.adapter.notifyDataSetChanged();
|
||||||
gj.sc(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,6 +5,7 @@ import android.app.NotificationChannel;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
@ -19,9 +20,11 @@ import com.mpatric.mp3agic.Mp3File;
|
||||||
import com.mpatric.mp3agic.UnsupportedTagException;
|
import com.mpatric.mp3agic.UnsupportedTagException;
|
||||||
import com.muqingbfq.MP3;
|
import com.muqingbfq.MP3;
|
||||||
import com.muqingbfq.R;
|
import com.muqingbfq.R;
|
||||||
|
import com.muqingbfq.bfq;
|
||||||
import com.muqingbfq.mq.gj;
|
import com.muqingbfq.mq.gj;
|
||||||
import com.muqingbfq.mq.wj;
|
import com.muqingbfq.mq.wj;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -58,7 +61,6 @@ public class FileDownloader {
|
||||||
// 下载失败处理
|
// 下载失败处理
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
File outputFile = new File(wj.mp3, "nihao");
|
File outputFile = new File(wj.mp3, "nihao");
|
||||||
File parentFile = outputFile.getParentFile();
|
File parentFile = outputFile.getParentFile();
|
||||||
if (!parentFile.isDirectory()) {
|
if (!parentFile.isDirectory()) {
|
||||||
|
@ -89,7 +91,12 @@ public class FileDownloader {
|
||||||
id3v2Tag.setTitle(x.name);
|
id3v2Tag.setTitle(x.name);
|
||||||
id3v2Tag.setArtist(x.zz);
|
id3v2Tag.setArtist(x.zz);
|
||||||
id3v2Tag.setAlbum(x.zz);
|
id3v2Tag.setAlbum(x.zz);
|
||||||
id3v2Tag.setUrl(x.picurl.toString());
|
id3v2Tag.setLyrics(bfq.lrc);
|
||||||
|
ByteArrayOutputStream o = new ByteArrayOutputStream();
|
||||||
|
bfq.bitmap.compress(Bitmap.CompressFormat.JPEG, 100, o);
|
||||||
|
byte[] imageData = o.toByteArray();
|
||||||
|
id3v2Tag.setAlbumImage(imageData, "image/jpeg");
|
||||||
|
o.close();
|
||||||
mp3file.save(wj.mp3 + x.id);
|
mp3file.save(wj.mp3 + x.id);
|
||||||
outputFile.delete();
|
outputFile.delete();
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,25 +87,6 @@ public class resource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void 下载(List<xm> list) {
|
|
||||||
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(); ) {
|
|
||||||
String id = it.next();
|
|
||||||
boolean cz = wj.cz(wj.gd + id);
|
|
||||||
JSONObject jsonObject = date.getJSONObject(id);
|
|
||||||
String name = jsonObject.getString("name");
|
|
||||||
String picUrl = jsonObject.getString("picUrl");
|
|
||||||
list.add(new xm(id, name, picUrl, cz));
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
gj.sc(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void add(JSONObject jsonObject, List<xm> list) throws Exception {
|
private static void add(JSONObject jsonObject, List<xm> list) throws Exception {
|
||||||
String id = jsonObject.getString("id");
|
String id = jsonObject.getString("id");
|
||||||
boolean cz = wj.cz(wj.gd + id);
|
boolean cz = wj.cz(wj.gd + id);
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
package com.muqingbfq.api;
|
package com.muqingbfq.api;
|
||||||
|
|
||||||
import com.mpatric.mp3agic.ID3v2;
|
import com.mpatric.mp3agic.ID3v2;
|
||||||
|
import com.mpatric.mp3agic.InvalidDataException;
|
||||||
import com.mpatric.mp3agic.Mp3File;
|
import com.mpatric.mp3agic.Mp3File;
|
||||||
|
import com.mpatric.mp3agic.UnsupportedTagException;
|
||||||
import com.muqingbfq.MP3;
|
import com.muqingbfq.MP3;
|
||||||
|
import com.muqingbfq.bfq;
|
||||||
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;
|
||||||
|
@ -16,6 +19,7 @@ import org.json.JSONObject;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import okhttp3.Call;
|
import okhttp3.Call;
|
||||||
|
@ -38,12 +42,12 @@ public class url extends Thread {
|
||||||
gc(x.id);
|
gc(x.id);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
if (wj.cz(wj.mp3 + x.id)) {
|
||||||
|
return wj.mp3 + x.id;
|
||||||
|
}
|
||||||
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) {
|
||||||
|
@ -106,7 +110,6 @@ public class url extends Thread {
|
||||||
id3v2Tag.setTitle(x.name);
|
id3v2Tag.setTitle(x.name);
|
||||||
id3v2Tag.setArtist(x.zz);
|
id3v2Tag.setArtist(x.zz);
|
||||||
id3v2Tag.setAlbum(x.zz);
|
id3v2Tag.setAlbum(x.zz);
|
||||||
id3v2Tag.setUrl(x.picurl.toString());
|
|
||||||
mp3file.save(wj.filesdri + "hc/" + x.id);
|
mp3file.save(wj.filesdri + "hc/" + x.id);
|
||||||
file.delete();
|
file.delete();
|
||||||
// 保存修改后的音乐文件,删除原来的文件
|
// 保存修改后的音乐文件,删除原来的文件
|
||||||
|
@ -134,15 +137,24 @@ public class url extends Thread {
|
||||||
|
|
||||||
|
|
||||||
public static void gc(String id) {
|
public static void gc(String id) {
|
||||||
String lrc = null, tlyric = null;
|
String file = wj.mp3 + id;
|
||||||
try {
|
if (wj.cz(file)) {
|
||||||
JSONObject jsonObject = new JSONObject(wl.hq("/lyric?id=" + id));
|
try {
|
||||||
lrc = jsonObject.getJSONObject("lrc").getString("lyric");
|
Mp3File mp3file = new Mp3File(file);
|
||||||
tlyric = jsonObject.getJSONObject("tlyric").getString("lyric");
|
if (mp3file.hasId3v2Tag()) {
|
||||||
} catch (Exception e) {
|
ID3v2 id3v2Tag = mp3file.getId3v2Tag();
|
||||||
gj.sc("url gc(int id) lrc: " + e);
|
bfq.lrc = id3v2Tag.getLyrics();
|
||||||
|
}
|
||||||
|
if (bfq.lrc == null) {
|
||||||
|
bfq.lrc = wl.hq("/lyric?id=" + id);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
gj.sc(e);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
bfq.lrc = wl.hq("/lyric?id=" + id);
|
||||||
}
|
}
|
||||||
Media.loadLyric(lrc, tlyric);
|
Media.loadLyric();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String picurl(String id) {
|
public static String picurl(String id) {
|
||||||
|
@ -151,8 +163,8 @@ public class url extends Thread {
|
||||||
return new JSONObject(hq).getJSONArray("songs").getJSONObject(0)
|
return new JSONObject(hq).getJSONArray("songs").getJSONObject(0)
|
||||||
.getJSONObject("al").getString("picUrl");
|
.getJSONObject("al").getString("picUrl");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
yc.start(e);
|
gj.sc(e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -42,7 +42,7 @@ public class bfq extends AppCompatActivity {
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
public static AppCompatActivity context;
|
public static AppCompatActivity context;
|
||||||
public ActivityBfqBinding inflate;
|
public ActivityBfqBinding inflate;
|
||||||
|
public static String lrc;
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -75,7 +75,7 @@ public class bfq extends AppCompatActivity {
|
||||||
inflate.bfqListMp3.
|
inflate.bfqListMp3.
|
||||||
setOnClickListener(view1 -> com.muqingbfq.fragment.bflb_db.start(this));
|
setOnClickListener(view1 -> com.muqingbfq.fragment.bflb_db.start(this));
|
||||||
inflate.control.setOnClickListener(new bfq_an.control(inflate.control));
|
inflate.control.setOnClickListener(new bfq_an.control(inflate.control));
|
||||||
if (bfqkz.mt != null && bfqkz.mt.build.isPlaying()) {
|
if (bfqkz.mt != null && bfqkz.mt.isPlaying()) {
|
||||||
inflate.kg.setImageResource(R.drawable.bf);
|
inflate.kg.setImageResource(R.drawable.bf);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -110,6 +110,7 @@ public class bfq extends AppCompatActivity {
|
||||||
Media.setname(bfqkz.xm.name);
|
Media.setname(bfqkz.xm.name);
|
||||||
Media.setzz(bfqkz.xm.zz);
|
Media.setzz(bfqkz.xm.zz);
|
||||||
bfq_an.islike();
|
bfq_an.islike();
|
||||||
|
bfqkz.mt.setTX();
|
||||||
}
|
}
|
||||||
inflate.download.setOnClickListener(view -> {
|
inflate.download.setOnClickListener(view -> {
|
||||||
if (wj.cz(wj.mp3 + bfqkz.xm.id)) {
|
if (wj.cz(wj.mp3 + bfqkz.xm.id)) {
|
||||||
|
|
|
@ -14,7 +14,6 @@ import android.text.TextUtils;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
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;
|
||||||
|
@ -26,7 +25,7 @@ import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class bfqkz extends Service {
|
public class bfqkz extends Service {
|
||||||
public static MediaPlayer mt;
|
public static MediaPlayer mt = new MediaPlayer();
|
||||||
public static List<MP3> list = new ArrayList<>();
|
public static List<MP3> list = new ArrayList<>();
|
||||||
public static List<MP3> lishi_list = new ArrayList<>();
|
public static List<MP3> lishi_list = new ArrayList<>();
|
||||||
public static int ms;
|
public static int ms;
|
||||||
|
@ -46,7 +45,6 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,9 +52,23 @@ public class bfqkz extends Service {
|
||||||
public static void mp3(String id) {
|
public static void mp3(String id) {
|
||||||
try {
|
try {
|
||||||
if (TextUtils.isEmpty(id)) {
|
if (TextUtils.isEmpty(id)) {
|
||||||
|
//针对错误进行相应的处理
|
||||||
|
if (bfqkz.list.size() < 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bfqkz.list.remove(bfqkz.xm);
|
||||||
|
bfqkz.xm = bfqkz.list.get(bfqkz.getmti(bfqkz.ms));
|
||||||
|
new Thread() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
super.run();
|
||||||
|
bfqkz.mp3(com.muqingbfq.api.
|
||||||
|
url.hq(bfqkz.xm));
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (TextUtils.isEmpty(xm.picurl.toString())) {
|
if (TextUtils.isEmpty(xm.picurl)) {
|
||||||
xm.picurl = url.picurl(xm.id);
|
xm.picurl = url.picurl(xm.id);
|
||||||
}
|
}
|
||||||
if (bfqkz.lishi_list.size() >= 100) {
|
if (bfqkz.lishi_list.size() >= 100) {
|
||||||
|
|
|
@ -25,6 +25,9 @@ import com.muqingbfq.home;
|
||||||
import com.muqingbfq.main;
|
import com.muqingbfq.main;
|
||||||
import com.muqingbfq.mq.gj;
|
import com.muqingbfq.mq.gj;
|
||||||
|
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import me.wcy.lrcview.LrcView;
|
import me.wcy.lrcview.LrcView;
|
||||||
|
|
||||||
public class Media extends Fragment {
|
public class Media extends Fragment {
|
||||||
|
@ -114,7 +117,7 @@ public class Media extends Fragment {
|
||||||
time_b = inflate.timeB;
|
time_b = inflate.timeB;
|
||||||
//初始化歌词组件
|
//初始化歌词组件
|
||||||
lrcview.setDraggable(true, (view, time) -> {
|
lrcview.setDraggable(true, (view, time) -> {
|
||||||
bfqkz.mt.build.seekTo(Math.toIntExact(time));
|
bfqkz.mt.seekTo(Math.toIntExact(time));
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
if (!isTablet(com.muqingbfq.bfq.context)) {
|
if (!isTablet(com.muqingbfq.bfq.context)) {
|
||||||
|
@ -139,10 +142,10 @@ public class Media extends Fragment {
|
||||||
//初始化播放器列表
|
//初始化播放器列表
|
||||||
if (bfqkz.xm != null) {
|
if (bfqkz.xm != null) {
|
||||||
main.handler.removeCallbacks(bfqkz.mt.updateSeekBar); // 在播放开始时启动更新进度
|
main.handler.removeCallbacks(bfqkz.mt.updateSeekBar); // 在播放开始时启动更新进度
|
||||||
long duration = bfqkz.mt.build.getDuration();
|
long duration = bfqkz.mt.getDuration();
|
||||||
tdt.setMax((int) bfqkz.mt.build.getDuration());
|
tdt.setMax((int) bfqkz.mt.getDuration());
|
||||||
setTime_a(bfq_an.getTime(duration));
|
setTime_a(bfq_an.getTime(duration));
|
||||||
long position = bfqkz.mt.build.getCurrentPosition();
|
long position = bfqkz.mt.getCurrentPosition();
|
||||||
setProgress((int) position);
|
setProgress((int) position);
|
||||||
main.handler.post(bfqkz.mt.updateSeekBar); // 在播放开始时启动更新进度
|
main.handler.post(bfqkz.mt.updateSeekBar); // 在播放开始时启动更新进度
|
||||||
}
|
}
|
||||||
|
@ -155,10 +158,19 @@ public class Media extends Fragment {
|
||||||
Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
|
Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadLyric(String a, String b) {
|
public static void loadLyric() {
|
||||||
if (lrcview == null || a == null) {
|
if (lrcview == null || com.muqingbfq.bfq.lrc == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
JSONObject jsonObject;
|
||||||
|
String a = null, b = null;
|
||||||
|
try {
|
||||||
|
jsonObject = new JSONObject(com.muqingbfq.bfq.lrc);
|
||||||
|
a = jsonObject.getJSONObject("lrc").getString("lyric");
|
||||||
|
b = jsonObject.getJSONObject("tlyric").getString("lyric");
|
||||||
|
} catch (Exception e) {
|
||||||
|
gj.sc(e);
|
||||||
|
}
|
||||||
lrcview.loadLrc(a, b);
|
lrcview.loadLrc(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,11 @@ import com.muqingbfq.bfq;
|
||||||
import com.muqingbfq.bfq_an;
|
import com.muqingbfq.bfq_an;
|
||||||
import com.muqingbfq.bfqkz;
|
import com.muqingbfq.bfqkz;
|
||||||
import com.muqingbfq.home;
|
import com.muqingbfq.home;
|
||||||
|
import com.muqingbfq.mq.gj;
|
||||||
import com.muqingbfq.mq.wj;
|
import com.muqingbfq.mq.wj;
|
||||||
import com.muqingbfq.xm;
|
import com.muqingbfq.xm;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -46,14 +48,20 @@ public class bfq_db extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
bfqkz.xm = wj.getMP3FromFile();
|
bfqkz.xm = wj.getMP3FromFile();
|
||||||
bfqkz.mt = new MediaPlayer();
|
|
||||||
if (bfqkz.xm != null) {
|
if (bfqkz.xm != null) {
|
||||||
new Thread(){
|
new Thread(){
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
super.run();
|
super.run();
|
||||||
String hq = url.hq(bfqkz.xm);
|
String hq = url.hq(bfqkz.xm);
|
||||||
bfqkz.mt.DataSource(hq);
|
if (hq == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
bfqkz.mt.DataSource(hq);
|
||||||
|
} catch (Exception e) {
|
||||||
|
gj.sc(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.muqingbfq.fragment;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -13,6 +14,7 @@ import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||||
import androidx.viewpager2.widget.ViewPager2;
|
import androidx.viewpager2.widget.ViewPager2;
|
||||||
|
@ -20,22 +22,30 @@ 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.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import com.muqingbfq.R;
|
import com.muqingbfq.R;
|
||||||
import com.muqingbfq.api.playlist;
|
import com.muqingbfq.api.playlist;
|
||||||
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.main;
|
import com.muqingbfq.main;
|
||||||
|
import com.muqingbfq.mq.gj;
|
||||||
|
import com.muqingbfq.mq.wj;
|
||||||
|
import com.muqingbfq.mq.wl;
|
||||||
import com.muqingbfq.xm;
|
import com.muqingbfq.xm;
|
||||||
|
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
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;
|
||||||
FragmentGdBinding binding;
|
FragmentGdBinding binding;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
@ -49,27 +59,8 @@ public class gd extends Fragment {
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
binding = FragmentGdBinding.inflate(inflater, container, false);
|
binding = FragmentGdBinding.inflate(inflater, container, false);
|
||||||
binding.viewPager.setAdapter(new FragmentStateAdapter(getActivity()) {
|
binding.viewPager.setAdapter(new adaper(getActivity()));
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public Fragment createFragment(int position) {
|
|
||||||
switch (position) {
|
|
||||||
case 0:
|
|
||||||
return new gd_adapter();
|
|
||||||
case 1:
|
|
||||||
return new gd_adapter.paihangbang();
|
|
||||||
case 2:
|
|
||||||
return new gd_adapter.wuode();
|
|
||||||
default:
|
|
||||||
return new Fragment();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemCount() {
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// 将 ViewPager2 绑定到 TabLayout
|
// 将 ViewPager2 绑定到 TabLayout
|
||||||
binding.tablayout.setOnItemSelectedListener(item -> {
|
binding.tablayout.setOnItemSelectedListener(item -> {
|
||||||
int itemId = item.getItemId();
|
int itemId = item.getItemId();
|
||||||
|
@ -81,7 +72,8 @@ public class gd extends Fragment {
|
||||||
binding.viewPager.setCurrentItem(2);
|
binding.viewPager.setCurrentItem(2);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});binding.viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
});
|
||||||
|
binding.viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onPageSelected(int position) {
|
public void onPageSelected(int position) {
|
||||||
switch (position) {
|
switch (position) {
|
||||||
|
@ -93,12 +85,36 @@ public class gd extends Fragment {
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
binding.tablayout.setSelectedItemId(R.id.c);
|
binding.tablayout.setSelectedItemId(R.id.c);
|
||||||
|
wode fragment = (wode) list.get(position);
|
||||||
|
fragment.sx();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Fragment> list = new ArrayList<>();
|
||||||
|
|
||||||
|
private class adaper extends FragmentStateAdapter {
|
||||||
|
public adaper(@NonNull FragmentActivity fragmentActivity) {
|
||||||
|
super(fragmentActivity);
|
||||||
|
list.add(new gd_adapter());
|
||||||
|
list.add(new gd_adapter.paihangbang());
|
||||||
|
list.add(new wode());
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Fragment createFragment(int position) {
|
||||||
|
return list.get(position);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return list.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class baseadapter extends RecyclerView.Adapter<VH> {
|
public static class baseadapter extends RecyclerView.Adapter<VH> {
|
||||||
Context context;
|
Context context;
|
||||||
List<xm> list;
|
List<xm> list;
|
||||||
|
@ -123,9 +139,63 @@ public class gd extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull VH holder, int position) {
|
public void onBindViewHolder(@NonNull VH holder, int position) {
|
||||||
xm xm = list.get(position);
|
xm xm = list.get(position);
|
||||||
list_gd gd = new list_gd(xm,this);
|
holder.cardView.setOnClickListener(view -> {
|
||||||
holder.cardView.setOnClickListener(gd);
|
Context context = view.getContext();
|
||||||
holder.cardView.setOnLongClickListener(gd);
|
Intent intent = new Intent(context, mp3.class);
|
||||||
|
intent.putExtra("id", xm.id);
|
||||||
|
intent.putExtra("name", xm.name);
|
||||||
|
context.startActivity(intent);
|
||||||
|
});
|
||||||
|
holder.cardView.setOnLongClickListener(view -> {
|
||||||
|
String[] stringArray = view.getResources()
|
||||||
|
.getStringArray(R.array.gd_list);
|
||||||
|
new MaterialAlertDialogBuilder(view.getContext()).setItems(stringArray, (dialog, id) -> {
|
||||||
|
new Thread() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (id == 0) {
|
||||||
|
String hq = wl.hq(playlist.api + xm.id + "&limit=30");
|
||||||
|
if (hq != null) {
|
||||||
|
wj.xrwb(wj.gd + xm.id, hq);
|
||||||
|
xm.cz = true;
|
||||||
|
try {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
if (wj.cz(wj.gd_xz)) {
|
||||||
|
jsonObject = new JSONObject(Objects.requireNonNull(wj.dqwb(wj.gd_xz)));
|
||||||
|
}
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("name", xm.name);
|
||||||
|
json.put("picUrl", xm.picurl);
|
||||||
|
jsonObject.put(xm.id, json);
|
||||||
|
wj.xrwb(wj.gd_xz, jsonObject.toString());
|
||||||
|
} catch (JSONException e) {
|
||||||
|
gj.sc("list gd onclick thear " + e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (id == 2) {
|
||||||
|
wj.sc(wj.gd + xm.id);
|
||||||
|
if (xm.id.equals("mp3_xz.json")) {
|
||||||
|
wj.sc(new File(wj.mp3));
|
||||||
|
}
|
||||||
|
xm.cz = false;
|
||||||
|
try {
|
||||||
|
JSONObject jsonObject = new JSONObject(Objects.requireNonNull(wj.dqwb(wj.gd_xz)));
|
||||||
|
jsonObject.remove(xm.id);
|
||||||
|
list.remove(xm);
|
||||||
|
wj.xrwb(wj.gd_xz, jsonObject.toString());
|
||||||
|
} catch (JSONException e) {
|
||||||
|
gj.sc(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
main.handler.post(() -> notifyDataSetChanged());
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
// 在这里处理菜单项的点击事件
|
||||||
|
dialog.dismiss();
|
||||||
|
}).show();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
holder.textView.setText(xm.name);
|
holder.textView.setText(xm.name);
|
||||||
holder.kg.setOnClickListener(view1 -> {
|
holder.kg.setOnClickListener(view1 -> {
|
||||||
ImageView tx = (ImageView) view1;
|
ImageView tx = (ImageView) view1;
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.muqingbfq.fragment;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -17,6 +18,9 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.muqingbfq.R;
|
import com.muqingbfq.R;
|
||||||
import com.muqingbfq.api.resource;
|
import com.muqingbfq.api.resource;
|
||||||
|
import com.muqingbfq.databinding.FragmentWdBinding;
|
||||||
|
import com.muqingbfq.login.user_editing;
|
||||||
|
import com.muqingbfq.login.user_logs;
|
||||||
import com.muqingbfq.main;
|
import com.muqingbfq.main;
|
||||||
import com.muqingbfq.xm;
|
import com.muqingbfq.xm;
|
||||||
|
|
||||||
|
@ -50,10 +54,8 @@ public class gd_adapter extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class paihangbang extends Fragment {
|
public static class paihangbang extends Fragment {
|
||||||
|
|
||||||
List<xm> list = new ArrayList<>();
|
List<xm> list = new ArrayList<>();
|
||||||
gd.baseadapter baseadapter;
|
gd.baseadapter baseadapter;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||||
|
@ -78,35 +80,6 @@ public class gd_adapter extends Fragment {
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class wuode extends Fragment {
|
|
||||||
List<xm> list = new ArrayList<>();
|
|
||||||
gd.baseadapter baseadapter;
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
||||||
FrameLayout layout = new FrameLayout(getContext());
|
|
||||||
RecyclerView recyclerView = new RecyclerView(layout.getContext());
|
|
||||||
int k = (int) (main.k / getResources().getDisplayMetrics().density + 0.5f);
|
|
||||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(layout.getContext(), k / 120);
|
|
||||||
recyclerView.setLayoutManager(gridLayoutManager);
|
|
||||||
layout.addView(recyclerView);
|
|
||||||
baseadapter = new gd.baseadapter(getContext(), list);
|
|
||||||
recyclerView.setAdapter(baseadapter);
|
|
||||||
new Thread() {
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
super.run();
|
|
||||||
resource.下载(list);
|
|
||||||
main.handler.postDelayed(new sx(baseadapter),500);
|
|
||||||
}
|
|
||||||
}.start();
|
|
||||||
return layout;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class sx implements Runnable {
|
private static class sx implements Runnable {
|
||||||
gd.baseadapter baseadapter;
|
gd.baseadapter baseadapter;
|
||||||
|
|
||||||
|
|
|
@ -4,56 +4,15 @@ import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.muqingbfq.R;
|
import com.muqingbfq.R;
|
||||||
import com.muqingbfq.activity_about_software;
|
import com.muqingbfq.activity_about_software;
|
||||||
import com.muqingbfq.clean.fragment_clean;
|
import com.muqingbfq.clean.fragment_clean;
|
||||||
import com.muqingbfq.login.cookie;
|
import com.muqingbfq.login.cookie;
|
||||||
import com.muqingbfq.login.user_editing;
|
|
||||||
import com.muqingbfq.login.user_logs;
|
|
||||||
import com.muqingbfq.login.user_message;
|
|
||||||
import com.muqingbfq.main;
|
|
||||||
import com.muqingbfq.mq.gj;
|
import com.muqingbfq.mq.gj;
|
||||||
|
|
||||||
public class sz {
|
public class sz {
|
||||||
@SuppressLint("StaticFieldLeak")
|
|
||||||
public static TextView name, jieshao;
|
|
||||||
@SuppressLint("StaticFieldLeak")
|
|
||||||
public static ImageView imageView;
|
|
||||||
Context context;
|
|
||||||
|
|
||||||
public sz(Context context, View view) {
|
|
||||||
this.context = context;
|
|
||||||
name = view.findViewById(R.id.sz_text1);
|
|
||||||
jieshao = view.findViewById(R.id.sz_text2);
|
|
||||||
imageView = view.findViewById(R.id.image);
|
|
||||||
view.findViewById(R.id.xdbj).
|
|
||||||
setOnClickListener(v -> {
|
|
||||||
if (main.getToken() == null) {
|
|
||||||
context.startActivity(new Intent(context, user_logs.class));
|
|
||||||
} else {
|
|
||||||
context.startActivity(new Intent(context, user_editing.class));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
new user_message();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setname(String string) {
|
|
||||||
main.handler.post(() -> name.setText(string));
|
|
||||||
}
|
|
||||||
public static void setqianming(String string) {
|
|
||||||
main.handler.post(() -> {
|
|
||||||
if (string == null) {
|
|
||||||
jieshao.setText("");
|
|
||||||
} else {
|
|
||||||
jieshao.setText(string);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@SuppressLint("NonConstantResourceId")
|
@SuppressLint("NonConstantResourceId")
|
||||||
public static void switch_sz(Context context, int id) {
|
public static void switch_sz(Context context, int id) {
|
||||||
if (id == R.id.a) {
|
if (id == R.id.a) {
|
||||||
|
|
171
app/src/main/java/com/muqingbfq/fragment/wode.java
Normal file
171
app/src/main/java/com/muqingbfq/fragment/wode.java
Normal file
|
@ -0,0 +1,171 @@
|
||||||
|
package com.muqingbfq.fragment;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.muqingbfq.R;
|
||||||
|
import com.muqingbfq.databinding.FragmentWdBinding;
|
||||||
|
import com.muqingbfq.login.user_editing;
|
||||||
|
import com.muqingbfq.login.user_logs;
|
||||||
|
import com.muqingbfq.login.user_message;
|
||||||
|
import com.muqingbfq.main;
|
||||||
|
import com.muqingbfq.mq.gj;
|
||||||
|
import com.muqingbfq.mq.wj;
|
||||||
|
import com.muqingbfq.xm;
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class wode extends Fragment {
|
||||||
|
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
public static TextView name, jieshao;
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
public static ImageView imageView;
|
||||||
|
|
||||||
|
FragmentWdBinding binding;
|
||||||
|
private final List<com.muqingbfq.xm> list = new ArrayList<>();
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
binding = FragmentWdBinding.inflate(inflater, container, false);
|
||||||
|
View view = binding.getRoot();
|
||||||
|
name = binding.text1;
|
||||||
|
jieshao = binding.text2;
|
||||||
|
imageView = binding.imageView;
|
||||||
|
binding.cardview.setOnClickListener(v -> {
|
||||||
|
if (main.getToken() == null) {
|
||||||
|
startActivity(new Intent(getContext(), user_logs.class));
|
||||||
|
} else {
|
||||||
|
startActivity(new Intent(getContext(), user_editing.class));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
new user_message();
|
||||||
|
int k = (int) (main.k / getResources().getDisplayMetrics().density + 0.5f);
|
||||||
|
GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), k / 120);
|
||||||
|
binding.recyclerview1.setLayoutManager(gridLayoutManager);
|
||||||
|
final Object[][] lista ={
|
||||||
|
{R.drawable.bf,"最近播放"},
|
||||||
|
{R.drawable.download,"下载音乐"},
|
||||||
|
{R.drawable.like,"喜欢音乐"},
|
||||||
|
{R.drawable.icon,"本地搜索"},
|
||||||
|
{R.drawable.icon,"我的歌单"},
|
||||||
|
{R.drawable.icon,"导入歌单"},
|
||||||
|
{R.drawable.icon,"开发中"},
|
||||||
|
{R.drawable.icon,"开发者"}
|
||||||
|
};
|
||||||
|
binding.recyclerview1.setAdapter(new RecyclerView.Adapter<VH>() {
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public VH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View inflate = View.inflate(getContext(), R.layout.view_button, null);
|
||||||
|
return new VH(inflate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull VH holder, int position) {
|
||||||
|
String s = lista[position][1].toString();
|
||||||
|
holder.textView.setText(s);
|
||||||
|
Glide.with(getContext())
|
||||||
|
.load(lista[position][0])
|
||||||
|
.into(holder.imageView);
|
||||||
|
holder.itemView.setOnClickListener(view -> {
|
||||||
|
Intent a = new Intent(getContext(), com.muqingbfq.fragment.mp3.class);
|
||||||
|
switch (position) {
|
||||||
|
case 0:
|
||||||
|
a.putExtra("id", "mp3_hc.json");
|
||||||
|
a.putExtra("name", s);
|
||||||
|
getContext().startActivity(a);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
a.putExtra("id", "mp3_xz.json");
|
||||||
|
a.putExtra("name", s);
|
||||||
|
getContext().startActivity(a);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
a.putExtra("id", "mp3_like.json");
|
||||||
|
a.putExtra("name", s);
|
||||||
|
getContext().startActivity(a);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return lista.length;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
sx();
|
||||||
|
binding.recyclerview2.setLayoutManager(new LinearLayoutManager(getContext()){
|
||||||
|
@Override
|
||||||
|
public boolean canScrollVertically() {
|
||||||
|
return false;//禁止滑动
|
||||||
|
}
|
||||||
|
});
|
||||||
|
binding.recyclerview2.setFocusable(false);
|
||||||
|
binding.recyclerview2.setAdapter(new gd.baseadapter(getContext(),list));
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
class VH extends RecyclerView.ViewHolder {
|
||||||
|
public ImageView imageView;
|
||||||
|
public TextView textView;
|
||||||
|
public VH(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
imageView = itemView.findViewById(R.id.image);
|
||||||
|
textView = itemView.findViewById(R.id.text1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sx(){
|
||||||
|
try {
|
||||||
|
list.clear();
|
||||||
|
JSONObject date = new JSONObject(wj.dqwb(wj.gd_xz));
|
||||||
|
for (Iterator<String> it = date.keys(); it.hasNext(); ) {
|
||||||
|
String id = it.next();
|
||||||
|
boolean cz = wj.cz(wj.gd + id);
|
||||||
|
JSONObject jsonObject = date.getJSONObject(id);
|
||||||
|
String name = jsonObject.getString("name");
|
||||||
|
String picUrl = jsonObject.getString("picUrl");
|
||||||
|
list.add(new xm(id, name, picUrl, cz));
|
||||||
|
}
|
||||||
|
binding.recyclerview2.getAdapter().notifyDataSetChanged();
|
||||||
|
} catch (Exception e) {
|
||||||
|
gj.sc(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void setname(String string) {
|
||||||
|
main.handler.post(() -> name.setText(string));
|
||||||
|
}
|
||||||
|
public static void setqianming(String string) {
|
||||||
|
main.handler.post(() -> {
|
||||||
|
if (string == null) {
|
||||||
|
jieshao.setText("");
|
||||||
|
} else {
|
||||||
|
jieshao.setText(string);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -39,6 +39,9 @@ public class home extends AppCompatActivity {
|
||||||
appCompatActivity = this;
|
appCompatActivity = this;
|
||||||
setTheme(R.style.Theme_muqing);
|
setTheme(R.style.Theme_muqing);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
if (true) {
|
||||||
|
com.muqingbfq.mq.floating.start(this);
|
||||||
|
}
|
||||||
setContentView(R.layout.activity_home);
|
setContentView(R.layout.activity_home);
|
||||||
DisplayMetrics dm = getResources().getDisplayMetrics();
|
DisplayMetrics dm = getResources().getDisplayMetrics();
|
||||||
main.k = dm.widthPixels;
|
main.k = dm.widthPixels;
|
||||||
|
@ -81,7 +84,6 @@ public class home extends AppCompatActivity {
|
||||||
com.muqingbfq.fragment.sz.switch_sz(home.this, item.getItemId());
|
com.muqingbfq.fragment.sz.switch_sz(home.this, item.getItemId());
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
new com.muqingbfq.fragment.sz(this, chb.getHeaderView(0));
|
|
||||||
//初始化播放器组件
|
//初始化播放器组件
|
||||||
// 启动Service
|
// 启动Service
|
||||||
if (serviceIntent == null) {
|
if (serviceIntent == null) {
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
package com.muqingbfq.list;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
|
||||||
import com.muqingbfq.R;
|
|
||||||
import com.muqingbfq.api.playlist;
|
|
||||||
import com.muqingbfq.fragment.gd;
|
|
||||||
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.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class list_gd implements View.OnClickListener, View.OnLongClickListener {
|
|
||||||
xm xm;
|
|
||||||
gd.baseadapter adaper;
|
|
||||||
public list_gd(com.muqingbfq.xm xm,gd.baseadapter baseadapter) {
|
|
||||||
this.xm = xm;
|
|
||||||
this.adaper = baseadapter;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
Context context = view.getContext();
|
|
||||||
Intent intent = new Intent(context, com.muqingbfq.fragment.mp3.class);
|
|
||||||
intent.putExtra("id", xm.id);
|
|
||||||
intent.putExtra("name", xm.name);
|
|
||||||
context.startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onLongClick(View view) {
|
|
||||||
String[] stringArray = view.getResources()
|
|
||||||
.getStringArray(R.array.gd_list);
|
|
||||||
new MaterialAlertDialogBuilder(view.getContext()).setItems(stringArray, (dialog, id) -> {
|
|
||||||
new Thread() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (id == 0) {
|
|
||||||
String hq = wl.hq(playlist.api + xm.id + "&limit=30");
|
|
||||||
if (hq != null) {
|
|
||||||
wj.xrwb(wj.gd + xm.id, hq);
|
|
||||||
xm.cz = true;
|
|
||||||
try {
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
|
||||||
if (wj.cz(wj.gd_xz)) {
|
|
||||||
jsonObject = new JSONObject(Objects.requireNonNull(wj.dqwb(wj.gd_xz)));
|
|
||||||
}
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
json.put("name", xm.name);
|
|
||||||
json.put("picUrl", xm.picurl);
|
|
||||||
jsonObject.put(xm.id, json);
|
|
||||||
wj.xrwb(wj.gd_xz, jsonObject.toString());
|
|
||||||
} catch (JSONException e) {
|
|
||||||
gj.sc("list gd onclick thear " + e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (id == 2) {
|
|
||||||
wj.sc(wj.gd + xm.id);
|
|
||||||
if (xm.id.equals("mp3_xz.json")) {
|
|
||||||
wj.sc(new File(wj.mp3));
|
|
||||||
}
|
|
||||||
xm.cz = false;
|
|
||||||
try {
|
|
||||||
JSONObject jsonObject = new JSONObject(Objects.requireNonNull(wj.dqwb(wj.gd_xz)));
|
|
||||||
jsonObject.remove(xm.id);
|
|
||||||
wj.xrwb(wj.gd_xz, jsonObject.toString());
|
|
||||||
} catch (JSONException e) {
|
|
||||||
gj.sc(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
main.handler.post(() -> adaper.notifyDataSetChanged());
|
|
||||||
}
|
|
||||||
}.start();
|
|
||||||
// 在这里处理菜单项的点击事件
|
|
||||||
dialog.dismiss();
|
|
||||||
}).show();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -152,9 +152,9 @@ public class user_editing extends FragmentActivity {
|
||||||
binding.userEnd.setOnClickListener(view ->{
|
binding.userEnd.setOnClickListener(view ->{
|
||||||
finish();
|
finish();
|
||||||
main.settoken(null, null);
|
main.settoken(null, null);
|
||||||
sz.setname("未登录");
|
com.muqingbfq.fragment.wode.setname("未登录");
|
||||||
sz.setqianming(null);
|
com.muqingbfq.fragment.wode.setqianming(null);
|
||||||
sz.imageView.setImageResource(R.drawable.icon);
|
com.muqingbfq.fragment.wode.imageView.setImageResource(R.drawable.icon);
|
||||||
});
|
});
|
||||||
findViewById(R.id.button1).setOnClickListener(view -> {
|
findViewById(R.id.button1).setOnClickListener(view -> {
|
||||||
// 创建OkHttpClient实例
|
// 创建OkHttpClient实例
|
||||||
|
|
|
@ -30,16 +30,16 @@ public class user_message extends Thread {
|
||||||
string strings = get();
|
string strings = get();
|
||||||
main.handler.post(() -> {
|
main.handler.post(() -> {
|
||||||
com.muqingbfq.fragment.
|
com.muqingbfq.fragment.
|
||||||
sz.setname(strings.userName());
|
wode.setname(strings.userName());
|
||||||
com.muqingbfq.fragment.
|
com.muqingbfq.fragment.
|
||||||
sz.setqianming(strings.introduce());
|
wode.setqianming(strings.introduce());
|
||||||
com.bumptech.glide.Glide.with(com.muqingbfq.fragment.
|
com.bumptech.glide.Glide.with(com.muqingbfq.fragment.
|
||||||
sz.imageView)
|
wode.imageView)
|
||||||
.load(strings.headIcon())
|
.load(strings.headIcon())
|
||||||
.placeholder(R.drawable.icon)//图片加载出来前,显示的图片
|
.placeholder(R.drawable.icon)//图片加载出来前,显示的图片
|
||||||
.error(R.drawable.icon)//图片加载失败后,显示的图片
|
.error(R.drawable.icon)//图片加载失败后,显示的图片
|
||||||
.into(com.muqingbfq.fragment.
|
.into(com.muqingbfq.fragment.
|
||||||
sz.imageView);
|
wode.imageView);
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gj.sc(e);
|
gj.sc(e);
|
||||||
|
|
|
@ -19,15 +19,31 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
android:minHeight="?attr/actionBarSize">
|
||||||
android:id="@+id/toolbar"
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:minHeight="?attr/actionBarSize"/>
|
<EditText
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
android:id="@+id/editview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="6dp"
|
||||||
|
android:autofillHints=""
|
||||||
|
android:background="@drawable/ui_editview"
|
||||||
|
android:hint="@string/search"
|
||||||
|
android:gravity="center"
|
||||||
|
android:imeOptions="actionSearch"
|
||||||
|
android:inputType="text"
|
||||||
|
android:minHeight="48dp"
|
||||||
|
android:paddingStart="3dp"
|
||||||
|
android:paddingEnd="3dp" />
|
||||||
|
</LinearLayout>
|
||||||
|
</com.google.android.material.appbar.MaterialToolbar>
|
||||||
|
|
||||||
<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"
|
||||||
|
|
|
@ -8,45 +8,4 @@
|
||||||
tools:context=".fragment.sz"
|
tools:context=".fragment.sz"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
android:focusable="true">
|
android:focusable="true">
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/xdbj"
|
|
||||||
android:layout_margin="6dp"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:padding="6dp"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
tools:ignore="UselessParent">
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
|
||||||
android:id="@+id/cardview"
|
|
||||||
android:layout_width="100dp"
|
|
||||||
android:layout_height="100dp"
|
|
||||||
android:layout_marginEnd="16dp"
|
|
||||||
app:cardUseCompatPadding="true">
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/image"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:src="@drawable/icon" />
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/sz_text1"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/login"
|
|
||||||
android:textSize="26sp" />
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/sz_text2"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:layout_marginBottom="35dp"
|
|
||||||
android:text="我是一名小小的游客" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
86
app/src/main/res/layout/fragment_wd.xml
Normal file
86
app/src/main/res/layout/fragment_wd.xml
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<com.google.android.material.card.MaterialCardView
|
||||||
|
android:id="@+id/cardview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:cardUseCompatPadding="true"
|
||||||
|
app:contentPadding="6dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageView"
|
||||||
|
android:layout_width="65dp"
|
||||||
|
android:layout_height="65dp"
|
||||||
|
android:src="@drawable/icon"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:textSize="26sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/imageView" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/text1"
|
||||||
|
android:text="@string/app_name"/>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
|
<com.google.android.material.card.MaterialCardView
|
||||||
|
android:id="@+id/cardview2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="6dp"
|
||||||
|
app:cardUseCompatPadding="true"
|
||||||
|
app:contentPadding="6dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/cardview">
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recyclerview1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
|
<com.google.android.material.card.MaterialCardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="6dp"
|
||||||
|
app:cardUseCompatPadding="true"
|
||||||
|
app:contentPadding="6dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/cardview2">
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recyclerview2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</ScrollView>
|
40
app/src/main/res/layout/list_gd_b.xml
Normal file
40
app/src/main/res/layout/list_gd_b.xml
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@null"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<com.google.android.material.card.MaterialCardView
|
||||||
|
android:id="@+id/cardview"
|
||||||
|
android:layout_width="120dp"
|
||||||
|
android:layout_height="120dp"
|
||||||
|
app:cardUseCompatPadding="true">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/fh"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scaleType="fitXY" />
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/kg"
|
||||||
|
android:layout_width="36dp"
|
||||||
|
android:layout_height="36dp"
|
||||||
|
android:layout_marginEnd="6dp"
|
||||||
|
android:layout_marginBottom="6dp"
|
||||||
|
android:layout_gravity="bottom|end"
|
||||||
|
android:src="@drawable/zt"/>
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/wb1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:lines="2"
|
||||||
|
android:maxLines="2"
|
||||||
|
android:text="@string/name"
|
||||||
|
android:textColor="@color/text" />
|
||||||
|
</LinearLayout>
|
19
app/src/main/res/layout/view_button.xml
Normal file
19
app/src/main/res/layout/view_button.xml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image"
|
||||||
|
android:layout_width="56dp"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:background="@null"
|
||||||
|
android:src="@drawable/icon"
|
||||||
|
android:scaleType="fitXY"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/app_name"/>
|
||||||
|
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user