优化了部分UI,修复了歌单BUG,修复一些其余BUG

This commit is contained in:
muqing 2024-01-31 11:43:28 +08:00
parent ba6d8dcedc
commit 8e13e2fcd5
26 changed files with 387 additions and 258 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>

View File

@ -1,10 +1,15 @@
<component name="InspectionProjectProfileManager"> <component name="InspectionProjectProfileManager">
<profile version="1.0"> <profile version="1.0">
<option name="myName" value="Project Default" /> <option name="myName" value="Project Default" />
<inspection_tool class="AndroidLintHardcodedText" enabled="true" level="WARNING" enabled_by_default="true" editorAttributes="WARNING_ATTRIBUTES" />
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,android.content.res.Resources.Theme,obtainStyledAttributes" />
</inspection_tool>
<inspection_tool class="DataFlowIssue" enabled="false" level="WARNING" enabled_by_default="false"> <inspection_tool class="DataFlowIssue" enabled="false" level="WARNING" enabled_by_default="false">
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" /> <option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" />
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false" /> <option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false" />
</inspection_tool> </inspection_tool>
<inspection_tool class="FieldMayBeFinal" enabled="true" level="INFORMATION" enabled_by_default="true" />
<inspection_tool class="InnerClassMayBeStatic" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="InnerClassMayBeStatic" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false"> <inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" /> <option name="processCode" value="true" />

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK" /> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK" />

View File

