refactor(layout): 优化多个布局文件的结构和样式
-调整了多个布局文件中的 View 属性,如可见性、布局权重等 - 优化了部分 UI 组件的使用,例如用 RecyclerView 替换 FragmentContainerView - 统一了搜索相关 UI 的样式和行为 -优化了部分代码逻辑,提高了可维护性
This commit is contained in:
parent
c4311a4711
commit
a487ee4bdd
|
@ -2,36 +2,32 @@ package com.muqingbfq;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.activity.result.ActivityResultLauncher;
|
import androidx.activity.result.ActivityResultLauncher;
|
||||||
import androidx.activity.result.contract.ActivityResultContracts;
|
import androidx.activity.result.contract.ActivityResultContracts;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import com.muqingbfq.Dialog.DialogEditText;
|
import com.muqingbfq.Dialog.DialogEditText;
|
||||||
import com.muqingbfq.fragment.wode;
|
|
||||||
import com.muqingbfq.login.user_logs;
|
import com.muqingbfq.login.user_logs;
|
||||||
import com.muqingbfq.mq.EditViewDialog;
|
|
||||||
import com.muqingbfq.mq.gj;
|
import com.muqingbfq.mq.gj;
|
||||||
import com.muqingbfq.mq.wl;
|
import com.muqingbfq.mq.wl;
|
||||||
import com.muqingbfq.view.Edit;
|
import com.muqingbfq.view.Edit;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class HomeSteer {
|
public class HomeSteer {
|
||||||
home home;
|
home home;
|
||||||
ActivityResultLauncher<Intent> dlintent;
|
ActivityResultLauncher<Intent> dlintent;
|
||||||
|
|
||||||
public HomeSteer(home home) {
|
Runnable runnable;
|
||||||
|
|
||||||
|
public HomeSteer(home home, Runnable runnable) {
|
||||||
|
this.runnable = runnable;
|
||||||
this.home = home;
|
this.home = home;
|
||||||
dlintent = home.registerForActivityResult(
|
dlintent = home.registerForActivityResult(
|
||||||
new ActivityResultContracts.StartActivityForResult(),
|
new ActivityResultContracts.StartActivityForResult(),
|
||||||
|
@ -41,7 +37,7 @@ public class HomeSteer {
|
||||||
Intent data = result.getData();
|
Intent data = result.getData();
|
||||||
boolean bool = Objects.requireNonNull(data).getBooleanExtra("bool", false);
|
boolean bool = Objects.requireNonNull(data).getBooleanExtra("bool", false);
|
||||||
if (bool) {
|
if (bool) {
|
||||||
Yes();
|
runnable.run();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,11 +60,11 @@ public class HomeSteer {
|
||||||
public void run() {
|
public void run() {
|
||||||
super.run();
|
super.run();
|
||||||
//获取游客Cookie
|
//获取游客Cookie
|
||||||
String hq = wl.hq("/register/anonimous");
|
String hq = wl.hq("/register/anonimous", null);
|
||||||
try {
|
try {
|
||||||
JSONObject jsonObject = new JSONObject(hq);
|
JSONObject jsonObject = new JSONObject(hq);
|
||||||
wl.setcookie(jsonObject.getString("cookie"));
|
wl.setcookie(jsonObject.getString("cookie"));
|
||||||
home.runOnUiThread(() -> Yes());
|
home.runOnUiThread(runnable);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
home.runOnUiThread(() -> Toast.makeText(home, "游客登陆失败:" + e.getMessage(), Toast.LENGTH_SHORT).show());
|
home.runOnUiThread(() -> Toast.makeText(home, "游客登陆失败:" + e.getMessage(), Toast.LENGTH_SHORT).show());
|
||||||
gj.sc(e);
|
gj.sc(e);
|
||||||
|
@ -80,14 +76,11 @@ public class HomeSteer {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
materialAlertDialogBuilder.show();
|
materialAlertDialogBuilder.show();
|
||||||
}else{
|
} else {
|
||||||
Yes();
|
runnable.run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Yes() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
String[] stringIp = new String[]{"https://ncm.nekogan.com", "https://api.csm.sayqz.com"};
|
String[] stringIp = new String[]{"https://ncm.nekogan.com", "https://api.csm.sayqz.com"};
|
||||||
|
|
||||||
|
@ -100,7 +93,6 @@ public class HomeSteer {
|
||||||
if (TextUtils.isEmpty(main.api)) {
|
if (TextUtils.isEmpty(main.api)) {
|
||||||
|
|
||||||
DialogEditText dialogEditText = getDialogEditText(nickname);
|
DialogEditText dialogEditText = getDialogEditText(nickname);
|
||||||
|
|
||||||
dialogEditText.binding.edittext.addTextChangedListener(new Edit.TextWatcher() {
|
dialogEditText.binding.edittext.addTextChangedListener(new Edit.TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
public void beforeTextChanged(CharSequence var1, int var2, int var3, int var4) {
|
public void beforeTextChanged(CharSequence var1, int var2, int var3, int var4) {
|
||||||
|
|
|
@ -32,7 +32,7 @@ import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class PlaybackService extends MediaSessionService {
|
public class PlaybackService extends MediaSessionService {
|
||||||
public static MediaSession mediaSession = null;
|
public static MediaSession mediaSession;
|
||||||
public static List<MP3> list = new ArrayList<>();
|
public static List<MP3> list = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,7 +80,8 @@ public class PlaybackService extends MediaSessionService {
|
||||||
Gson gson = new GsonBuilder()
|
Gson gson = new GsonBuilder()
|
||||||
.registerTypeAdapter(MediaItem.class, new MediaItemAdapter()) // 绑定适配器
|
.registerTypeAdapter(MediaItem.class, new MediaItemAdapter()) // 绑定适配器
|
||||||
.create();
|
.create();
|
||||||
List<MediaItem> listHistory = gson.fromJson(dqwb, new TypeToken<List<MediaItem>>(){}.getType());
|
List<MediaItem> listHistory = gson.fromJson(dqwb, new TypeToken<List<MediaItem>>() {
|
||||||
|
}.getType());
|
||||||
if (listHistory != null) {
|
if (listHistory != null) {
|
||||||
listHistory.removeIf(mediaItem1 -> mediaItem1.mediaId.equals(mediaItem.mediaId));
|
listHistory.removeIf(mediaItem1 -> mediaItem1.mediaId.equals(mediaItem.mediaId));
|
||||||
listHistory.add(0, mediaItem);
|
listHistory.add(0, mediaItem);
|
||||||
|
|
|
@ -31,7 +31,6 @@ import androidx.annotation.Nullable;
|
||||||
import androidx.core.graphics.Insets;
|
import androidx.core.graphics.Insets;
|
||||||
import androidx.core.view.ViewCompat;
|
import androidx.core.view.ViewCompat;
|
||||||
import androidx.core.view.WindowInsetsCompat;
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
|
||||||
import androidx.media3.common.MediaItem;
|
import androidx.media3.common.MediaItem;
|
||||||
import androidx.media3.common.MediaMetadata;
|
import androidx.media3.common.MediaMetadata;
|
||||||
import androidx.media3.common.Player;
|
import androidx.media3.common.Player;
|
||||||
|
@ -53,7 +52,6 @@ import com.muqingbfq.databinding.ActivityMusicBinding;
|
||||||
import com.muqingbfq.fragment.Media;
|
import com.muqingbfq.fragment.Media;
|
||||||
import com.muqingbfq.main;
|
import com.muqingbfq.main;
|
||||||
import com.muqingbfq.mq.AppCompatActivity;
|
import com.muqingbfq.mq.AppCompatActivity;
|
||||||
import com.muqingbfq.mq.MusicViewModel;
|
|
||||||
import com.muqingbfq.mq.gj;
|
import com.muqingbfq.mq.gj;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -61,7 +59,7 @@ import java.util.Objects;
|
||||||
|
|
||||||
public class Music extends AppCompatActivity<ActivityMusicBinding> implements GestureDetector.OnGestureListener {
|
public class Music extends AppCompatActivity<ActivityMusicBinding> implements GestureDetector.OnGestureListener {
|
||||||
|
|
||||||
private Player player = PlaybackService.mediaSession.getPlayer();
|
private final Player player = PlaybackService.mediaSession.getPlayer();
|
||||||
private int TdtHeight = 15;
|
private int TdtHeight = 15;
|
||||||
public static Bitmap backgroundbitmap=null;
|
public static Bitmap backgroundbitmap=null;
|
||||||
|
|
||||||
|
@ -261,7 +259,6 @@ public class Music extends AppCompatActivity<ActivityMusicBinding> implements Ge
|
||||||
String stringBuilder = "标题:" + currentMediaItem.mediaMetadata.title + System.lineSeparator() +
|
String stringBuilder = "标题:" + currentMediaItem.mediaMetadata.title + System.lineSeparator() +
|
||||||
"歌手:" + currentMediaItem.mediaMetadata.artist + System.lineSeparator() +
|
"歌手:" + currentMediaItem.mediaMetadata.artist + System.lineSeparator() +
|
||||||
"歌曲链接:" + "https://music.163.com/#/song?id=" + currentMediaItem.mediaId;
|
"歌曲链接:" + "https://music.163.com/#/song?id=" + currentMediaItem.mediaId;
|
||||||
|
|
||||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||||
intent.setType("text/plain");
|
intent.setType("text/plain");
|
||||||
intent.putExtra(Intent.EXTRA_TEXT, stringBuilder);
|
intent.putExtra(Intent.EXTRA_TEXT, stringBuilder);
|
||||||
|
@ -280,7 +277,7 @@ public class Music extends AppCompatActivity<ActivityMusicBinding> implements Ge
|
||||||
Runnable runnable = new Runnable() {
|
Runnable runnable = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (player != null && !isDrag) {
|
if (!isDrag) {
|
||||||
// 获取当前进度和持续时间
|
// 获取当前进度和持续时间
|
||||||
long currentPosition = player.getCurrentPosition();
|
long currentPosition = player.getCurrentPosition();
|
||||||
long duration = player.getDuration();
|
long duration = player.getDuration();
|
||||||
|
|
|
@ -42,7 +42,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class activity_search extends FragmentActivity<ActivitySearchBinding> {
|
public class activity_search extends FragmentActivity<ActivitySearchBinding> {
|
||||||
// private List<String> json_list = new ArrayList<>();
|
// private List<String> json_list = new ArrayList<>();
|
||||||
private final List<String> list = new ArrayList<>();
|
private final List<String> list = new ArrayList<>();
|
||||||
|
|
||||||
public static void start(Activity context, View view) {
|
public static void start(Activity context, View view) {
|
||||||
|
@ -105,7 +105,11 @@ public class activity_search extends FragmentActivity<ActivitySearchBinding> {
|
||||||
synchronized (o) {
|
synchronized (o) {
|
||||||
list.clear();
|
list.clear();
|
||||||
String hq = com.muqingbfq.mq.wl.
|
String hq = com.muqingbfq.mq.wl.
|
||||||
hq("/search/suggest?keywords=" + s + "&type=mobile");
|
hq("/search/suggest",
|
||||||
|
new String[][]{
|
||||||
|
{"keywords", s.toString()},
|
||||||
|
{"type", "mobile"}
|
||||||
|
});
|
||||||
try {
|
try {
|
||||||
JSONArray jsonArray = new JSONObject(hq).getJSONObject("result")
|
JSONArray jsonArray = new JSONObject(hq).getJSONObject("result")
|
||||||
.getJSONArray("allMatch");
|
.getJSONArray("allMatch");
|
||||||
|
@ -205,7 +209,7 @@ public class activity_search extends FragmentActivity<ActivitySearchBinding> {
|
||||||
binding.searchview.hide();
|
binding.searchview.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addSearchRecord(String name,List<String> json_list,SearchRecordAdapter adapter) {
|
public static void addSearchRecord(String name, List<String> json_list, SearchRecordAdapter adapter) {
|
||||||
try {
|
try {
|
||||||
int existingIndex = json_list.indexOf(name);
|
int existingIndex = json_list.indexOf(name);
|
||||||
if (existingIndex != -1) {
|
if (existingIndex != -1) {
|
||||||
|
@ -248,9 +252,9 @@ public class activity_search extends FragmentActivity<ActivitySearchBinding> {
|
||||||
public void start(String name) {
|
public void start(String name) {
|
||||||
dismiss();
|
dismiss();
|
||||||
if (!TextUtils.isEmpty(name)) {
|
if (!TextUtils.isEmpty(name)) {
|
||||||
search sea = (search) getSupportFragmentManager().findFragmentById(R.id.search_fragment);
|
// search sea = (search) getSupportFragmentManager().findFragmentById(R.id.search_fragment);
|
||||||
binding.searchFragment.setVisibility(View.VISIBLE);
|
// binding.searchFragment.setVisibility(View.VISIBLE);
|
||||||
sea.sx(name);
|
// sea.sx(name);
|
||||||
// addSearchRecordd(name);
|
// addSearchRecordd(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
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.DiskCacheStrategy;
|
||||||
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.RequestOptions;
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
|
@ -63,6 +64,7 @@ public class AdapterGd extends RecyclerView.Adapter<VH<ListGdBinding>> {
|
||||||
Glide.with(holder.itemView.getContext())
|
Glide.with(holder.itemView.getContext())
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.load(xm.picurl)
|
.load(xm.picurl)
|
||||||
|
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||||
.addListener(new RequestListener<Bitmap>() {
|
.addListener(new RequestListener<Bitmap>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Bitmap> target, boolean isFirstResource) {
|
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Bitmap> target, boolean isFirstResource) {
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
package com.muqingbfq.adapter;
|
package com.muqingbfq.adapter;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Filter;
|
||||||
|
import android.widget.Filterable;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.media3.common.MediaItem;
|
import androidx.media3.common.MediaItem;
|
||||||
import androidx.media3.common.Player;
|
import androidx.media3.common.Player;
|
||||||
|
@ -26,15 +31,58 @@ import com.muqingbfq.mq.gj;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class AdapterMp3 extends RecyclerView.Adapter<VH<ListMp3ImageBinding>> {
|
public class AdapterMp3 extends RecyclerView.Adapter<VH<ListMp3ImageBinding>> implements Filterable {
|
||||||
public List<MP3> list = new ArrayList<>();
|
public List<MP3> list = new ArrayList<>();
|
||||||
|
private List<MP3> list_ys;
|
||||||
|
private Activity activity;
|
||||||
|
|
||||||
public AdapterMp3() {
|
public AdapterMp3() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AdapterMp3(Activity activity) {
|
||||||
|
this.activity = activity;
|
||||||
|
}
|
||||||
|
|
||||||
public AdapterMp3(List<MP3> list) {
|
public AdapterMp3(List<MP3> list) {
|
||||||
this.list = list;
|
this.list = list;
|
||||||
|
list_ys = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Filter getFilter() {
|
||||||
|
return new Filter() {
|
||||||
|
@Override
|
||||||
|
protected FilterResults performFiltering(CharSequence charSequence) {
|
||||||
|
String charString = charSequence.toString();
|
||||||
|
if (charString.isEmpty()) {
|
||||||
|
//没有过滤的内容,则使用源数据
|
||||||
|
list = list_ys;
|
||||||
|
} else {
|
||||||
|
List<MP3> filteredList = new ArrayList<>();
|
||||||
|
for (int i = 0; i < list_ys.size(); i++) {
|
||||||
|
MP3 mp3 = list_ys.get(i);
|
||||||
|
if (mp3.name.contains(charString)
|
||||||
|
|| mp3.zz.contains(charString)) {
|
||||||
|
filteredList.add(list_ys.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list = filteredList;
|
||||||
|
}
|
||||||
|
|
||||||
|
FilterResults filterResults = new FilterResults();
|
||||||
|
filterResults.values = list;
|
||||||
|
return filterResults;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
protected void publishResults(CharSequence charSequence, FilterResults filterResults) {
|
||||||
|
list = (List<MP3>) filterResults.values;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
@ -44,6 +92,38 @@ public class AdapterMp3 extends RecyclerView.Adapter<VH<ListMp3ImageBinding>> {
|
||||||
LayoutInflater.from(parent.getContext()), parent, false));
|
LayoutInflater.from(parent.getContext()), parent, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 定义全局监听器
|
||||||
|
private final Player.Listener playerListener = new Player.Listener() {
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
@Override
|
||||||
|
public void onMediaItemTransition(@Nullable MediaItem mediaItem, int reason) {
|
||||||
|
if (mediaItem != null) {
|
||||||
|
notifyDataSetChanged();
|
||||||
|
Log.d("RecyclerView", "切换到新音乐: " + mediaItem.mediaId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
|
||||||
|
super.onAttachedToRecyclerView(recyclerView);
|
||||||
|
if (activity == null && PlaybackService.mediaSession != null) {
|
||||||
|
|
||||||
|
PlaybackService.mediaSession.getPlayer().addListener(playerListener);
|
||||||
|
}
|
||||||
|
Log.d("RecyclerView", "Adapter 绑定到 RecyclerView");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDetachedFromRecyclerView(@NonNull RecyclerView recyclerView) {
|
||||||
|
super.onDetachedFromRecyclerView(recyclerView);
|
||||||
|
if (activity == null && PlaybackService.mediaSession != null) {
|
||||||
|
PlaybackService.mediaSession.getPlayer().removeListener(playerListener);
|
||||||
|
}
|
||||||
|
Log.d("RecyclerView", "Adapter 从 RecyclerView 解绑");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull VH<ListMp3ImageBinding> holder, int position) {
|
public void onBindViewHolder(@NonNull VH<ListMp3ImageBinding> holder, int position) {
|
||||||
|
@ -69,7 +149,7 @@ public class AdapterMp3 extends RecyclerView.Adapter<VH<ListMp3ImageBinding>> {
|
||||||
holder.binding.text1.setText(String.valueOf(position + 1));
|
holder.binding.text1.setText(String.valueOf(position + 1));
|
||||||
holder.binding.imageView.setVisibility(ViewGroup.GONE);
|
holder.binding.imageView.setVisibility(ViewGroup.GONE);
|
||||||
holder.binding.linsum.setVisibility(View.VISIBLE);
|
holder.binding.linsum.setVisibility(View.VISIBLE);
|
||||||
}else{
|
} else {
|
||||||
Glide.with(holder.itemView.getContext()).load(list.get(position).picurl)
|
Glide.with(holder.itemView.getContext()).load(list.get(position).picurl)
|
||||||
.apply(new RequestOptions().placeholder(R.drawable.ic_launcher_foreground))
|
.apply(new RequestOptions().placeholder(R.drawable.ic_launcher_foreground))
|
||||||
.error(R.drawable.ic_launcher_foreground)
|
.error(R.drawable.ic_launcher_foreground)
|
||||||
|
@ -92,7 +172,7 @@ public class AdapterMp3 extends RecyclerView.Adapter<VH<ListMp3ImageBinding>> {
|
||||||
MediaItem currentItem = player.getMediaItemAt(i);
|
MediaItem currentItem = player.getMediaItemAt(i);
|
||||||
if (currentItem.mediaId.equals(hq.id)) {
|
if (currentItem.mediaId.equals(hq.id)) {
|
||||||
gj.sc("存在播放:" + currentItem.mediaId + "==" + hq.id + " i=" + i);
|
gj.sc("存在播放:" + currentItem.mediaId + "==" + hq.id + " i=" + i);
|
||||||
player.seekTo(i,0);
|
player.seekTo(i, 0);
|
||||||
player.prepare();
|
player.prepare();
|
||||||
player.play();
|
player.play();
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
|
@ -103,8 +183,8 @@ public class AdapterMp3 extends RecyclerView.Adapter<VH<ListMp3ImageBinding>> {
|
||||||
PlaybackService.list.add(hq);
|
PlaybackService.list.add(hq);
|
||||||
PlaybackService.ListSave();
|
PlaybackService.ListSave();
|
||||||
MediaItem mediaItem = PlaybackService.GetMp3(hq);
|
MediaItem mediaItem = PlaybackService.GetMp3(hq);
|
||||||
player.addMediaItem(0,mediaItem);
|
player.addMediaItem(0, mediaItem);
|
||||||
player.seekTo(0,0);
|
player.seekTo(0, 0);
|
||||||
player.prepare();
|
player.prepare();
|
||||||
player.play();
|
player.play();
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class FileDownloader {
|
||||||
public void downloadFile(MP3 x) {
|
public void downloadFile(MP3 x) {
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url(main.api + url.api + "?id=" + x.id + "&level=" +
|
.url(main.api + url.api + "?id=" + x.id + "&level=" +
|
||||||
"standard" + "&cookie=" + wl.Cookie)
|
"standard")
|
||||||
.build();
|
.build();
|
||||||
client.newCall(request).enqueue(new Callback() {
|
client.newCall(request).enqueue(new Callback() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -28,15 +28,13 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class playlist extends Thread {
|
public class playlist extends Thread {
|
||||||
public static final String api = "/playlist/track/all?id=";
|
public static final String api = "/playlist/track/all";
|
||||||
|
|
||||||
public static String gethq(String uid) {
|
public static String gethq(String uid) {
|
||||||
if (wj.cz(wj.filesdri + "user.mq")) {
|
return wl.hq(api,new String[][]{
|
||||||
return wl.hq(api + uid + "&limit=100" + "&cookie=" + wl.Cookie);
|
{"id", uid},
|
||||||
// gj.sc(hq);
|
{"limit", "100"}
|
||||||
} else {
|
});
|
||||||
return wl.hq(api + uid + "&limit=100");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hq(List<MP3> list, String uid) {
|
public static boolean hq(List<MP3> list, String uid) {
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class resource {
|
||||||
try {
|
try {
|
||||||
list.clear();
|
list.clear();
|
||||||
JSONObject json;
|
JSONObject json;
|
||||||
String hq = wl.hq("/recommend/resource?cookie=" + wl.Cookie);
|
String hq = wl.hq("/recommend/resource",null);
|
||||||
if (hq == null) {
|
if (hq == null) {
|
||||||
hq = wj.dqwb(wj.gd_json);
|
hq = wj.dqwb(wj.gd_json);
|
||||||
if (hq != null) {
|
if (hq != null) {
|
||||||
|
@ -81,7 +81,7 @@ public class resource {
|
||||||
if (wj.cz(wj.gd_phb)) {
|
if (wj.cz(wj.gd_phb)) {
|
||||||
hq = wj.dqwb(wj.gd_phb);
|
hq = wj.dqwb(wj.gd_phb);
|
||||||
} else {
|
} else {
|
||||||
hq = wl.hq("/toplist");
|
hq = wl.hq("/toplist", null);
|
||||||
if (hq == null) {
|
if (hq == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,11 @@ public class url extends Thread {
|
||||||
if (wiFiConnected) {
|
if (wiFiConnected) {
|
||||||
level = "exhigh";
|
level = "exhigh";
|
||||||
}
|
}
|
||||||
String hq = wl.hq(api + "?id=" + mp3.id + "&level=" +
|
String hq = wl.hq(api,
|
||||||
level + "&cookie=" + wl.Cookie);
|
new String[][]{
|
||||||
|
{"id", mp3.id},
|
||||||
|
{"level", level}
|
||||||
|
});
|
||||||
if (hq == null) {
|
if (hq == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -87,22 +90,30 @@ public class url extends Thread {
|
||||||
com.muqingbfq.bfqkz.lrc = id3v2Tag.getLyrics();
|
com.muqingbfq.bfqkz.lrc = id3v2Tag.getLyrics();
|
||||||
}
|
}
|
||||||
if (com.muqingbfq.bfqkz.lrc == null) {
|
if (com.muqingbfq.bfqkz.lrc == null) {
|
||||||
com.muqingbfq.bfqkz.lrc = wl.hq("/lyric?id=" + id);
|
com.muqingbfq.bfqkz.lrc = wl.hq("/lyric",new String[][]{
|
||||||
|
{"id", id}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gj.sc("url getlrc:" + e);
|
gj.sc("url getlrc:" + e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
com.muqingbfq.bfqkz.lrc = wl.hq("/lyric?id=" + id);
|
com.muqingbfq.bfqkz.lrc = wl.hq("/lyric",new String[][]{
|
||||||
|
{"id", id}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String Lrc(String id) {
|
public static String Lrc(String id) {
|
||||||
return wl.hq("/lyric?id=" + id);
|
return wl.hq("/lyric",new String[][]{
|
||||||
|
{"id", id}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String picurl(String id) {
|
public static String picurl(String id) {
|
||||||
String hq = wl.hq("/song/detail?ids=" + id);
|
String hq = wl.hq("/song/detail",new String[][]{
|
||||||
|
{"ids", id}
|
||||||
|
});
|
||||||
try {
|
try {
|
||||||
return new JSONObject(hq).getJSONArray("songs").getJSONObject(0)
|
return new JSONObject(hq).getJSONArray("songs").getJSONObject(0)
|
||||||
.getJSONObject("al").getString("picUrl");
|
.getJSONObject("al").getString("picUrl");
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class gd extends FragmentActivity<ActivityGdBinding> {
|
||||||
|
|
||||||
binding.fragmentDb.post(() -> {
|
binding.fragmentDb.post(() -> {
|
||||||
int height = binding.fragmentDb.getHeight();
|
int height = binding.fragmentDb.getHeight();
|
||||||
binding.lb.setPadding(0,0,0,height);
|
binding.lb.setPadding(0, 0, 0, height);
|
||||||
});
|
});
|
||||||
new start(id);
|
new start(id);
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,14 @@ public class gd extends FragmentActivity<ActivityGdBinding> {
|
||||||
if (id.equals("排行榜")) {
|
if (id.equals("排行榜")) {
|
||||||
resource.leaderboard(adapter.list);
|
resource.leaderboard(adapter.list);
|
||||||
} else {
|
} else {
|
||||||
String hq = wl.hq("/search?keywords=" + id + "&limit=" + (k * 3) + "&type=1000");
|
|
||||||
|
String hq = wl.hq("/search", new String[][]{
|
||||||
|
{"keywords", id},
|
||||||
|
{"limit", String.valueOf((k * 3))},
|
||||||
|
{"type", "1000"}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
// "keywords=" + id + "&limit=" + (k * 3) + "&type=1000"
|
||||||
try {
|
try {
|
||||||
JSONArray jsonArray = new JSONObject(hq).getJSONObject("result")
|
JSONArray jsonArray = new JSONObject(hq).getJSONObject("result")
|
||||||
.getJSONArray("playlists");
|
.getJSONArray("playlists");
|
||||||
|
|
|
@ -35,39 +35,33 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class gd_adapter extends Fragment<FragmentGdBinding> {
|
public class gd_adapter extends Fragment<FragmentGdBinding> {
|
||||||
List<XM> list = new ArrayList<>();
|
AdapterMp3 adapterMp3;
|
||||||
AdapterMp3 adapterMp3 = new AdapterMp3();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected FragmentGdBinding inflateViewBinding(LayoutInflater inflater, ViewGroup container) {
|
protected FragmentGdBinding inflateViewBinding(LayoutInflater inflater, ViewGroup container) {
|
||||||
return FragmentGdBinding.inflate(inflater, container, false);
|
return FragmentGdBinding.inflate(inflater, container, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
AdapterGd adapterGd = new AdapterGd();
|
AdapterGd adapterGd;
|
||||||
@Override
|
@Override
|
||||||
public void setUI(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
public void setUI(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||||
@Nullable Bundle savedInstanceState) {
|
@Nullable Bundle savedInstanceState) {
|
||||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext(),LinearLayoutManager.HORIZONTAL,false);
|
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext(),LinearLayoutManager.HORIZONTAL,false);
|
||||||
binding.recyclerview1.setHasFixedSize(true);
|
|
||||||
binding.recyclerview1.setNestedScrollingEnabled(false);
|
|
||||||
binding.recyclerview1.setLayoutManager(linearLayoutManager);
|
binding.recyclerview1.setLayoutManager(linearLayoutManager);
|
||||||
adapterGd.list = list;
|
adapterGd = new AdapterGd();
|
||||||
binding.recyclerview1.setAdapter(adapterGd);
|
binding.recyclerview1.setAdapter(adapterGd);
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
super.run();
|
super.run();
|
||||||
resource.recommend(list);
|
resource.recommend(adapterGd.list);
|
||||||
main.handler.post(new sx());
|
main.handler.post(new sx());
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
|
|
||||||
mp3list();
|
adapterMp3 = new AdapterMp3();
|
||||||
binding.recyclerview2.setLayoutManager(new LinearLayoutManager(getContext()));
|
binding.recyclerview2.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
binding.recyclerview2.setNestedScrollingEnabled(false);
|
|
||||||
binding.recyclerview2.setAdapter(adapterMp3);
|
binding.recyclerview2.setAdapter(adapterMp3);
|
||||||
|
mp3list();
|
||||||
// requireActivity().findViewById(R.id.linearLayout4).post(new Runnable() {
|
// requireActivity().findViewById(R.id.linearLayout4).post(new Runnable() {
|
||||||
// @Override
|
// @Override
|
||||||
// public void run() {
|
// public void run() {
|
||||||
|
@ -91,7 +85,7 @@ public class gd_adapter extends Fragment<FragmentGdBinding> {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
super.run();
|
super.run();
|
||||||
String hq = wl.hq("/recommend/songs" + "?cookie=" + wl.Cookie);
|
String hq = wl.hq("/recommend/songs", null);
|
||||||
if (hq == null) {
|
if (hq == null) {
|
||||||
hq = wj.dqwb(wj.filesdri + "songs.json");
|
hq = wj.dqwb(wj.filesdri + "songs.json");
|
||||||
}
|
}
|
||||||
|
@ -127,4 +121,10 @@ public class gd_adapter extends Fragment<FragmentGdBinding> {
|
||||||
public void Gdlist() {
|
public void Gdlist() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
binding.recyclerview2.setAdapter(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ import jp.wasabeef.glide.transformations.BlurTransformation;
|
||||||
public class mp3 extends FragmentActivity<ActivityMp3Binding> {
|
public class mp3 extends FragmentActivity<ActivityMp3Binding> {
|
||||||
private final List<MP3> list = new ArrayList<>();
|
private final List<MP3> list = new ArrayList<>();
|
||||||
private List<MP3> list_ys = new ArrayList<>();
|
private List<MP3> list_ys = new ArrayList<>();
|
||||||
public Adapter adapter;
|
public AdapterMp3 adapter;
|
||||||
|
|
||||||
public static void start(Activity context, String[] str, View view) {
|
public static void start(Activity context, String[] str, View view) {
|
||||||
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(context,
|
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(context,
|
||||||
|
@ -136,7 +136,7 @@ public class mp3 extends FragmentActivity<ActivityMp3Binding> {
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
binding.title.setText(intent.getStringExtra("name"));
|
binding.title.setText(intent.getStringExtra("name"));
|
||||||
String id = intent.getStringExtra("id");
|
String id = intent.getStringExtra("id");
|
||||||
adapter = new Adapter(list);
|
adapter = new AdapterMp3(list);
|
||||||
binding.lb.setLayoutManager(new LinearLayoutManager(this));
|
binding.lb.setLayoutManager(new LinearLayoutManager(this));
|
||||||
binding.lb.setAdapter(adapter);
|
binding.lb.setAdapter(adapter);
|
||||||
new start(id);
|
new start(id);
|
||||||
|
@ -304,58 +304,6 @@ public class mp3 extends FragmentActivity<ActivityMp3Binding> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Adapter extends AdapterMp3 implements Filterable {
|
|
||||||
|
|
||||||
private final List<MP3> list_ys;
|
|
||||||
|
|
||||||
public Adapter(List<MP3> list) {
|
|
||||||
this.list = list;
|
|
||||||
list_ys = list;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBindViewHolder(@NonNull VH<ListMp3ImageBinding> holder, int position) {
|
|
||||||
super.onBindViewHolder(holder, position);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Filter getFilter() {
|
|
||||||
return new Filter() {
|
|
||||||
@Override
|
|
||||||
protected FilterResults performFiltering(CharSequence charSequence) {
|
|
||||||
String charString = charSequence.toString();
|
|
||||||
if (charString.isEmpty()) {
|
|
||||||
//没有过滤的内容,则使用源数据
|
|
||||||
list = list_ys;
|
|
||||||
} else {
|
|
||||||
List<MP3> filteredList = new ArrayList<>();
|
|
||||||
for (int i = 0; i < list_ys.size(); i++) {
|
|
||||||
MP3 mp3 = list_ys.get(i);
|
|
||||||
if (mp3.name.contains(charString)
|
|
||||||
|| mp3.zz.contains(charString)) {
|
|
||||||
filteredList.add(list_ys.get(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
list = filteredList;
|
|
||||||
}
|
|
||||||
|
|
||||||
FilterResults filterResults = new FilterResults();
|
|
||||||
filterResults.values = list;
|
|
||||||
return filterResults;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
protected void publishResults(CharSequence charSequence, FilterResults filterResults) {
|
|
||||||
list = (List<MP3>) filterResults.values;
|
|
||||||
notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void startactivity(Context context, String id) {
|
public static void startactivity(Context context, String id) {
|
||||||
context.startActivity(new Intent(context, mp3.class).putExtra("id", id));
|
context.startActivity(new Intent(context, mp3.class).putExtra("id", id));
|
||||||
}
|
}
|
||||||
|
@ -363,6 +311,11 @@ public class mp3 extends FragmentActivity<ActivityMp3Binding> {
|
||||||
@Override
|
@Override
|
||||||
public void finish() {
|
public void finish() {
|
||||||
super.finish();
|
super.finish();
|
||||||
adapter = null;
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
binding.lb.setAdapter(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.muqingbfq.fragment;
|
package com.muqingbfq.fragment;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -9,9 +10,13 @@ import android.view.ViewGroup;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||||
|
import androidx.viewpager2.widget.ViewPager2;
|
||||||
|
|
||||||
|
import com.google.android.material.tabs.TabLayout;
|
||||||
import com.google.android.material.tabs.TabLayoutMediator;
|
import com.google.android.material.tabs.TabLayoutMediator;
|
||||||
import com.muqingbfq.MP3;
|
import com.muqingbfq.MP3;
|
||||||
import com.muqingbfq.XM;
|
import com.muqingbfq.XM;
|
||||||
|
@ -30,29 +35,27 @@ import java.text.DecimalFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class search extends Fragment {
|
public class search {
|
||||||
public FragmentSearchBinding binding;
|
|
||||||
public String string;
|
public String string;
|
||||||
List<Fragment> fragments=new ArrayList<>();
|
List<Fragment> fragments = new ArrayList<>();
|
||||||
@Nullable
|
TabLayout tablayout;
|
||||||
@Override
|
ViewPager2 viewPager2;
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
FragmentActivity activity;
|
||||||
@Nullable Bundle savedInstanceState) {
|
|
||||||
binding = FragmentSearchBinding.inflate(inflater, container, false);
|
|
||||||
binding.viewPager.setSaveEnabled(false);
|
|
||||||
adapter = new FragmentStateAdapter(this) {
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public Fragment createFragment(int position) {
|
|
||||||
return fragments.get(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public search(FragmentActivity activity, TabLayout tabLayout, ViewPager2 viewPager2) {
|
||||||
public int getItemCount() {
|
this.tablayout = tabLayout;
|
||||||
return fragments.size();
|
this.viewPager2 = viewPager2;
|
||||||
|
this.activity = activity;
|
||||||
|
tabLayoutMediator = new TabLayoutMediator(tablayout, viewPager2, (tab, position) -> {
|
||||||
|
switch (position) {
|
||||||
|
case 0:
|
||||||
|
tab.setText("歌曲");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
tab.setText("歌单");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
return binding.getRoot();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class mp3 extends Fragment {
|
public static class mp3 extends Fragment {
|
||||||
|
@ -63,16 +66,19 @@ public class search extends Fragment {
|
||||||
fragment.setArguments(args);
|
fragment.setArguments(args);
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RecyclerVBinding binding;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||||
@Nullable Bundle savedInstanceState) {
|
@Nullable Bundle savedInstanceState) {
|
||||||
List<MP3> list = new ArrayList<>();
|
|
||||||
String string = getArguments().getString("string");
|
String string = getArguments().getString("string");
|
||||||
RecyclerVBinding binding = RecyclerVBinding.inflate(inflater, container, false);
|
binding = RecyclerVBinding.inflate(inflater, container, false);
|
||||||
binding.recycleview.setLayoutManager(new LinearLayoutManager(getContext()));
|
binding.recycleview.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
binding.recycleview.setAdapter(new AdapterMp3(list));
|
AdapterMp3 adapterMp3 = new AdapterMp3();
|
||||||
list.clear();
|
binding.recycleview.setAdapter(adapterMp3);
|
||||||
|
adapterMp3.list.clear();
|
||||||
binding.recyclerviewBar.setVisibility(View.VISIBLE);
|
binding.recyclerviewBar.setVisibility(View.VISIBLE);
|
||||||
binding.recyclerviewText.setVisibility(View.GONE);
|
binding.recyclerviewText.setVisibility(View.GONE);
|
||||||
new Thread() {
|
new Thread() {
|
||||||
|
@ -80,10 +86,10 @@ public class search extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
super.run();
|
super.run();
|
||||||
mp3(list, string);
|
mp3(adapterMp3.list, string);
|
||||||
main.handler.post(() -> {
|
main.handler.post(() -> {
|
||||||
binding.recyclerviewBar.setVisibility(View.GONE);
|
binding.recyclerviewBar.setVisibility(View.GONE);
|
||||||
if (list.isEmpty()) {
|
if (adapterMp3.list.isEmpty()) {
|
||||||
binding.recyclerviewText.setVisibility(View.VISIBLE);
|
binding.recyclerviewText.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
binding.recyclerviewText.setVisibility(View.GONE);
|
binding.recyclerviewText.setVisibility(View.GONE);
|
||||||
|
@ -94,7 +100,14 @@ public class search extends Fragment {
|
||||||
}.start();
|
}.start();
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
binding.recycleview.setAdapter(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class gd extends Fragment {
|
public static class gd extends Fragment {
|
||||||
public static gd newInstance(String string) {
|
public static gd newInstance(String string) {
|
||||||
gd fragment = new gd();
|
gd fragment = new gd();
|
||||||
|
@ -103,6 +116,7 @@ public class search extends Fragment {
|
||||||
fragment.setArguments(args);
|
fragment.setArguments(args);
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||||
|
@ -135,19 +149,41 @@ public class search extends Fragment {
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private FragmentStateAdapter adapter;
|
|
||||||
|
TabLayoutMediator tabLayoutMediator;
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
public void sx(String string) {
|
public void sx(String string) {
|
||||||
this.string = string;
|
this.string = string;
|
||||||
fragments.clear();
|
delete();
|
||||||
fragments.add(mp3.newInstance(string));
|
// viewPager2.setAdapter(null);
|
||||||
fragments.add(gd.newInstance(string));
|
viewPager2.setAdapter(new FragmentStateAdapter(activity) {
|
||||||
binding.viewPager.setAdapter(adapter);
|
@NonNull
|
||||||
adapter.notifyDataSetChanged();
|
@Override
|
||||||
String[] strtab = new String[]{"歌曲", "歌单"};
|
public Fragment createFragment(int position) {
|
||||||
//将tabbView绑定到tab
|
switch (position) {
|
||||||
new TabLayoutMediator(binding.tablayout, binding.viewPager, (tab, position) ->
|
case 0:
|
||||||
tab.setText(strtab[position])).attach();
|
return mp3.newInstance(string);
|
||||||
|
case 1:
|
||||||
|
return gd.newInstance(string);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 确保只有一个 TabLayoutMediator 被附加
|
||||||
|
if (!tabLayoutMediator.isAttached()) {
|
||||||
|
tabLayoutMediator.attach(); // 仅在没有附加时才附加
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete() {
|
||||||
|
tabLayoutMediator.detach();
|
||||||
|
viewPager2.setAdapter(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void mp3(List<MP3> list, String str) {
|
private static void mp3(List<MP3> list, String str) {
|
||||||
|
@ -158,7 +194,7 @@ public class search extends Fragment {
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
gj.sc(e);
|
gj.sc(e);
|
||||||
}
|
}
|
||||||
String hq = wl.hq("/search?keywords=" + str + "&type=1");
|
String hq = wl.hq("/search", "keywords=" + str + "&type=1", false);
|
||||||
try {
|
try {
|
||||||
JSONArray jsonArray = new JSONObject(hq).getJSONObject("result")
|
JSONArray jsonArray = new JSONObject(hq).getJSONObject("result")
|
||||||
.getJSONArray("songs");
|
.getJSONArray("songs");
|
||||||
|
@ -189,7 +225,7 @@ public class search extends Fragment {
|
||||||
private static void gd(List<XM> list, String str) {
|
private static void gd(List<XM> list, String str) {
|
||||||
try {
|
try {
|
||||||
Long.parseLong(str);
|
Long.parseLong(str);
|
||||||
String hq = wl.hq("/playlist/detail?id=" + str);
|
String hq = wl.hq("/playlist/detail", "id=" + str, false);
|
||||||
JSONObject js = new JSONObject(hq).getJSONObject("playlist");
|
JSONObject js = new JSONObject(hq).getJSONObject("playlist");
|
||||||
String id = js.getString("id");
|
String id = js.getString("id");
|
||||||
String name = js.getString("name");
|
String name = js.getString("name");
|
||||||
|
@ -201,7 +237,7 @@ public class search extends Fragment {
|
||||||
gj.sc(e);
|
gj.sc(e);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
String hq = wl.hq("/search?keywords=" + str + "&type=1000");
|
String hq = wl.hq("/search", "keywords=" + str + "&type=1000", false);
|
||||||
JSONArray jsonArray = new JSONObject(hq).getJSONObject("result")
|
JSONArray jsonArray = new JSONObject(hq).getJSONObject("result")
|
||||||
.getJSONArray("playlists");
|
.getJSONArray("playlists");
|
||||||
int length = jsonArray.length();
|
int length = jsonArray.length();
|
||||||
|
|
|
@ -26,7 +26,6 @@ import com.muqingbfq.api.playlist;
|
||||||
import com.muqingbfq.api.resource;
|
import com.muqingbfq.api.resource;
|
||||||
import com.muqingbfq.databinding.FragmentWdBinding;
|
import com.muqingbfq.databinding.FragmentWdBinding;
|
||||||
import com.muqingbfq.login.user_logs;
|
import com.muqingbfq.login.user_logs;
|
||||||
import com.muqingbfq.login.visitor;
|
|
||||||
import com.muqingbfq.main;
|
import com.muqingbfq.main;
|
||||||
import com.muqingbfq.mq.EditViewDialog;
|
import com.muqingbfq.mq.EditViewDialog;
|
||||||
import com.muqingbfq.mq.Fragment;
|
import com.muqingbfq.mq.Fragment;
|
||||||
|
@ -94,13 +93,13 @@ public class wode extends Fragment<FragmentWdBinding> {
|
||||||
Intent a = new Intent(getContext(), com.muqingbfq.fragment.mp3.class);
|
Intent a = new Intent(getContext(), com.muqingbfq.fragment.mp3.class);
|
||||||
a.putExtra("id", data);
|
a.putExtra("id", data);
|
||||||
a.putExtra("name", s);
|
a.putExtra("name", s);
|
||||||
getContext().startActivity(a);
|
requireContext().startActivity(a);
|
||||||
break;
|
break;
|
||||||
case "排行榜":
|
case "排行榜":
|
||||||
gd.start(getActivity(), new String[]{data, s});
|
gd.start(getActivity(), new String[]{data, s});
|
||||||
break;
|
break;
|
||||||
case "API":
|
case "API":
|
||||||
EditViewDialog editViewDialog = new EditViewDialog(getContext(), "更换接口API")
|
EditViewDialog editViewDialog = new EditViewDialog(requireContext(), "更换接口API")
|
||||||
.setMessage("当前接口:\n" + main.api);
|
.setMessage("当前接口:\n" + main.api);
|
||||||
editViewDialog.setPositive(view1 -> {
|
editViewDialog.setPositive(view1 -> {
|
||||||
String str = editViewDialog.getEditText();
|
String str = editViewDialog.getEditText();
|
||||||
|
@ -116,7 +115,7 @@ public class wode extends Fragment<FragmentWdBinding> {
|
||||||
}).show();
|
}).show();
|
||||||
break;
|
break;
|
||||||
case "gd":
|
case "gd":
|
||||||
EditViewDialog editViewDialog1 = new EditViewDialog(getContext(),
|
EditViewDialog editViewDialog1 = new EditViewDialog(requireContext(),
|
||||||
"导入歌单")
|
"导入歌单")
|
||||||
.setMessage("请用网易云https链接来进行导入或者歌单id");
|
.setMessage("请用网易云https链接来进行导入或者歌单id");
|
||||||
editViewDialog1.setPositive(view1 -> {
|
editViewDialog1.setPositive(view1 -> {
|
||||||
|
@ -180,12 +179,12 @@ public class wode extends Fragment<FragmentWdBinding> {
|
||||||
if (result.getResultCode() == Activity.RESULT_OK) {
|
if (result.getResultCode() == Activity.RESULT_OK) {
|
||||||
// 处理返回结果
|
// 处理返回结果
|
||||||
Intent data = result.getData();
|
Intent data = result.getData();
|
||||||
boolean bool = data.getBooleanExtra("bool", false);
|
if (data != null) {
|
||||||
if (bool) {
|
boolean bool = data.getBooleanExtra("bool", false);
|
||||||
// gj.sc("dl");
|
if (bool) {
|
||||||
new threadLogin().start();
|
new threadLogin().start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// ...
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -195,7 +194,7 @@ public class wode extends Fragment<FragmentWdBinding> {
|
||||||
File file = new File(wj.filesdri, "user.mq");
|
File file = new File(wj.filesdri, "user.mq");
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
String[] a = new String[]{"退出登录"};
|
String[] a = new String[]{"退出登录"};
|
||||||
new MaterialAlertDialogBuilder(getContext())
|
new MaterialAlertDialogBuilder(requireContext())
|
||||||
.setItems(a, (dialogInterface, i) -> {
|
.setItems(a, (dialogInterface, i) -> {
|
||||||
boolean delete = file.delete();
|
boolean delete = file.delete();
|
||||||
if (delete) {
|
if (delete) {
|
||||||
|
@ -203,7 +202,6 @@ public class wode extends Fragment<FragmentWdBinding> {
|
||||||
binding.text1.setText(getString(R.string.app_name));
|
binding.text1.setText(getString(R.string.app_name));
|
||||||
binding.text2.setText(getString(R.string.app_name));
|
binding.text2.setText(getString(R.string.app_name));
|
||||||
imageView.setImageResource(R.drawable.ic_launcher_foreground);
|
imageView.setImageResource(R.drawable.ic_launcher_foreground);
|
||||||
new visitor();//游客模式
|
|
||||||
wj.sc(wj.filesdri + "user.mq");
|
wj.sc(wj.filesdri + "user.mq");
|
||||||
// new com.muqingbfq.login.user_message();
|
// new com.muqingbfq.login.user_message();
|
||||||
}
|
}
|
||||||
|
@ -215,7 +213,7 @@ public class wode extends Fragment<FragmentWdBinding> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class VH extends RecyclerView.ViewHolder {
|
private static class VH extends RecyclerView.ViewHolder {
|
||||||
public ImageView imageView;
|
public ImageView imageView;
|
||||||
public TextView textView;
|
public TextView textView;
|
||||||
|
|
||||||
|
@ -230,7 +228,7 @@ public class wode extends Fragment<FragmentWdBinding> {
|
||||||
class threadLogin extends Thread {
|
class threadLogin extends Thread {
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
String hq = wl.hq("/user/account?cookie=" + wl.Cookie);
|
String hq = wl.hq("/user/account", null);
|
||||||
if (hq != null) {
|
if (hq != null) {
|
||||||
try {
|
try {
|
||||||
JSONObject jsonObject = new JSONObject(hq);
|
JSONObject jsonObject = new JSONObject(hq);
|
||||||
|
@ -243,7 +241,7 @@ public class wode extends Fragment<FragmentWdBinding> {
|
||||||
requireActivity().runOnUiThread(() -> {
|
requireActivity().runOnUiThread(() -> {
|
||||||
binding.text1.setText(nickname);
|
binding.text1.setText(nickname);
|
||||||
binding.text2.setText(signature);
|
binding.text2.setText(signature);
|
||||||
Glide.with(getContext())
|
Glide.with(requireContext())
|
||||||
.load(avatarUrl)
|
.load(avatarUrl)
|
||||||
.error(R.drawable.ic_launcher_foreground)
|
.error(R.drawable.ic_launcher_foreground)
|
||||||
.into(binding.imageView);
|
.into(binding.imageView);
|
||||||
|
@ -262,7 +260,7 @@ public class wode extends Fragment<FragmentWdBinding> {
|
||||||
requireActivity().runOnUiThread(() -> {
|
requireActivity().runOnUiThread(() -> {
|
||||||
binding.text1.setText(user.name);
|
binding.text1.setText(user.name);
|
||||||
binding.text2.setText(user.qianming);
|
binding.text2.setText(user.qianming);
|
||||||
Glide.with(getContext())
|
Glide.with(requireContext())
|
||||||
.load(user.picUrl)
|
.load(user.picUrl)
|
||||||
.error(R.drawable.ic_launcher_foreground)
|
.error(R.drawable.ic_launcher_foreground)
|
||||||
.into(binding.imageView);
|
.into(binding.imageView);
|
||||||
|
|
|
@ -9,7 +9,6 @@ import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.FrameLayout;
|
|
||||||
|
|
||||||
import androidx.activity.EdgeToEdge;
|
import androidx.activity.EdgeToEdge;
|
||||||
import androidx.activity.OnBackPressedCallback;
|
import androidx.activity.OnBackPressedCallback;
|
||||||
|
@ -22,7 +21,6 @@ import androidx.fragment.app.Fragment;
|
||||||
import androidx.media3.session.MediaController;
|
import androidx.media3.session.MediaController;
|
||||||
import androidx.media3.session.SessionToken;
|
import androidx.media3.session.SessionToken;
|
||||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||||
import androidx.viewpager2.widget.ViewPager2;
|
|
||||||
|
|
||||||
import com.google.android.flexbox.AlignItems;
|
import com.google.android.flexbox.AlignItems;
|
||||||
import com.google.android.flexbox.FlexDirection;
|
import com.google.android.flexbox.FlexDirection;
|
||||||
|
@ -41,7 +39,6 @@ import com.muqingbfq.fragment.sz;
|
||||||
import com.muqingbfq.fragment.wode;
|
import com.muqingbfq.fragment.wode;
|
||||||
import com.muqingbfq.mq.AppCompatActivity;
|
import com.muqingbfq.mq.AppCompatActivity;
|
||||||
import com.muqingbfq.mq.gj;
|
import com.muqingbfq.mq.gj;
|
||||||
import com.muqingbfq.mq.wl;
|
|
||||||
import com.muqingbfq.view.Edit;
|
import com.muqingbfq.view.Edit;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
|
@ -69,14 +66,7 @@ public class home extends AppCompatActivity<ActivityHomeBinding> {
|
||||||
controllerFuture.addListener(() -> {
|
controllerFuture.addListener(() -> {
|
||||||
|
|
||||||
}, MoreExecutors.directExecutor());
|
}, MoreExecutors.directExecutor());
|
||||||
if (Strings.isNullOrEmpty(main.api) || Strings.isNullOrEmpty(wl.Cookie)) {
|
new HomeSteer(this, this::UI);
|
||||||
new HomeSteer(this) {
|
|
||||||
@Override
|
|
||||||
public void Yes() {
|
|
||||||
UI();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
} else UI();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -97,7 +87,7 @@ public class home extends AppCompatActivity<ActivityHomeBinding> {
|
||||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
// v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
// v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
v.setPadding(systemBars.left, 0, systemBars.right, 0);
|
v.setPadding(systemBars.left, 0, systemBars.right, 0);
|
||||||
binding.chb.setPadding(0, systemBars.top, 0, 0);
|
binding.chb.setPadding(0, systemBars.top, 0, systemBars.bottom);
|
||||||
return insets;
|
return insets;
|
||||||
});
|
});
|
||||||
// viewTop=binding.
|
// viewTop=binding.
|
||||||
|
@ -184,17 +174,19 @@ public class home extends AppCompatActivity<ActivityHomeBinding> {
|
||||||
|
|
||||||
public boolean issearchclicklist = false;//是否点击了列表项目
|
public boolean issearchclicklist = false;//是否点击了列表项目
|
||||||
//搜索建议列表
|
//搜索建议列表
|
||||||
private List<String> searchList = new ArrayList<>();
|
private final List<String> searchList = new ArrayList<>();
|
||||||
|
|
||||||
private activity_search.SearchRecordAdapter searchRecordAdapter;
|
private activity_search.SearchRecordAdapter searchRecordAdapter;
|
||||||
|
|
||||||
public void SearchUI() {
|
public void SearchUI() {
|
||||||
|
search search = new search(this, binding.searchTablayout, binding.searchViewPager);
|
||||||
binding.searchview
|
binding.searchview
|
||||||
.getEditText()
|
.getEditText()
|
||||||
.setOnEditorActionListener(
|
.setOnEditorActionListener(
|
||||||
(v, actionId, event) -> {
|
(v, actionId, event) -> {
|
||||||
// binding.searchview.hide();
|
// binding.searchview.hide();
|
||||||
searchStart(binding.toolbar.getText().toString());
|
|
||||||
|
searchStart(search, binding.toolbar.getText().toString());
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
binding.searchview.setOnMenuItemClickListener(
|
binding.searchview.setOnMenuItemClickListener(
|
||||||
|
@ -216,11 +208,6 @@ public class home extends AppCompatActivity<ActivityHomeBinding> {
|
||||||
// Handle search view opened.
|
// Handle search view opened.
|
||||||
gj.sc("SHOWING");
|
gj.sc("SHOWING");
|
||||||
binding.tablayout.setVisibility(View.GONE);
|
binding.tablayout.setVisibility(View.GONE);
|
||||||
// 添加 Fragment
|
|
||||||
getSupportFragmentManager()
|
|
||||||
.beginTransaction()
|
|
||||||
.replace(binding.searchFragment.getId(), new search())
|
|
||||||
.commit();
|
|
||||||
searchRecordAdapter = new activity_search.SearchRecordAdapter(binding.searchview);
|
searchRecordAdapter = new activity_search.SearchRecordAdapter(binding.searchview);
|
||||||
binding.listRecycler.setAdapter(searchRecordAdapter);
|
binding.listRecycler.setAdapter(searchRecordAdapter);
|
||||||
} else if (newState == SearchView.TransitionState.SHOWN) {
|
} else if (newState == SearchView.TransitionState.SHOWN) {
|
||||||
|
@ -235,10 +222,7 @@ public class home extends AppCompatActivity<ActivityHomeBinding> {
|
||||||
binding.searchRecycler.setVisibility(View.GONE);
|
binding.searchRecycler.setVisibility(View.GONE);
|
||||||
binding.xxbj1.setVisibility(View.VISIBLE);
|
binding.xxbj1.setVisibility(View.VISIBLE);
|
||||||
// 移除当前显示的 Fragment
|
// 移除当前显示的 Fragment
|
||||||
getSupportFragmentManager().beginTransaction()
|
search.delete();
|
||||||
.remove(getSupportFragmentManager()
|
|
||||||
.findFragmentById(binding.searchFragment.getId()))
|
|
||||||
.commit();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
final Object o = new Object();
|
final Object o = new Object();
|
||||||
|
@ -256,7 +240,7 @@ public class home extends AppCompatActivity<ActivityHomeBinding> {
|
||||||
synchronized (o) {
|
synchronized (o) {
|
||||||
searchList.clear();
|
searchList.clear();
|
||||||
String hq = com.muqingbfq.mq.wl.
|
String hq = com.muqingbfq.mq.wl.
|
||||||
hq("/search/suggest?keywords=" + var1.toString() + "&type=mobile");
|
hq("/search/suggest", "keywords=" + var1.toString() + "&type=mobile", false);
|
||||||
try {
|
try {
|
||||||
JSONArray jsonArray = new JSONObject(hq).getJSONObject("result")
|
JSONArray jsonArray = new JSONObject(hq).getJSONObject("result")
|
||||||
.getJSONArray("allMatch");
|
.getJSONArray("allMatch");
|
||||||
|
@ -274,7 +258,7 @@ public class home extends AppCompatActivity<ActivityHomeBinding> {
|
||||||
binding.xxbj1.setVisibility(View.GONE);
|
binding.xxbj1.setVisibility(View.GONE);
|
||||||
binding.searchFragment.setVisibility(View.VISIBLE);
|
binding.searchFragment.setVisibility(View.VISIBLE);
|
||||||
binding.searchview.setText(string);
|
binding.searchview.setText(string);
|
||||||
searchStart(string);
|
searchStart(search,string);
|
||||||
// binding.searchRecycler.set
|
// binding.searchRecycler.set
|
||||||
})));
|
})));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -316,14 +300,13 @@ public class home extends AppCompatActivity<ActivityHomeBinding> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void searchStart(String name) {
|
public void searchStart(search search, String name) {
|
||||||
issearchclicklist = true;
|
issearchclicklist = true;
|
||||||
binding.toolbar.setText(binding.searchview.getText());
|
binding.toolbar.setText(binding.searchview.getText());
|
||||||
if (!TextUtils.isEmpty(name)) {
|
if (!TextUtils.isEmpty(name)) {
|
||||||
search sea = (search) getSupportFragmentManager().findFragmentById(binding.searchFragment.getId());
|
|
||||||
binding.searchFragment.setVisibility(View.VISIBLE);
|
binding.searchFragment.setVisibility(View.VISIBLE);
|
||||||
binding.searchRecycler.setVisibility(View.GONE);
|
binding.searchRecycler.setVisibility(View.GONE);
|
||||||
sea.sx(name);
|
search.sx(name);
|
||||||
activity_search.addSearchRecord(name, searchRecordAdapter.json_list, searchRecordAdapter);
|
activity_search.addSearchRecord(name, searchRecordAdapter.json_list, searchRecordAdapter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,11 +57,11 @@ public class user_logs extends AppCompatActivity<ActivityUserLogsBinding> {
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
binding.login.setOnClickListener(view1 -> {
|
binding.login.setOnClickListener(view1 -> {
|
||||||
if (!TextUtils.isEmpty(binding.editUser.getText())) {
|
if (!TextUtils.isEmpty(binding.editUser.getText())) {
|
||||||
wl.setcookie(binding.editUser.getText().toString());
|
// wl.setcookie(binding.editUser.getText().toString());
|
||||||
}
|
}
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
gj.sc(wl.Cookie);
|
// gj.sc(wl.Cookie);
|
||||||
String hq = wl.hq("/login/status?cookie=" + wl.Cookie);
|
String hq = wl.hq("/login/status", null);
|
||||||
try {
|
try {
|
||||||
JSONObject jsonObject = new JSONObject(hq);
|
JSONObject jsonObject = new JSONObject(hq);
|
||||||
JSONObject data = jsonObject.getJSONObject("data");
|
JSONObject data = jsonObject.getJSONObject("data");
|
||||||
|
@ -138,7 +138,7 @@ public class user_logs extends AppCompatActivity<ActivityUserLogsBinding> {
|
||||||
}
|
}
|
||||||
user_logs.this.account = binding.editUser.getText().toString();
|
user_logs.this.account = binding.editUser.getText().toString();
|
||||||
gj.xcts(user_logs.this, "设置成功");
|
gj.xcts(user_logs.this, "设置成功");
|
||||||
wl.setcookie(account);
|
// wl.setcookie(account);
|
||||||
finish();
|
finish();
|
||||||
// start();
|
// start();
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ public class user_logs extends AppCompatActivity<ActivityUserLogsBinding> {
|
||||||
public void run() {
|
public void run() {
|
||||||
super.run();
|
super.run();
|
||||||
try {
|
try {
|
||||||
String hq = wl.hq("/login/cellphone?phone=" + account + "&password=" + password);
|
String hq = wl.hq("/login/cellphone", "phone=" + account + "&password=" + password, false);
|
||||||
if (TextUtils.isEmpty(hq)) {
|
if (TextUtils.isEmpty(hq)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ public class user_logs extends AppCompatActivity<ActivityUserLogsBinding> {
|
||||||
while (code != 0 && !Thread.currentThread().isInterrupted()) {
|
while (code != 0 && !Thread.currentThread().isInterrupted()) {
|
||||||
gj.sc(code);
|
gj.sc(code);
|
||||||
try {
|
try {
|
||||||
hq = wl.hq("/login/qr/check?key=" + unikey + Time());
|
hq = wl.hq("/login/qr/check", "key=" + unikey + Time(), false);
|
||||||
if (hq != null) {
|
if (hq != null) {
|
||||||
JSONObject json = new JSONObject(hq);
|
JSONObject json = new JSONObject(hq);
|
||||||
code = json.getInt("code");
|
code = json.getInt("code");
|
||||||
|
@ -207,7 +207,7 @@ public class user_logs extends AppCompatActivity<ActivityUserLogsBinding> {
|
||||||
break;
|
break;
|
||||||
case 803:
|
case 803:
|
||||||
setwb("登录成功");
|
setwb("登录成功");
|
||||||
wl.setcookie(json.getString("cookie"));
|
// wl.setcookie(json.getString("cookie"));
|
||||||
code = 0;
|
code = 0;
|
||||||
user_logs.this.finish(true);
|
user_logs.this.finish(true);
|
||||||
break;
|
break;
|
||||||
|
@ -226,11 +226,11 @@ public class user_logs extends AppCompatActivity<ActivityUserLogsBinding> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hqkey() throws Exception {
|
private void hqkey() throws Exception {
|
||||||
unikey = new JSONObject(Objects.requireNonNull(wl.hq("/login/qr/key"))).
|
unikey = new JSONObject(Objects.requireNonNull(wl.hq("/login/qr/key", null, false))).
|
||||||
getJSONObject("data").getString("unikey");
|
getJSONObject("data").getString("unikey");
|
||||||
JSONObject jsonObject = new JSONObject(Objects.requireNonNull(wl.hq("/login/qr/create?key=" +
|
JSONObject jsonObject = new JSONObject(Objects.requireNonNull(wl.hq("/login/qr/create", "key=" +
|
||||||
unikey +
|
unikey +
|
||||||
"&qrimg=base64")));
|
"&qrimg=base64", false)));
|
||||||
qrimg = jsonObject.getJSONObject("data").getString("qrimg");
|
qrimg = jsonObject.getJSONObject("data").getString("qrimg");
|
||||||
main.handler.post(() -> binding.image.setImageBitmap(user_logs.stringToBitmap(qrimg)));
|
main.handler.post(() -> binding.image.setImageBitmap(user_logs.stringToBitmap(qrimg)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
package com.muqingbfq.login;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
|
|
||||||
import com.muqingbfq.mq.wj;
|
|
||||||
import com.muqingbfq.mq.wl;
|
|
||||||
import com.muqingbfq.yc;
|
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
public class visitor extends Thread {
|
|
||||||
public visitor() {
|
|
||||||
start();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
super.run();
|
|
||||||
String hq = wl.hq("/register/anonimous");
|
|
||||||
try {
|
|
||||||
JSONObject jsonObject = new JSONObject(hq);
|
|
||||||
wl.setcookie(jsonObject.getString("cookie"));
|
|
||||||
} catch (Exception e) {
|
|
||||||
com.muqingbfq.mq.gj.sc(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -62,21 +62,21 @@ public class main extends Application {
|
||||||
bj = true;
|
bj = true;
|
||||||
com.muqingbfq.bfqkz.ms = 1;
|
com.muqingbfq.bfqkz.ms = 1;
|
||||||
}
|
}
|
||||||
try {
|
// try {
|
||||||
wl.Cookie = sp.getString("Cookie", "");
|
// wl.Cookie = sp.getString("Cookie", "");
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
edit.putString("Cookie", "");
|
// edit.putString("Cookie", "");
|
||||||
wl.Cookie = "";
|
// wl.Cookie = "";
|
||||||
bj = true;
|
// bj = true;
|
||||||
}
|
// }
|
||||||
if (bj) {
|
// if (bj) {
|
||||||
edit.commit();
|
// edit.commit();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
wl.Cookie = main.sp.getString("Cookie", "");
|
// wl.Cookie = main.sp.getString("Cookie", "");
|
||||||
if (wl.Cookie.isEmpty()) {
|
// if (wl.Cookie.isEmpty()) {
|
||||||
new visitor();
|
// new visitor();
|
||||||
}
|
// }
|
||||||
SharedPreferences theme = getSharedPreferences("theme", MODE_PRIVATE);
|
SharedPreferences theme = getSharedPreferences("theme", MODE_PRIVATE);
|
||||||
@SuppressLint("CommitPrefEdits") SharedPreferences.Editor edit = theme.edit();
|
@SuppressLint("CommitPrefEdits") SharedPreferences.Editor edit = theme.edit();
|
||||||
int i = theme.getInt("theme", AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
|
int i = theme.getInt("theme", AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
|
|
|
@ -1,23 +1,19 @@
|
||||||
package com.muqingbfq.mq;
|
package com.muqingbfq.mq;
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.OptIn;
|
|
||||||
import androidx.media3.common.MediaItem;
|
|
||||||
import androidx.media3.common.util.UnstableApi;
|
|
||||||
import androidx.media3.database.DatabaseProvider;
|
|
||||||
import androidx.media3.database.StandaloneDatabaseProvider;
|
|
||||||
import androidx.media3.datasource.DataSource;
|
|
||||||
import androidx.media3.datasource.cache.Cache;
|
|
||||||
import androidx.media3.datasource.cache.CacheDataSource;
|
|
||||||
import androidx.media3.datasource.cache.LeastRecentlyUsedCacheEvictor;
|
|
||||||
import androidx.media3.datasource.cache.SimpleCache;
|
|
||||||
|
|
||||||
import com.muqingbfq.main;
|
import com.muqingbfq.main;
|
||||||
|
|
||||||
import java.io.File;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
import okhttp3.Cookie;
|
||||||
|
import okhttp3.CookieJar;
|
||||||
|
import okhttp3.HttpUrl;
|
||||||
import okhttp3.MultipartBody;
|
import okhttp3.MultipartBody;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
|
@ -31,16 +27,43 @@ public class wl {
|
||||||
main.edit.putString("Cookie", cookie);
|
main.edit.putString("Cookie", cookie);
|
||||||
main.edit.commit();
|
main.edit.commit();
|
||||||
}
|
}
|
||||||
public static void getCookie(){
|
|
||||||
|
public static void getCookie() {
|
||||||
Cookie = main.sp.getString("Cookie", "");
|
Cookie = main.sp.getString("Cookie", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String hq(String url) {
|
public static final ConcurrentHashMap<String, List<Cookie>> cookieStore = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
|
||||||
|
// 自定义 CookieJar 实现
|
||||||
|
private static class CustomCookieJar implements CookieJar {
|
||||||
|
@Override
|
||||||
|
public void saveFromResponse(HttpUrl url, @NonNull List<Cookie> cookies) {
|
||||||
|
cookieStore.put(url.host(), cookies);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public List<Cookie> loadForRequest(HttpUrl url) {
|
||||||
|
return Objects.requireNonNull(cookieStore.getOrDefault(url.host(), new ArrayList<>()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final static OkHttpClient client = new OkHttpClient();
|
||||||
|
|
||||||
|
public static String hq(String url, String[][] strings) {
|
||||||
try {
|
try {
|
||||||
OkHttpClient client = new OkHttpClient();
|
StringBuilder stringBuffer = new StringBuilder();
|
||||||
|
if (strings != null) {
|
||||||
|
for (String[] b : strings) {
|
||||||
|
stringBuffer.append(b[0]).append("=").append(b[1]).append("&");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stringBuffer.append("cookie").append("=").append(Cookie);
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url(main.api + url)
|
.url(main.api + url + "?" + stringBuffer)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
Response response = client.newCall(request).execute();
|
Response response = client.newCall(request).execute();
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
return response.body().string();
|
return response.body().string();
|
||||||
|
@ -51,6 +74,24 @@ public class wl {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static String hq(String url, String strings, boolean bool) {
|
||||||
|
try {
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url(main.api + url + "?" + strings)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Response response = client.newCall(request).execute();
|
||||||
|
if (response.body() != null) {
|
||||||
|
return response.body().string();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
gj.sc("wl hq(Strnig) " + e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String post(String str, String[][] a) {
|
public static String post(String str, String[][] a) {
|
||||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||||
.build();
|
.build();
|
||||||
|
@ -59,7 +100,7 @@ public class wl {
|
||||||
for (String[] b : a) {
|
for (String[] b : a) {
|
||||||
builder.addFormDataPart(b[0], b[1]);
|
builder.addFormDataPart(b[0], b[1]);
|
||||||
}
|
}
|
||||||
builder.addFormDataPart("cookie", Cookie);
|
// builder.addFormDataPart("cookie", Cookie);
|
||||||
|
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url(main.api + str)
|
.url(main.api + str)
|
||||||
|
@ -96,26 +137,4 @@ public class wl {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@OptIn(markerClass = UnstableApi.class)
|
|
||||||
public static DataSource.Factory DownMp3() {
|
|
||||||
Context context = main.application;
|
|
||||||
|
|
||||||
DatabaseProvider databaseProvider = new StandaloneDatabaseProvider(context);
|
|
||||||
// 创建一个 File 对象来指定缓存目录
|
|
||||||
File downloadDirectory = new File(wj.mp3);
|
|
||||||
// 如果缓存目录不存在,则创建它
|
|
||||||
if (!downloadDirectory.exists()) {
|
|
||||||
downloadDirectory.mkdirs();
|
|
||||||
}
|
|
||||||
Cache cache =
|
|
||||||
new SimpleCache(
|
|
||||||
downloadDirectory, new LeastRecentlyUsedCacheEvictor(100 * 1024 * 1024), databaseProvider);
|
|
||||||
|
|
||||||
CacheDataSource.Factory httpDataSourceFactory = new CacheDataSource.Factory();
|
|
||||||
return new CacheDataSource.Factory()
|
|
||||||
.setCache(cache)
|
|
||||||
.setUpstreamDataSourceFactory(httpDataSourceFactory);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@
|
||||||
android:layout_width="36dp"
|
android:layout_width="36dp"
|
||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:background="?android:attr/actionBarItemBackground"
|
||||||
android:src="@drawable/like"
|
android:src="@drawable/like"
|
||||||
app:tint="#CCCCCC"
|
app:tint="#CCCCCC"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
@ -166,7 +166,7 @@
|
||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:background="?android:attr/actionBarItemBackground"
|
||||||
android:src="@drawable/syq"
|
android:src="@drawable/syq"
|
||||||
app:tint="#CCCCCC"
|
app:tint="#CCCCCC"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
@ -176,7 +176,7 @@
|
||||||
android:layout_width="46dp"
|
android:layout_width="46dp"
|
||||||
android:layout_height="46dp"
|
android:layout_height="46dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:background="?android:attr/actionBarItemBackground"
|
||||||
android:src="@drawable/zt"
|
android:src="@drawable/zt"
|
||||||
app:tint="#CCCCCC"
|
app:tint="#CCCCCC"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
@ -187,7 +187,7 @@
|
||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:background="?android:attr/actionBarItemBackground"
|
||||||
android:importantForAccessibility="no"
|
android:importantForAccessibility="no"
|
||||||
android:src="@drawable/xyq"
|
android:src="@drawable/xyq"
|
||||||
app:tint="#CCCCCC" />
|
app:tint="#CCCCCC" />
|
||||||
|
@ -197,7 +197,7 @@
|
||||||
android:layout_width="36dp"
|
android:layout_width="36dp"
|
||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:background="?android:attr/actionBarItemBackground"
|
||||||
android:src="@drawable/gd"
|
android:src="@drawable/gd"
|
||||||
app:tint="#CCCCCC"
|
app:tint="#CCCCCC"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
@ -216,7 +216,7 @@
|
||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
android:layout_marginStart="6dp"
|
android:layout_marginStart="6dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:background="?android:attr/actionBarItemBackground"
|
||||||
android:src="@drawable/download"
|
android:src="@drawable/download"
|
||||||
app:tint="#CCCCCC"
|
app:tint="#CCCCCC"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
@ -227,7 +227,7 @@
|
||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:background="?android:attr/actionBarItemBackground"
|
||||||
android:src="@drawable/mt_sx"
|
android:src="@drawable/mt_sx"
|
||||||
app:tint="#CCCCCC"
|
app:tint="#CCCCCC"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
|
|
@ -40,21 +40,17 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:hint="@string/search"
|
android:hint="@string/search"
|
||||||
|
tools:visibility="visible"
|
||||||
app:layout_anchor="@id/toolbar">
|
app:layout_anchor="@id/toolbar">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:layout_weight="1"
|
|
||||||
android:transitionName="edit"
|
|
||||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/search_recycler"
|
android:id="@+id/search_recycler"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/xxbj1"
|
android:id="@+id/xxbj1"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -92,12 +88,36 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
<androidx.fragment.app.FragmentContainerView
|
|
||||||
android:id="@+id/search_fragment"
|
android:id="@+id/search_fragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:visibility="gone" />
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabLayout
|
||||||
|
android:id="@+id/search_tablayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#0000FFFF">
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="歌曲"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="歌单"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
</com.google.android.material.tabs.TabLayout>
|
||||||
|
|
||||||
|
<androidx.viewpager2.widget.ViewPager2
|
||||||
|
android:id="@+id/search_viewPager"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</com.google.android.material.search.SearchView>
|
</com.google.android.material.search.SearchView>
|
||||||
|
|
||||||
|
@ -119,12 +139,12 @@
|
||||||
|
|
||||||
<com.muqingbfq.view.TabLayout
|
<com.muqingbfq.view.TabLayout
|
||||||
android:id="@+id/tablayout"
|
android:id="@+id/tablayout"
|
||||||
|
style="@style/Widget.Material3.CardView.Filled"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
style="@style/Widget.Material3.CardView.Filled"
|
android:orientation="horizontal"
|
||||||
app:cardCornerRadius="0dp"
|
app:cardCornerRadius="0dp"
|
||||||
app:strokeWidth="0dp"
|
app:strokeWidth="0dp" />
|
||||||
android:orientation="horizontal" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
|
@ -2,12 +2,10 @@
|
||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:orientation="vertical">
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:fitsSystemWindows="true">
|
|
||||||
|
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
|
|
|
@ -108,17 +108,17 @@
|
||||||
android:theme="@null"
|
android:theme="@null"
|
||||||
android:thumb="@null"
|
android:thumb="@null"
|
||||||
app:layout_constraintBottom_toTopOf="@id/time_a"
|
app:layout_constraintBottom_toTopOf="@id/time_a"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"/>
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/time_a"
|
android:id="@+id/time_a"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
|
android:paddingStart="6dp"
|
||||||
android:text="@string/_00_00"
|
android:text="@string/_00_00"
|
||||||
android:textColor="@color/tint_image"
|
android:textColor="@color/tint_image"
|
||||||
android:paddingStart="6dp"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/linearLayout3"
|
app:layout_constraintBottom_toTopOf="@id/linearLayout3"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
tools:ignore="RtlSymmetry" />
|
tools:ignore="RtlSymmetry" />
|
||||||
|
@ -128,10 +128,10 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
|
android:paddingEnd="6dp"
|
||||||
android:text="@string/_00_00"
|
android:text="@string/_00_00"
|
||||||
android:textColor="@color/tint_image"
|
android:textColor="@color/tint_image"
|
||||||
app:layout_constraintBottom_toTopOf="@id/linearLayout3"
|
app:layout_constraintBottom_toTopOf="@id/linearLayout3"
|
||||||
android:paddingEnd="6dp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
tools:ignore="RtlSymmetry" />
|
tools:ignore="RtlSymmetry" />
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@
|
||||||
android:id="@+id/control"
|
android:id="@+id/control"
|
||||||
android:layout_width="36dp"
|
android:layout_width="36dp"
|
||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:background="?android:attr/actionBarItemBackground"
|
||||||
android:src="@drawable/mt_sx"
|
android:src="@drawable/mt_sx"
|
||||||
app:tint="@color/tint_image"
|
app:tint="@color/tint_image"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
@ -160,7 +160,7 @@
|
||||||
android:id="@+id/syq"
|
android:id="@+id/syq"
|
||||||
android:layout_width="36dp"
|
android:layout_width="36dp"
|
||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:background="?android:attr/actionBarItemBackground"
|
||||||
android:src="@drawable/syq"
|
android:src="@drawable/syq"
|
||||||
app:tint="@color/tint_image"
|
app:tint="@color/tint_image"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
@ -169,7 +169,7 @@
|
||||||
android:id="@+id/kg"
|
android:id="@+id/kg"
|
||||||
android:layout_width="66dp"
|
android:layout_width="66dp"
|
||||||
android:layout_height="66dp"
|
android:layout_height="66dp"
|
||||||
android:background="?selectableItemBackgroundBorderless"
|
android:background="?android:attr/actionBarItemBackground"
|
||||||
android:src="@drawable/zt"
|
android:src="@drawable/zt"
|
||||||
app:tint="@color/tint_image"
|
app:tint="@color/tint_image"
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@
|
||||||
android:id="@+id/xyq"
|
android:id="@+id/xyq"
|
||||||
android:layout_width="36dp"
|
android:layout_width="36dp"
|
||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:background="?android:attr/actionBarItemBackground"
|
||||||
android:src="@drawable/xyq"
|
android:src="@drawable/xyq"
|
||||||
app:tint="@color/tint_image"
|
app:tint="@color/tint_image"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
@ -188,7 +188,7 @@
|
||||||
android:id="@+id/bfq_list_mp3"
|
android:id="@+id/bfq_list_mp3"
|
||||||
android:layout_width="36dp"
|
android:layout_width="36dp"
|
||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:background="?android:attr/actionBarItemBackground"
|
||||||
android:src="@drawable/gd"
|
android:src="@drawable/gd"
|
||||||
app:tint="@color/tint_image"
|
app:tint="@color/tint_image"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
@ -207,18 +207,18 @@
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/download"
|
android:id="@+id/download"
|
||||||
android:layout_width="36dp"
|
android:layout_width="26dp"
|
||||||
android:layout_height="36dp"
|
android:layout_height="26dp"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:background="?android:attr/actionBarItemBackground"
|
||||||
android:src="@drawable/download"
|
android:src="@drawable/download"
|
||||||
app:tint="@color/tint_image"
|
app:tint="@color/tint_image"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/like"
|
android:id="@+id/like"
|
||||||
android:layout_width="36dp"
|
android:layout_width="26dp"
|
||||||
android:layout_height="36dp"
|
android:layout_height="26dp"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:background="?android:attr/actionBarItemBackground"
|
||||||
android:src="@drawable/like"
|
android:src="@drawable/like"
|
||||||
app:tint="@color/tint_image"
|
app:tint="@color/tint_image"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
|
|
@ -2,8 +2,9 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:paddingHorizontal="16dp"
|
android:paddingHorizontal="16dp"
|
||||||
|
android:paddingBottom="13dp"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
|
android:layout_marginStart="3dp"
|
||||||
android:text="@string/name"
|
android:text="@string/name"
|
||||||
android:textSize="13sp" />
|
android:textSize="13sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -29,11 +29,10 @@
|
||||||
app:cardElevation="0dp"
|
app:cardElevation="0dp"
|
||||||
app:cardUseCompatPadding="true">
|
app:cardUseCompatPadding="true">
|
||||||
|
|
||||||
<com.muqingbfq.view.RecyclerViewH
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recyclerview1"
|
android:id="@+id/recyclerview1"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:focusableInTouchMode="false"
|
|
||||||
android:nestedScrollingEnabled="false"
|
android:nestedScrollingEnabled="false"
|
||||||
tools:itemCount="6" />
|
tools:itemCount="6" />
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
@ -84,8 +83,8 @@
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recyclerview2"
|
android:id="@+id/recyclerview2"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:clipToPadding="false" />
|
android:nestedScrollingEnabled="false"/>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
Loading…
Reference in New Issue
Block a user