@ -18,7 +18,7 @@ android {
//noinspection OldTargetApi //noinspection OldTargetApi
targetSdk 31 targetSdk 31
versionCode 1 versionCode 1
versionName "1.9.6" versionName "1.9.7"
} }
compileOptions { compileOptions {

View File

@ -61,6 +61,9 @@ public class activity_search extends FragmentActivity {
//设置是否换行 //设置是否换行
manager.setFlexWrap(FlexWrap.WRAP); manager.setFlexWrap(FlexWrap.WRAP);
manager.setAlignItems(AlignItems.STRETCH); manager.setAlignItems(AlignItems.STRETCH);
// binding.searchRecycler.setBackgroundColor(gj.getbackgroundColor(this));
binding.listRecycler.setLayoutManager(manager); binding.listRecycler.setLayoutManager(manager);
binding.listRecycler.setAdapter(new SearchRecordAdapter()); binding.listRecycler.setAdapter(new SearchRecordAdapter());
@ -196,7 +199,7 @@ public class activity_search extends FragmentActivity {
search sea = (search) getSupportFragmentManager().findFragmentById(R.id.search_fragment); search sea = (search) getSupportFragmentManager().findFragmentById(R.id.search_fragment);
if (!name.equals(sea.name)) { if (!name.equals(sea.name)) {
sea.i = 0; sea.i = 0;
sea.inflate.tablayout.getTabAt(0).select(); sea.binding.tablayout.getTabAt(0).select();
} }
sea.setVisibility(true); sea.setVisibility(true);
sea.setStart(name); sea.setStart(name);

View File

@ -12,6 +12,7 @@ import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.text.DecimalFormat;
import java.util.List; import java.util.List;
public class resource { public class resource {
@ -59,7 +60,18 @@ public class resource {
String id = js.getString("id"); String id = js.getString("id");
String name = js.getString("name"); String name = js.getString("name");
String coverImgUrl = js.getString("coverImgUrl"); String coverImgUrl = js.getString("coverImgUrl");
return new XM(id, name, coverImgUrl);
long playCount = js.getLong("playCount");
String formattedNumber = String.valueOf(playCount);
if (playCount > 9999) {
DecimalFormat df = new DecimalFormat("#,###.0万");
formattedNumber = df.format(playCount / 10000);
}
String s = js.getInt("trackCount") + "首,"
+ "by " + js.getJSONObject("creator").getString("nickname")
+ ",播放"
+ formattedNumber + "";
return new XM(id, name, s, coverImgUrl);
} }
// 排行榜 // 排行榜

View File

@ -136,4 +136,22 @@ public class bfq_an {
bfqkz.like_bool = contains; bfqkz.like_bool = contains;
bfq.setlike(contains); bfq.setlike(contains);
} }
public static boolean getlike(MP3 xm) {
boolean contains = false;
String dqwb = wj.dqwb(wj.gd + "mp3_like.json");
if (dqwb != null) {
try {
Type type = new TypeToken<List<MP3>>() {
}.getType();
List<MP3> o = new Gson().fromJson(dqwb, type);
if (o != null) {
contains = o.contains(xm);
}
} catch (Exception e) {
wj.sc(wj.gd + "mp3_like.json");
}
}
return contains;
}
} }

View File

@ -16,7 +16,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.muqingbfq.R; import com.muqingbfq.R;
import com.muqingbfq.databinding.CleanBinding; import com.muqingbfq.databinding.ActivityCleanBinding;
import com.muqingbfq.mq.FragmentActivity; import com.muqingbfq.mq.FragmentActivity;
import com.muqingbfq.mq.gj; import com.muqingbfq.mq.gj;
import com.muqingbfq.mq.wj; import com.muqingbfq.mq.wj;
@ -28,11 +28,11 @@ import java.util.List;
public class fragment_clean extends FragmentActivity { public class fragment_clean extends FragmentActivity {
List<String[]> list = new ArrayList<>(); List<String[]> list = new ArrayList<>();
List<String> list_box = new ArrayList<>(); List<String> list_box = new ArrayList<>();
CleanBinding binding; ActivityCleanBinding binding;
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
binding = CleanBinding.inflate(getLayoutInflater()); binding = ActivityCleanBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot()); setContentView(binding.getRoot());
UI(); UI();
} }

View File

@ -175,25 +175,18 @@ public class gd extends com.muqingbfq.mq.FragmentActivity {
@SuppressLint("NotifyDataSetChanged") @SuppressLint("NotifyDataSetChanged")
@Override @Override
public void run() { public void run() {
super.run();
String hq = playlist.gethq(xm.id); String hq = playlist.gethq(xm.id);
if (hq != null) { if (hq != null) {
wj.xrwb(wj.gd + xm.id, hq);
try { try {
JSONObject jsonObject = new JSONObject();
if (wj.cz(wj.gd_xz)) {
jsonObject = new JSONObject(Objects.requireNonNull(wj.dqwb(wj.gd_xz)));
}
XM fh = resource.Playlist_content(xm.id); XM fh = resource.Playlist_content(xm.id);
JSONObject json = new JSONObject(); JSONObject json = new JSONObject(hq);
json.put("name", fh.name); json.put("name", fh.name);
json.put("picUrl", fh.picurl); json.put("picUrl", fh.picurl);
jsonObject.put(fh.id, json); json.put("message", fh.message);
wj.xrwb(wj.gd_xz, jsonObject.toString()); // json.put(fh.id, json);
main.handler.post(() -> { wj.xrwb(wj.gd + xm.id, json.toString());
notifyItemChanged(position); wode.addlist(fh);
wode.addlist(xm); main.handler.post(() -> notifyItemChanged(position));
});
} catch (JSONException e) { } catch (JSONException e) {
gj.sc("list gd onclick thear " + e); gj.sc("list gd onclick thear " + e);
} }
@ -205,12 +198,9 @@ public class gd extends com.muqingbfq.mq.FragmentActivity {
// 删除项目 // 删除项目
try { try {
wj.sc(wj.gd + xm.id); wj.sc(wj.gd + xm.id);
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());
wode.removelist(xm); wode.removelist(xm);
} catch (JSONException e) { notifyItemRemoved(position);
} catch (Exception e) {
gj.sc(e); gj.sc(e);
} }
break; break;

View File

@ -1,12 +1,8 @@
package com.muqingbfq.fragment; package com.muqingbfq.fragment;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -24,13 +20,11 @@ import com.bumptech.glide.request.RequestOptions;
import com.muqingbfq.MP3; import com.muqingbfq.MP3;
import com.muqingbfq.R; import com.muqingbfq.R;
import com.muqingbfq.XM; import com.muqingbfq.XM;
import com.muqingbfq.activity_search;
import com.muqingbfq.api.resource; import com.muqingbfq.api.resource;
import com.muqingbfq.api.url; import com.muqingbfq.api.url;
import com.muqingbfq.bfqkz; import com.muqingbfq.bfqkz;
import com.muqingbfq.databinding.FragmentGdBinding; import com.muqingbfq.databinding.FragmentGdBinding;
import com.muqingbfq.databinding.ListMp3ImageBinding; import com.muqingbfq.databinding.ListMp3ImageBinding;
import com.muqingbfq.home;
import com.muqingbfq.main; import com.muqingbfq.main;
import com.muqingbfq.mq.gj; import com.muqingbfq.mq.gj;
import com.muqingbfq.mq.wj; import com.muqingbfq.mq.wj;
@ -47,13 +41,6 @@ public class gd_adapter extends Fragment {
List<MP3> listmp3 = new ArrayList<>(); List<MP3> listmp3 = new ArrayList<>();
FragmentGdBinding binding; FragmentGdBinding binding;
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setHasOptionsMenu(true);
// 其他初始化代码...
}
@Nullable @Nullable
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
@ -61,12 +48,14 @@ public class gd_adapter extends Fragment {
//初始化工具栏 //初始化工具栏
((AppCompatActivity) requireActivity()).setSupportActionBar(binding.toolbar); ((AppCompatActivity) requireActivity()).setSupportActionBar(binding.toolbar);
DrawerLayout drawerLayout = home.appCompatActivity.findViewById(R.id.chct); DrawerLayout drawerLayout = requireActivity().findViewById(R.id.chct);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
getActivity(), drawerLayout, binding.toolbar, R.string.app_name, R.string.app_name); getActivity(), drawerLayout, binding.toolbar, R.string.app_name, R.string.app_name);
drawerLayout.addDrawerListener(toggle); drawerLayout.addDrawerListener(toggle);
toggle.syncState(); toggle.syncState();
// setHasOptionsMenu(true);
binding.toolbar.setPadding(0, gj.getztl(getContext()), 0, 0); binding.toolbar.setPadding(0, gj.getztl(getContext()), 0, 0);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext()); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
@ -82,8 +71,6 @@ public class gd_adapter extends Fragment {
main.handler.post(new sx()); main.handler.post(new sx());
} }
}.start(); }.start();
binding.recyclerview2.setFocusable(false);
binding.recyclerview2.setLayoutManager(new LinearLayoutManager(getContext()){ binding.recyclerview2.setLayoutManager(new LinearLayoutManager(getContext()){
@Override @Override
public boolean canScrollVertically() { public boolean canScrollVertically() {
@ -152,24 +139,9 @@ public class gd_adapter extends Fragment {
@Override @Override
public void run() { public void run() {
binding.recyclerview1.getAdapter().notifyDataSetChanged(); binding.recyclerview1.getAdapter().notifyDataSetChanged();
binding.recyclerview1Bar.setVisibility(View.GONE);
} }
} }
@Override
public void onCreateOptionsMenu(@NonNull Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.home, menu);
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_search) {
Intent intent = new Intent(getContext(), activity_search.class);
startActivity(intent);
}
return super.onOptionsItemSelected(item);
}
public void mp3list() { public void mp3list() {
new Thread(){ new Thread(){
@SuppressLint("NotifyDataSetChanged") @SuppressLint("NotifyDataSetChanged")
@ -198,7 +170,10 @@ public class gd_adapter extends Fragment {
listmp3.add(new MP3(id, name, zz.toString(), picUrl)); listmp3.add(new MP3(id, name, zz.toString(), picUrl));
} }
wj.xrwb(wj.filesdri + "songs.josn", hq); wj.xrwb(wj.filesdri + "songs.josn", hq);
main.handler.post(() -> binding.recyclerview2.getAdapter().notifyDataSetChanged()); main.handler.post(() ->{
binding.recyclerview2.getAdapter().notifyDataSetChanged();
binding.recyclerview2Bar.setVisibility(View.GONE);
});
} catch (Exception e) { } catch (Exception e) {
gj.sc(e); gj.sc(e);
} }

View File

@ -21,18 +21,16 @@ import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import com.muqingbfq.MP3; import com.muqingbfq.MP3;
import com.muqingbfq.R; import com.muqingbfq.R;
import com.muqingbfq.XM;
import com.muqingbfq.api.FileDownloader; import com.muqingbfq.api.FileDownloader;
import com.muqingbfq.api.playlist; import com.muqingbfq.api.playlist;
import com.muqingbfq.api.resource;
import com.muqingbfq.api.url; import com.muqingbfq.api.url;
import com.muqingbfq.bfq; import com.muqingbfq.bfq;
import com.muqingbfq.bfq_an;
import com.muqingbfq.bfqkz; import com.muqingbfq.bfqkz;
import com.muqingbfq.databinding.FragmentMp3Binding; import com.muqingbfq.databinding.FragmentMp3Binding;
import com.muqingbfq.databinding.ListMp3Binding; import com.muqingbfq.databinding.ListMp3Binding;
@ -42,20 +40,17 @@ import com.muqingbfq.mq.FragmentActivity;
import com.muqingbfq.mq.gj; import com.muqingbfq.mq.gj;
import com.muqingbfq.mq.wj; import com.muqingbfq.mq.wj;
import org.json.JSONException;
import org.json.JSONObject;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
public class mp3 extends FragmentActivity { public class mp3 extends FragmentActivity {
private List<MP3> list = new ArrayList<>(); private List<MP3> list = new ArrayList<>();
private List<MP3> list_ys = new ArrayList<>(); private List<MP3> list_ys = new ArrayList<>();
public static adaper lbspq; public static adaper lbspq;
FragmentMp3Binding binding; FragmentMp3Binding binding;
// private static String id;
// private static String id;
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -88,7 +83,7 @@ public class mp3 extends FragmentActivity {
}); });
//添加Android自带的分割线 //添加Android自带的分割线
binding.lb.addItemDecoration( binding.lb.addItemDecoration(
new DividerItemDecoration(this,DividerItemDecoration.VERTICAL)); new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
} }
@Override @Override
@ -137,6 +132,7 @@ public class mp3 extends FragmentActivity {
String id; String id;
public start(String id) { public start(String id) {
binding.recyclerview1Bar.setVisibility(View.VISIBLE);
this.id = id; this.id = id;
list.clear(); list.clear();
list_ys.clear(); list_ys.clear();
@ -154,7 +150,15 @@ public class mp3 extends FragmentActivity {
playlist.hq(list, id); playlist.hq(list, id);
} }
list_ys = list; list_ys = list;
main.handler.post(new lbspq_sx()); main.handler.post(() -> {
lbspq.notifyDataSetChanged();
binding.recyclerview1Bar.setVisibility(View.GONE);
if (list.isEmpty()) {
binding.recyclerview1Text.setVisibility(View.VISIBLE);
} else {
binding.recyclerview1Text.setVisibility(View.GONE);
}
});
} }
} }
@ -170,16 +174,18 @@ public class mp3 extends FragmentActivity {
private List<MP3> list; private List<MP3> list;
private List<MP3> list_ys; private List<MP3> list_ys;
public adaper(List list) { public adaper(List list) {
this.list = list; this.list = list;
list_ys = list; list_ys = list;
} }
@NonNull @NonNull
@Override @Override
public MyViewHoder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public MyViewHoder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new MyViewHoder(ListMp3Binding.bind(LayoutInflater.from(parent.getContext()). return new MyViewHoder(ListMp3Binding.bind(LayoutInflater.from(parent.getContext()).
inflate(R.layout.list_mp3, inflate(R.layout.list_mp3,
parent, false))); parent, false)));
} }
@Override @Override
@ -204,15 +210,26 @@ public class mp3 extends FragmentActivity {
bfq.start(holder.getContext()); bfq.start(holder.getContext());
}); });
holder.itemView.setOnLongClickListener(view -> { holder.itemView.setOnLongClickListener(view -> {
String a[] = new String[]{"喜欢歌曲", "下载歌曲", "复制名字"}; List<String> stringList = new ArrayList<>();
boolean getlike = bfq_an.getlike(x);
if (getlike) {
stringList.add("取消喜欢");
} else {
stringList.add("喜欢歌曲");
}
if (!wj.cz(wj.mp3 + x.id)) {
stringList.add("下载歌曲");
}
stringList.add("复制名字");
String[] array = stringList.toArray(new String[0]);
new MaterialAlertDialogBuilder(view.getContext()). new MaterialAlertDialogBuilder(view.getContext()).
setItems(a, (dialog, id) -> { setItems(array, (dialog, id) -> {
String title = a[id]; switch (array[id]) {
switch (title) {
case "下载歌曲": case "下载歌曲":
new FileDownloader(view.getContext()).downloadFile(x); new FileDownloader(view.getContext()).downloadFile(x);
break; break;
case "喜欢歌曲": case "喜欢歌曲":
case "取消喜欢":
try { try {
Gson gson = new Gson(); Gson gson = new Gson();
Type type = new TypeToken<List<MP3>>() { Type type = new TypeToken<List<MP3>>() {
@ -221,16 +238,10 @@ public class mp3 extends FragmentActivity {
if (list == null) { if (list == null) {
list = new ArrayList<>(); list = new ArrayList<>();
} }
if (bfqkz.like_bool) { if (list.contains(x))
list.remove(bfqkz.xm); list.remove(x);
bfq.setlike(false); else
} else { list.add(x);
if (!list.contains(bfqkz.xm)) {
list.add(bfqkz.xm);
bfq.setlike(true);
}
}
bfqkz.like_bool = !bfqkz.like_bool;
wj.xrwb(wj.gd + "mp3_like.json", gson.toJson(list)); wj.xrwb(wj.gd + "mp3_like.json", gson.toJson(list));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -36,21 +36,16 @@ public class search extends Fragment {
List<XM> xmList = new ArrayList<>(); List<XM> xmList = new ArrayList<>();
public String name; public String name;
public FragmentSearchBinding inflate; public FragmentSearchBinding binding;
public int i = 0; public int i = 0;
@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) {
inflate = FragmentSearchBinding.inflate(inflater, container, false); binding = FragmentSearchBinding.inflate(inflater, container, false);
lbspq = new mp3.adaper(list); lbspq = new mp3.adaper(list);
View view = inflate.getRoot(); binding.tablayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
TypedValue typedValue = new TypedValue();
requireContext().getTheme().resolveAttribute(android.R.attr.windowBackground, typedValue, true);
// 设置背景颜色
view.setBackgroundColor(typedValue.data);
inflate.tablayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override @Override
public void onTabSelected(TabLayout.Tab tab) { public void onTabSelected(TabLayout.Tab tab) {
// 当用户再次选择已选择的选项卡时调用 // 当用户再次选择已选择的选项卡时调用
@ -71,14 +66,14 @@ public class search extends Fragment {
} }
}); });
setVisibility(false); setVisibility(false);
return view; return binding.getRoot();
} }
public void setVisibility(boolean bool) { public void setVisibility(boolean bool) {
if (bool) { if (bool) {
inflate.getRoot().setVisibility(View.VISIBLE); binding.getRoot().setVisibility(View.VISIBLE);
} else { } else {
inflate.getRoot().setVisibility(View.GONE); binding.getRoot().setVisibility(View.GONE);
} }
} }
@ -87,13 +82,13 @@ public class search extends Fragment {
public void setStart(String name) { public void setStart(String name) {
if (i == 0) { if (i == 0) {
new mp3.adaper(list); new mp3.adaper(list);
inflate.recyclerview.setLayoutManager(new LinearLayoutManager(getContext())); binding.recyclerview.setLayoutManager(new LinearLayoutManager(getContext()));
inflate.recyclerview.setAdapter(lbspq); binding.recyclerview.setAdapter(lbspq);
} else if (i == 1) { } else if (i == 1) {
k = (int) (main.k / getResources().getDisplayMetrics().density + 0.5f) / 120; k = (int) (main.k / getResources().getDisplayMetrics().density + 0.5f) / 120;
inflate.recyclerview.setLayoutManager(new LinearLayoutManager(getContext())); binding.recyclerview.setLayoutManager(new LinearLayoutManager(getContext()));
inflate.recyclerview.setAdapter(new gd.baseadapter(getContext(), binding.recyclerview.setAdapter(new gd.baseadapter(getContext(),
xmList, true, inflate.recyclerview)); xmList, true, binding.recyclerview));
} }
new start(name); new start(name);
@ -101,22 +96,33 @@ public class search extends Fragment {
public class start extends Thread { public class start extends Thread {
public start(String name) { public start(String name) {
binding.recyclerview1Bar.setVisibility(View.VISIBLE);
list.clear(); list.clear();
xmList.clear(); xmList.clear();
search.this.name = name; search.this.name = name;
start(); start();
} }
boolean load = false;
@SuppressLint("NotifyDataSetChanged") @SuppressLint("NotifyDataSetChanged")
@Override @Override
public void run() { public void run() {
super.run(); super.run();
if (i == 0) { if (i == 0) {
mp3(); mp3();
load = !list.isEmpty();
} else if (i == 1) { } else if (i == 1) {
gd(); gd();
load = !xmList.isEmpty();
} }
main.handler.post(() -> inflate.recyclerview.getAdapter().notifyDataSetChanged()); main.handler.post(() -> {
binding.recyclerview.getAdapter().notifyDataSetChanged();
binding.recyclerview1Bar.setVisibility(View.GONE);
if (load) {
binding.recyclerview1Text.setVisibility(View.GONE);
} else {
binding.recyclerview1Text.setVisibility(View.VISIBLE);
}
});
} }
} }
@ -178,21 +184,21 @@ public class search extends Fragment {
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i); JSONObject jsonObject = jsonArray.getJSONObject(i);
String id = jsonObject.getString("id"); String id = jsonObject.getString("id");
int trackCount = jsonObject.getInt("trackCount");
String nickname = "by " + jsonObject.getJSONObject("creator")
.getString("nickname");
long playCount = jsonObject.getLong("playCount");
String name = jsonObject.getString("name"); String name = jsonObject.getString("name");
String coverImgUrl = jsonObject.getString("coverImgUrl"); String coverImgUrl = jsonObject.getString("coverImgUrl");
// gj.sc(name);
long playCount = jsonObject.getLong("playCount");
String formattedNumber = String.valueOf(playCount); String formattedNumber = String.valueOf(playCount);
if (playCount > 9999) { if (playCount > 9999) {
DecimalFormat df = new DecimalFormat("#,###.0万"); DecimalFormat df = new DecimalFormat("#,###.0万");
formattedNumber = df.format(playCount / 10000); formattedNumber = df.format(playCount / 10000);
} }
xmList.add(new XM(id, name, trackCount + "首," + nickname + ",播放" String s = jsonObject.getInt("trackCount") + "首,"
+ formattedNumber + "", coverImgUrl)); + "by " + jsonObject.getJSONObject("creator").getString("nickname")
+ ",播放"
+ formattedNumber + "";
xmList.add(new XM(id, name, s, coverImgUrl));
} }
} catch (Exception e) { } catch (Exception e) {
gj.sc(e); gj.sc(e);

View File

@ -5,9 +5,6 @@ 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;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
@ -30,7 +27,6 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.muqingbfq.R; import com.muqingbfq.R;
import com.muqingbfq.XM; import com.muqingbfq.XM;
import com.muqingbfq.activity_search;
import com.muqingbfq.api.playlist; import com.muqingbfq.api.playlist;
import com.muqingbfq.api.resource; import com.muqingbfq.api.resource;
import com.muqingbfq.bfqkz; import com.muqingbfq.bfqkz;
@ -50,9 +46,7 @@ import org.json.JSONObject;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -75,14 +69,6 @@ public class wode extends Fragment {
}; };
@SuppressLint("StaticFieldLeak") @SuppressLint("StaticFieldLeak")
public static baseadapter adaper; public static baseadapter adaper;
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setHasOptionsMenu(true);
// 其他初始化代码...
}
@Nullable @Nullable
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@ -204,23 +190,17 @@ public class wode extends Fragment {
super.run(); super.run();
String hq = playlist.gethq(finalStr); String hq = playlist.gethq(finalStr);
if (hq != null) { if (hq != null) {
wj.xrwb(wj.gd + finalStr, hq);
try { try {
JSONObject jsonObject = new JSONObject();
if (wj.cz(wj.gd_xz)) {
jsonObject = new JSONObject(Objects.requireNonNull(wj.dqwb(wj.gd_xz)));
}
XM fh = resource.Playlist_content(finalStr); XM fh = resource.Playlist_content(finalStr);
JSONObject json = new JSONObject(); JSONObject json = new JSONObject(hq);
json.put("name", fh.name); json.put("name", fh.name);
json.put("picUrl", fh.picurl); json.put("picUrl", fh.picurl);
jsonObject.put(fh.id, json); json.put("message", fh.message);
wj.xrwb(wj.gd_xz, jsonObject.toString()); // json.put(fh.id, json);
sx(); wj.xrwb(wj.gd + finalStr, json.toString());
gj.xcts(getContext(), "成功"); addlist(fh);
} catch (JSONException e) { } catch (JSONException e) {
gj.sc("list gd onclick thear " + e); gj.sc("list gd onclick thear " + e);
gj.xcts(getContext(), "失败");
} }
} }
} }
@ -293,15 +273,28 @@ public class wode extends Fragment {
public void sx() { public void sx() {
try { try {
adaper.list.clear(); adaper.list.clear();
JSONObject date = new JSONObject(wj.dqwb(wj.gd_xz)); File file = new File(wj.gd);
for (Iterator<String> it = date.keys(); it.hasNext(); ) { for (File a : file.listFiles()) {
String id = it.next(); gj.sc(a);
JSONObject jsonObject = date.getJSONObject(id); String id = a.getName();
if (id.endsWith(".json")) {
return;
}
String dqwb = wj.dqwb(a.toString());
JSONObject jsonObject = new JSONObject(dqwb);
String name = jsonObject.getString("name"); String name = jsonObject.getString("name");
String picUrl = jsonObject.getString("picUrl"); String picUrl = jsonObject.getString("picUrl");
adaper.list.add(new XM(id, name, picUrl)); String message = jsonObject.getString("message");
adaper.list.add(new XM(id, name, message, picUrl));
} }
main.handler.post(() -> binding.recyclerview2.getAdapter().notifyDataSetChanged()); main.handler.post(() ->{
adaper.notifyDataSetChanged();
if (adaper.list.isEmpty()) {
binding.recyclerview2Text.setVisibility(View.VISIBLE);
} else {
binding.recyclerview2Text.setVisibility(View.GONE);
}
});
} catch (Exception e) { } catch (Exception e) {
gj.sc(e); gj.sc(e);
} }
@ -309,9 +302,10 @@ public class wode extends Fragment {
@SuppressLint("NotifyDataSetChanged") @SuppressLint("NotifyDataSetChanged")
public static void addlist(XM xm) { public static void addlist(XM xm) {
if (adaper != null&&!adaper.list.contains(xm)) { if (adaper != null) {
adaper.list.remove(xm);
adaper.list.add(xm); adaper.list.add(xm);
adaper.notifyDataSetChanged(); main.handler.post(() -> adaper.notifyDataSetChanged());
} }
} }
@ -351,98 +345,72 @@ public class wode extends Fragment {
.into(binding.imageView); .into(binding.imageView);
} }
@Override
public void onCreateOptionsMenu(@NonNull Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.home, menu);
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_search) {
Intent intent = new Intent(getContext(), activity_search.class);
startActivity(intent);
}
return super.onOptionsItemSelected(item);
}
class baseadapter extends RecyclerView.Adapter<gd.VH> { class baseadapter extends RecyclerView.Adapter<gd.VH> {
public List<XM> list = new ArrayList<>(); public List<XM> list = new ArrayList<>();
@NonNull @NonNull
@Override @Override
public gd.VH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public gd.VH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new gd.VH(ListGdBBinding.bind(LayoutInflater.from(getContext()) return new gd.VH(ListGdBBinding.bind(LayoutInflater.from(getContext())
.inflate(R.layout.list_gd_b, parent, false))); .inflate(R.layout.list_gd_b, parent, false)));
}
public void setList(List<XM> list) {
this.list = list;
} }
@Override @Override
public void onBindViewHolder(@NonNull gd.VH holder, @SuppressLint("RecyclerView") int position) { public void onBindViewHolder(@NonNull gd.VH holder, @SuppressLint("RecyclerView") int position) {
XM xm = list.get(position); XM xm = list.get(position);
holder.itemView.setOnClickListener(v -> { holder.itemView.setOnClickListener(v -> {
XM xm1 = list.get(position); XM xm1 = list.get(position);
Intent intent = new Intent(getContext(), mp3.class); Intent intent = new Intent(getContext(), mp3.class);
intent.putExtra("id", xm1.id); intent.putExtra("id", xm1.id);
intent.putExtra("name", xm1.name); intent.putExtra("name", xm1.name);
getContext().startActivity(intent); getContext().startActivity(intent);
}); });
holder.itemView.setOnLongClickListener(v -> { holder.itemView.setOnLongClickListener(v -> {
String[] stringArray = {"下载歌单", "删除歌单"}; String[] stringArray = {"下载歌单", "删除歌单"};
new MaterialAlertDialogBuilder(getContext()). new MaterialAlertDialogBuilder(getContext()).
setItems(stringArray, (dialog, id) -> { setItems(stringArray, (dialog, id) -> {
switch (stringArray[id]) { switch (stringArray[id]) {
case "下载歌单": case "下载歌单":
new Thread() { new Thread() {
@SuppressLint("NotifyDataSetChanged") @SuppressLint("NotifyDataSetChanged")
@Override @Override
public void run() { public void run() {
super.run(); super.run();
String hq = playlist.gethq(xm.id); String hq = playlist.gethq(xm.id);
if (hq != null) { if (hq != null) {
wj.xrwb(wj.gd + xm.id, hq); try {
try { XM fh = resource.Playlist_content(xm.id);
JSONObject jsonObject = new JSONObject(); JSONObject json = new JSONObject(hq);
if (wj.cz(wj.gd_xz)) { json.put("name", fh.name);
jsonObject = new JSONObject(Objects.requireNonNull(wj.dqwb(wj.gd_xz))); json.put("picUrl", fh.picurl);
} json.put("message", fh.message);
XM fh = resource.Playlist_content(xm.id); // json.put(fh.id, json);
JSONObject json = new JSONObject(); wj.xrwb(wj.gd + xm.id, json.toString());
json.put("name", fh.name); addlist(fh);
json.put("picUrl", fh.picurl); main.handler.post(() -> notifyItemChanged(position));
jsonObject.put(fh.id, json); } catch (JSONException e) {
wj.xrwb(wj.gd_xz, jsonObject.toString()); gj.sc("list gd onclick thear " + e);
main.handler.post(() -> notifyItemChanged(position));
} catch (JSONException e) {
gj.sc("list gd onclick thear " + e);
}
} }
} }
}.start();
break;
case "删除歌单":
// 删除项目
try {
wj.sc(wj.gd + xm.id);
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());
notifyItemRemoved(position);
} catch (JSONException e) {
gj.sc(e);
} }
break; }.start();
} break;
// 在这里处理菜单项的点击事件 case "删除歌单":
}).show(); // 删除项目
return false; try {
}); wj.sc(wj.gd + xm.id);
list.remove(xm);
notifyItemRemoved(position);
} catch (Exception e) {
gj.sc(e);
}
break;
}
// 在这里处理菜单项的点击事件
}).show();
return false;
});
holder.bindingB.text2.setText(xm.message); holder.bindingB.text2.setText(xm.message);
holder.title.setText(xm.name); holder.title.setText(xm.name);
holder.kg.setOnClickListener(view1 -> { holder.kg.setOnClickListener(view1 -> {
ImageView tx = (ImageView) view1; ImageView tx = (ImageView) view1;
@ -477,8 +445,14 @@ public class wode extends Fragment {
@Override @Override
public int getItemCount() { public int getItemCount() {
if (list.isEmpty()) {
binding.recyclerview2Text.setVisibility(View.VISIBLE);
} else {
binding.recyclerview2Text.setVisibility(View.GONE);
}
return list.size(); return list.size();
} }
} }
} }

View File

@ -3,10 +3,13 @@ package com.muqingbfq;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.media.MediaBrowserCompat; import android.support.v4.media.MediaBrowserCompat;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.view.Menu;
import android.view.MenuItem;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
@ -206,4 +209,23 @@ public class home extends AppCompatActivity {
mBrowser.disconnect(); mBrowser.disconnect();
} }
} }
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.home,menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_search) {
Intent intent = new Intent(getContext(), activity_search.class);
startActivity(intent);
}
return super.onOptionsItemSelected(item);
}
private Context getContext() {
return this;
}
} }

View File

@ -7,6 +7,7 @@ import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.TypedArray;
import android.net.Uri; import android.net.Uri;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
@ -14,6 +15,8 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.EditText; import android.widget.EditText;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.muqingbfq.main; import com.muqingbfq.main;
import com.muqingbfq.yc; import com.muqingbfq.yc;
@ -179,4 +182,15 @@ public class gj {
getIdentifier("status_bar_height", "dimen", "android"); getIdentifier("status_bar_height", "dimen", "android");
return context.getResources().getDimensionPixelSize(resourceId); return context.getResources().getDimensionPixelSize(resourceId);
} }
public static int getbackgroundColor(AppCompatActivity appCompatActivity) {
TypedArray array = appCompatActivity.getTheme().obtainStyledAttributes(new int[] {
android.R.attr.colorBackground
// android.R.attr.textColorPrimary,
});
int backgroundColor = array.getColor(0, 0xFF00FF);
// int textColor = array.getColor(1, 0xFF00FF);
array.recycle();
return backgroundColor;
}
} }

View File

@ -2,6 +2,7 @@ package com.muqingbfq.view;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.ColorStateList;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.graphics.drawable.RippleDrawable; import android.graphics.drawable.RippleDrawable;
@ -48,7 +49,7 @@ public class Edit extends LinearLayout {
private void initView() { private void initView() {
setGravity(Gravity.CENTER_VERTICAL); setGravity(Gravity.CENTER_VERTICAL);
setBackgroundResource(R.drawable.ui_editview); setBackgroundResource(R.drawable.ui_editview);
setPadding(30, 10, 30, 10); setPadding(30, 0, 30, 0);
//构建编辑框 //构建编辑框
editText = new EditText(getContext()); editText = new EditText(getContext());
editText.setHint("搜索"); editText.setHint("搜索");
@ -74,11 +75,12 @@ public class Edit extends LinearLayout {
ImageView imageView = new ImageView(getContext()); ImageView imageView = new ImageView(getContext());
imageView.setImageResource(R.drawable.sousuo); imageView.setImageResource(R.drawable.sousuo);
imageView.setImageTintList(ContextCompat.getColorStateList(getContext(),
R.color.text_tm));
addView(imageView, (int) TypedValue.applyDimension(TypedValue. addView(imageView, (int) TypedValue.applyDimension(TypedValue.
COMPLEX_UNIT_DIP, 26, getResources().getDisplayMetrics()) COMPLEX_UNIT_DIP, 26, getResources().getDisplayMetrics())
, (int) TypedValue.applyDimension(TypedValue. , (int) TypedValue.applyDimension(TypedValue.
COMPLEX_UNIT_DIP, 26, getResources().getDisplayMetrics())); COMPLEX_UNIT_DIP, 26, getResources().getDisplayMetrics()));
LayoutParams layoutParams = new LayoutParams( LayoutParams layoutParams = new LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT); ViewGroup.LayoutParams.WRAP_CONTENT);

View File

@ -21,7 +21,7 @@ public class RecyclerViewH extends RecyclerView {
public RecyclerViewH(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { public RecyclerViewH(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
} }
private boolean disallowIntercept = false; // private boolean disallowIntercept = false;
private int startX = 0; private int startX = 0;
private int startY = 0; private int startY = 0;
@ -43,7 +43,9 @@ public class RecyclerViewH extends RecyclerView {
if (Math.abs(disY) > ViewConfiguration.get(getContext()).getScaledTouchSlop()) { if (Math.abs(disY) > ViewConfiguration.get(getContext()).getScaledTouchSlop()) {
// 当前手指移动距离大于系统认定的最小滚动距离时不允许父容器拦截触摸事件 // 当前手指移动距离大于系统认定的最小滚动距离时不允许父容器拦截触摸事件
getParent().requestDisallowInterceptTouchEvent(true); getParent().requestDisallowInterceptTouchEvent(true);
}else } else {
break;
}
/* /*
if (disX > disY) { if (disX > disY) {
//为了解决RecyclerView嵌套RecyclerView时横向滑动的问题 //为了解决RecyclerView嵌套RecyclerView时横向滑动的问题
@ -55,7 +57,6 @@ public class RecyclerViewH extends RecyclerView {
} else { } else {
getParent().requestDisallowInterceptTouchEvent(true); getParent().requestDisallowInterceptTouchEvent(true);
}*/ }*/
break;
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_CANCEL:
getParent().requestDisallowInterceptTouchEvent(false); getParent().requestDisallowInterceptTouchEvent(false);
@ -66,7 +67,6 @@ public class RecyclerViewH extends RecyclerView {
} }
@Override @Override
public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) { public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
this.disallowIntercept = disallowIntercept;
super.requestDisallowInterceptTouchEvent(disallowIntercept); super.requestDisallowInterceptTouchEvent(disallowIntercept);
} }

View File

@ -3,7 +3,8 @@
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"> android:orientation="vertical"
android:fitsSystemWindows="true">
<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"

View File

@ -62,9 +62,11 @@
android:id="@+id/search_recycler" android:id="@+id/search_recycler"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:visibility="gone" android:background="?android:colorBackground"
android:background="@color/bj"/> android:visibility="gone"/>
</RelativeLayout> </RelativeLayout>
<androidx.fragment.app.FragmentContainerView <androidx.fragment.app.FragmentContainerView
android:id="@+id/bfq_db" android:id="@+id/bfq_db"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -50,11 +50,26 @@
app:cardUseCompatPadding="true" app:cardUseCompatPadding="true"
app:contentPadding="6dp"> app:contentPadding="6dp">
<ProgressBar
android:id="@+id/recyclerview1_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/recyclerview1_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/nullPlaylists"
android:textSize="26sp"
android:padding="6dp"
android:visibility="gone"
android:layout_centerHorizontal="true"/>
<com.muqingbfq.view.RecyclerViewH <com.muqingbfq.view.RecyclerViewH
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:focusable="false" android:focusableInTouchMode="false"
android:nestedScrollingEnabled="false"
tools:itemCount="6" /> tools:itemCount="6" />
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
@ -72,10 +87,25 @@
app:cardUseCompatPadding="true" app:cardUseCompatPadding="true"
app:contentPadding="6dp"> app:contentPadding="6dp">
<ProgressBar
android:id="@+id/recyclerview2_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/recyclerview2_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/nullPlaylists"
android:textSize="26sp"
android:padding="6dp"
android:visibility="gone"
android:layout_centerHorizontal="true"/>
<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="wrap_content" /> android:layout_height="wrap_content"
android:focusableInTouchMode="false"
android:nestedScrollingEnabled="false" />
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>

View File

@ -3,37 +3,67 @@
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="match_parent"
android:orientation="vertical" android:fitsSystemWindows="true"
android:fitsSystemWindows="true"> android:orientation="vertical">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
<com.muqingbfq.view.Text <com.muqingbfq.view.Text
android:id="@+id/title" android:id="@+id/title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/text" android:textColor="@color/text"
android:textSize="26sp" /> android:textSize="26sp" />
<EditText <EditText
android:id="@+id/edittext" android:id="@+id/edittext"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:autofillHints="text"
android:backgroundTint="@color/text_tm"
android:hint="输入需要搜索的音乐" android:hint="输入需要搜索的音乐"
android:visibility="gone"/> android:imeOptions="actionSearch"
android:inputType="text"
android:maxLines="1"
android:visibility="gone"
tools:ignore="HardcodedText" />
</LinearLayout> </LinearLayout>
</com.google.android.material.appbar.MaterialToolbar> </com.google.android.material.appbar.MaterialToolbar>
<androidx.recyclerview.widget.RecyclerView <RelativeLayout
android:id="@+id/lb"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" /> android:layout_weight="1">
<ProgressBar
android:id="@+id/recyclerview1_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
<TextView
android:id="@+id/recyclerview1_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:padding="6dp"
android:text="@string/loadnull"
android:textSize="26sp"
android:visibility="gone" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/lb"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
<androidx.fragment.app.FragmentContainerView <androidx.fragment.app.FragmentContainerView
android:id="@+id/bfq_db" android:id="@+id/bfq_db"

View File

@ -3,7 +3,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"> android:orientation="vertical"
android:background="?android:colorBackground">
<com.google.android.material.tabs.TabLayout <com.google.android.material.tabs.TabLayout
android:id="@+id/tablayout" android:id="@+id/tablayout"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -17,9 +18,28 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/Playlist" /> android:text="@string/Playlist" />
</com.google.android.material.tabs.TabLayout> </com.google.android.material.tabs.TabLayout>
<androidx.recyclerview.widget.RecyclerView <RelativeLayout
android:id="@+id/recyclerview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/>
<ProgressBar
android:id="@+id/recyclerview1_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
<TextView
android:id="@+id/recyclerview1_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/loadnull"
android:textSize="26sp"
android:padding="6dp"
android:visibility="gone"
android:layout_centerInParent="true"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/>
</RelativeLayout>
</LinearLayout> </LinearLayout>

View File

@ -99,27 +99,37 @@
android:nestedScrollingEnabled="false" /> android:nestedScrollingEnabled="false" />
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="6dp" android:layout_marginTop="6dp"
app:cardUseCompatPadding="true" app:layout_constraintTop_toBottomOf="@+id/cardview2"
app:contentPadding="6dp" android:orientation="vertical">
app:layout_constraintTop_toBottomOf="@+id/cardview2">
<RelativeLayout <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Downloadplaylist"
android:padding="6dp"
android:textSize="26sp" />
<TextView
android:id="@+id/recyclerview2_text"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:padding="6dp"
android:text="@string/nullPlaylists"
android:textSize="20sp"/>
<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:focusableInTouchMode="false" android:focusableInTouchMode="false"
android:nestedScrollingEnabled="false" android:nestedScrollingEnabled="false"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</RelativeLayout> </LinearLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -2,6 +2,6 @@
<resources> <resources>
<color name="ztl">#1C1B1F</color> <color name="ztl">#1C1B1F</color>
<color name="text">@color/white</color> <color name="text">@color/white</color>
<color name="text_tm">#CCC2DC</color> <color name="text_tm">#80FFFFFF</color>
<color name="bj">#2A2831</color> <color name="bj">#2A2831</color>
</resources> </resources>

View File

@ -12,7 +12,7 @@
<color name="text_cz">#03A9F4</color> <color name="text_cz">#03A9F4</color>
<color name="text_cz_tm">#9903A9F4</color> <color name="text_cz_tm">#9903A9F4</color>
<color name="text">#000000</color> <color name="text">#000000</color>
<color name="text_tm">#625B71</color> <color name="text_tm">#80000000</color>
<color name="tm">#00FFFFFF</color> <color name="tm">#00FFFFFF</color>
<color name="bj">#F2ECF6</color> <color name="bj">#F2ECF6</color>

View File

@ -31,6 +31,10 @@
<string name="quxiao">取消</string> <string name="quxiao">取消</string>
<string name="jianchagegnxin">检查更新</string> <string name="jianchagegnxin">检查更新</string>
<string name="endapp">关闭软件</string> <string name="endapp">关闭软件</string>
<string name="nullPlaylists">暂无歌单</string>
<string name="Downloadplaylist">下载歌单</string>
<string name="loadnull">加载失败</string>
<string-array name="gd_list"> <string-array name="gd_list">
<item>下载歌单</item> <item>下载歌单</item>
<item>收藏歌单(不可用)</item> <item>收藏歌单(不可用)</item>