修复BUG,更新UI
This commit is contained in:
parent
8a2bf60e93
commit
847d857fee
|
@ -18,7 +18,7 @@ android {
|
|||
//noinspection ExpiredTargetSdkVersion,OldTargetApi
|
||||
targetSdk 31
|
||||
versionCode 1
|
||||
versionName "1.9.7"
|
||||
versionName "1.9.9"
|
||||
|
||||
}
|
||||
compileOptions {
|
||||
|
|
|
@ -50,9 +50,7 @@
|
|||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".login.enroll" />
|
||||
<activity android:name=".login.user_logs" />
|
||||
<activity android:name=".login.user_editing" />
|
||||
<activity android:name=".clean.fragment_clean" />
|
||||
<activity android:name=".activity_search" />
|
||||
<activity
|
||||
|
@ -66,7 +64,6 @@
|
|||
<activity android:name=".sz" />
|
||||
<activity android:name=".mq.llq" />
|
||||
<activity android:name=".yc" />
|
||||
<activity android:name=".login.cookie" />
|
||||
|
||||
<service
|
||||
android:name=".bfqkz"
|
||||
|
|
|
@ -17,7 +17,6 @@ import com.mpatric.mp3agic.ID3v2;
|
|||
import com.mpatric.mp3agic.Mp3File;
|
||||
import com.muqingbfq.fragment.bflb_db;
|
||||
import com.muqingbfq.fragment.mp3;
|
||||
import com.muqingbfq.fragment.search;
|
||||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.mq.wj;
|
||||
|
||||
|
@ -58,6 +57,10 @@ public class MediaPlayer extends android.media.MediaPlayer {
|
|||
super.pause();
|
||||
// bfq.isPlaying = false;
|
||||
}
|
||||
|
||||
if (bfqkz.notify != null) {
|
||||
bfqkz.notify.tzl_button();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -69,6 +72,10 @@ public class MediaPlayer extends android.media.MediaPlayer {
|
|||
return;
|
||||
}
|
||||
super.start();
|
||||
|
||||
if (bfqkz.notify != null) {
|
||||
bfqkz.notify.tzl_button();
|
||||
}
|
||||
// bfq.isPlaying = true;
|
||||
}
|
||||
|
||||
|
@ -154,9 +161,6 @@ public class MediaPlayer extends android.media.MediaPlayer {
|
|||
if (bflb_db.adapter != null) {
|
||||
bflb_db.adapter.notifyDataSetChanged();
|
||||
}
|
||||
if (search.lbspq != null) {
|
||||
search.lbspq.notifyDataSetChanged();
|
||||
}
|
||||
if (mp3.adapter != null) {
|
||||
mp3.adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
|
|
@ -201,12 +201,8 @@ public class activity_search extends FragmentActivity<ActivitySearchBinding> {
|
|||
dismiss();
|
||||
if (!TextUtils.isEmpty(name)) {
|
||||
search sea = (search) getSupportFragmentManager().findFragmentById(R.id.search_fragment);
|
||||
if (!name.equals(sea.name)) {
|
||||
sea.i = 0;
|
||||
sea.binding.tablayout.getTabAt(0).select();
|
||||
}
|
||||
sea.setVisibility(true);
|
||||
sea.setStart(name);
|
||||
binding.searchFragment.setVisibility(View.VISIBLE);
|
||||
sea.sx(name);
|
||||
addSearchRecord(name);
|
||||
}
|
||||
}
|
||||
|
@ -300,10 +296,8 @@ public class activity_search extends FragmentActivity<ActivitySearchBinding> {
|
|||
binding.searchRecycler.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
search search = (com.muqingbfq.fragment.search) getSupportFragmentManager().
|
||||
findFragmentById(R.id.search_fragment);
|
||||
if (search.isVisible()) {
|
||||
search.setVisibility(false);
|
||||
if (binding.searchFragment.getVisibility()==View.VISIBLE) {
|
||||
binding.searchFragment.setVisibility(View.GONE);
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
|
@ -312,6 +306,5 @@ public class activity_search extends FragmentActivity<ActivitySearchBinding> {
|
|||
@Override
|
||||
public void finish() {
|
||||
super.finish();
|
||||
com.muqingbfq.fragment.search.lbspq = null;
|
||||
}
|
||||
}
|
|
@ -47,14 +47,6 @@ public class FileDownloader {
|
|||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
String file_url = wj.mp3;
|
||||
public FileDownloader(String x,MP3 mp3,boolean hc) {
|
||||
if (hc) {
|
||||
file_url = wj.filesdri + "hc/";
|
||||
}
|
||||
downloadFile(x,mp3);
|
||||
}
|
||||
public void downloadFile(MP3 x) {
|
||||
Request request = new Request.Builder()
|
||||
.url(main.api + url.api + "?id=" + x.id + "&level=" +
|
||||
|
@ -106,7 +98,7 @@ public class FileDownloader {
|
|||
// 下载失败处理
|
||||
return;
|
||||
}
|
||||
File outputFile = new File(file_url, x.id + ".mp3");
|
||||
File outputFile = new File(wj.mp3, x.id + ".mp3");
|
||||
File parentFile = outputFile.getParentFile();
|
||||
if (!parentFile.isDirectory()) {
|
||||
parentFile.mkdirs();
|
||||
|
@ -153,7 +145,7 @@ public class FileDownloader {
|
|||
}
|
||||
}
|
||||
o.close();
|
||||
mp3file.save(file_url + x.id);
|
||||
mp3file.save(wj.mp3 + x.id);
|
||||
outputFile.delete();
|
||||
}
|
||||
// 保存修改后的音乐文件,删除原来的文件
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.content.Intent;
|
|||
import com.mpatric.mp3agic.ID3v2;
|
||||
import com.mpatric.mp3agic.Mp3File;
|
||||
import com.muqingbfq.MP3;
|
||||
import com.muqingbfq.bfq;
|
||||
import com.muqingbfq.fragment.Media;
|
||||
import com.muqingbfq.home;
|
||||
import com.muqingbfq.login.user_logs;
|
||||
|
@ -31,6 +30,7 @@ public class url extends Thread {
|
|||
public static MP3 hq(MP3 x) {
|
||||
// gj.sc(x.id);
|
||||
getLrc(x.id);
|
||||
Media.loadLyric();
|
||||
try {
|
||||
if (wj.cz(x.id)) {
|
||||
x.url = x.id;
|
||||
|
|
|
@ -348,9 +348,6 @@ public class bfq extends AppCompatActivity<ActivityBfqBinding> {
|
|||
//暂停
|
||||
kgsetImageResource(R.drawable.zt);
|
||||
}
|
||||
if (bfqkz.notify != null) {
|
||||
bfqkz.notify.tzl_button();
|
||||
}
|
||||
isPlaying = bool;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ public class Media {
|
|||
} catch (Exception e) {
|
||||
gj.sc("Media loadLyric "+e);
|
||||
}
|
||||
me.wcy.lrcview.LrcView.Lrc(a, b);
|
||||
return new String[]{a, b};
|
||||
// LrcView.setLrc(a, b);
|
||||
// bfq.lrcView.getLrc();
|
||||
// bfq.lrcView.loadLrc(a, b);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.muqingbfq.fragment;
|
|||
import android.annotation.SuppressLint;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
|
@ -21,7 +22,6 @@ import com.muqingbfq.bfq_an;
|
|||
import com.muqingbfq.bfqkz;
|
||||
import com.muqingbfq.databinding.FragmentBfqDbBinding;
|
||||
import com.muqingbfq.main;
|
||||
import com.muqingbfq.mq.gj;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
@ -69,47 +69,47 @@ public class bfq_db extends Fragment implements GestureDetector.OnGestureListene
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
main.handler.post(runnable);
|
||||
handler.post(runnable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
main.handler.removeCallbacks(runnable);
|
||||
handler.removeCallbacks(runnable);
|
||||
}
|
||||
MP3 mp3;
|
||||
boolean isPlaying = false;
|
||||
Handler handler = new Handler();
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!Objects.equals(mp3, bfqkz.xm)) {
|
||||
mp3 = bfqkz.xm;
|
||||
setname(mp3.name + "/" + mp3.zz);
|
||||
}
|
||||
if (bfqkz.mt != null && bfqkz.mt.isPlaying() != isPlaying) {
|
||||
setkg(bfqkz.mt.isPlaying());
|
||||
}
|
||||
handler.postDelayed(this, 1000);
|
||||
}
|
||||
};
|
||||
|
||||
public void setkg(boolean bool) {
|
||||
if (bool) {
|
||||
binding.kg.setImageResource(R.drawable.bf);
|
||||
} else {
|
||||
binding.kg.setImageResource(R.drawable.zt);
|
||||
}
|
||||
isPlaying = bool;
|
||||
}
|
||||
|
||||
MP3 mp3;
|
||||
boolean isPlaying = false;
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!Objects.equals(mp3, bfqkz.xm)) {
|
||||
mp3 = bfqkz.xm;
|
||||
setname(mp3.name + "/" + mp3.zz);
|
||||
}
|
||||
if (bfqkz.mt != null && bfqkz.mt.isPlaying() != isPlaying) {
|
||||
setkg(bfqkz.mt.isPlaying());
|
||||
}
|
||||
main.handler.postDelayed(this, 1000);
|
||||
}
|
||||
};
|
||||
public void setname(String str) {
|
||||
binding.name.setText(str);
|
||||
}
|
||||
|
||||
public void setkg(boolean bool) {
|
||||
if (bool) {
|
||||
binding.kg.setImageResource(R.drawable.bf);
|
||||
} else {
|
||||
binding.kg.setImageResource(R.drawable.zt);
|
||||
}
|
||||
isPlaying = bool;
|
||||
}
|
||||
|
||||
public void setname(String str) {
|
||||
binding.name.setText(str);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onDown(@NonNull MotionEvent motionEvent) {
|
||||
binding.getRoot().setBackgroundColor(Color.parseColor("#80F2ECF6"));
|
||||
@Override
|
||||
public boolean onDown(@NonNull MotionEvent motionEvent) {
|
||||
binding.getRoot().setBackgroundColor(Color.parseColor("#80F2ECF6"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,13 +10,13 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.google.android.material.tabs.TabLayoutMediator;
|
||||
import com.muqingbfq.MP3;
|
||||
import com.muqingbfq.XM;
|
||||
import com.muqingbfq.databinding.FragmentSearchBinding;
|
||||
import com.muqingbfq.list.MyViewHoder;
|
||||
import com.muqingbfq.databinding.RecyclerVBinding;
|
||||
import com.muqingbfq.main;
|
||||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.mq.wl;
|
||||
|
@ -29,110 +29,126 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
public class search extends Fragment {
|
||||
public static RecyclerView.Adapter<MyViewHoder> lbspq;
|
||||
List<MP3> list = new ArrayList<>();
|
||||
List<XM> xmList = new ArrayList<>();
|
||||
public String name;
|
||||
|
||||
public FragmentSearchBinding binding;
|
||||
public int i = 0;
|
||||
public static String string;
|
||||
List<Fragment> fragments = new ArrayList<>();
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
binding = FragmentSearchBinding.inflate(inflater, container, false);
|
||||
lbspq = new mp3.Adapter(list);
|
||||
binding.tablayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
|
||||
binding.viewPager.setAdapter(new FragmentStateAdapter(this) {
|
||||
@NonNull
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
// 当用户再次选择已选择的选项卡时调用。
|
||||
search.this.i = tab.getPosition();
|
||||
setStart(name);
|
||||
public Fragment createFragment(int position) {
|
||||
return fragments.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
// 当选项卡退出选定状态时调用。
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
// 当选项卡进入选定状态时调用。
|
||||
|
||||
|
||||
public int getItemCount() {
|
||||
return fragments.size();
|
||||
}
|
||||
});
|
||||
setVisibility(false);
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
public void setVisibility(boolean bool) {
|
||||
if (bool) {
|
||||
binding.getRoot().setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
binding.getRoot().setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
public static class mp3 extends Fragment {
|
||||
List<MP3> list = new ArrayList<>();
|
||||
RecyclerVBinding binding;
|
||||
|
||||
public int k;
|
||||
|
||||
public void setStart(String name) {
|
||||
if (i == 0) {
|
||||
new mp3.Adapter(list);
|
||||
binding.recyclerview.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
binding.recyclerview.setAdapter(lbspq);
|
||||
} else if (i == 1) {
|
||||
k = (int) (main.k / getResources().getDisplayMetrics().density + 0.5f) / 120;
|
||||
binding.recyclerview.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
binding.recyclerview.setAdapter(new gd.baseadapter(getContext(),
|
||||
xmList, true));
|
||||
|
||||
}
|
||||
new start(name);
|
||||
}
|
||||
|
||||
public class start extends Thread {
|
||||
public start(String name) {
|
||||
binding.recyclerview1Bar.setVisibility(View.VISIBLE);
|
||||
list.clear();
|
||||
xmList.clear();
|
||||
search.this.name = name;
|
||||
start();
|
||||
}
|
||||
boolean load = false;
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
@Nullable
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
if (i == 0) {
|
||||
mp3();
|
||||
load = !list.isEmpty();
|
||||
} else if (i == 1) {
|
||||
gd();
|
||||
load = !xmList.isEmpty();
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = RecyclerVBinding.inflate(inflater, container, false);
|
||||
binding.recycleview.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
binding.recycleview.setAdapter(new com.muqingbfq.fragment.mp3.Adapter(list));
|
||||
start();
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void start() {
|
||||
list.clear();
|
||||
if (binding == null) {
|
||||
return;
|
||||
}
|
||||
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);
|
||||
binding.recyclerviewBar.setVisibility(View.VISIBLE);
|
||||
binding.recyclerviewText.setVisibility(View.GONE);
|
||||
new Thread() {
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
mp3(list, string);
|
||||
main.handler.post(() -> {
|
||||
binding.recyclerviewBar.setVisibility(View.GONE);
|
||||
if (list.isEmpty()) {
|
||||
binding.recyclerviewText.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
binding.recyclerviewText.setVisibility(View.GONE);
|
||||
}
|
||||
binding.recycleview.getAdapter().notifyDataSetChanged();
|
||||
});
|
||||
}
|
||||
});
|
||||
}.start();
|
||||
}
|
||||
}
|
||||
|
||||
private void mp3() {
|
||||
public static class gd extends Fragment {
|
||||
List<XM> list = new ArrayList<>();
|
||||
RecyclerVBinding binding;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = RecyclerVBinding.inflate(inflater, container, false);
|
||||
binding.recycleview.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
binding.recycleview.setAdapter(new com.muqingbfq.fragment.gd.baseadapter(getContext(),
|
||||
list, true));
|
||||
list.clear();
|
||||
binding.recyclerviewBar.setVisibility(View.VISIBLE);
|
||||
binding.recyclerviewText.setVisibility(View.GONE);
|
||||
new Thread() {
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
gd(list, string);
|
||||
main.handler.post(() -> {
|
||||
binding.recyclerviewBar.setVisibility(View.GONE);
|
||||
if (list.isEmpty()) {
|
||||
binding.recyclerviewText.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
binding.recyclerviewText.setVisibility(View.GONE);
|
||||
}
|
||||
binding.recycleview.getAdapter().notifyDataSetChanged();
|
||||
});
|
||||
}
|
||||
}.start();
|
||||
return binding.getRoot();
|
||||
}
|
||||
}
|
||||
|
||||
public void sx(String string) {
|
||||
search.string = string;
|
||||
fragments.add(new mp3());
|
||||
fragments.add(new gd());
|
||||
String[] strtab = new String[]{"歌曲", "歌单"};
|
||||
//将tabbView绑定到tab
|
||||
new TabLayoutMediator(binding.tablayout, binding.viewPager, (tab, position) ->
|
||||
tab.setText(strtab[position])).attach();
|
||||
}
|
||||
|
||||
private static void mp3(List<MP3> list, String str) {
|
||||
try {
|
||||
Long.parseLong(name);
|
||||
com.muqingbfq.api.playlist.hq(list, name);
|
||||
Long.parseLong(str);
|
||||
com.muqingbfq.api.playlist.hq(list, str);
|
||||
return;
|
||||
} catch (NumberFormatException e) {
|
||||
gj.sc(e);
|
||||
}
|
||||
String hq = wl.hq("/search?keywords=" + name + "&type=1");
|
||||
String hq = wl.hq("/search?keywords=" + str + "&type=1");
|
||||
try {
|
||||
JSONArray jsonArray = new JSONObject(hq).getJSONObject("result")
|
||||
.getJSONArray("songs");
|
||||
|
@ -160,22 +176,22 @@ public class search extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
private void gd() {
|
||||
private static void gd(List<XM> list, String str) {
|
||||
try {
|
||||
Long.parseLong(name);
|
||||
String hq = wl.hq("/playlist/detail?id=" + name);
|
||||
Long.parseLong(str);
|
||||
String hq = wl.hq("/playlist/detail?id=" + str);
|
||||
JSONObject js = new JSONObject(hq).getJSONObject("playlist");
|
||||
String id = js.getString("id");
|
||||
String name = js.getString("name");
|
||||
String coverImgUrl = js.getString("coverImgUrl");
|
||||
String id = js.getString("id");
|
||||
String name = js.getString("name");
|
||||
String coverImgUrl = js.getString("coverImgUrl");
|
||||
// gj.sc(name);
|
||||
xmList.add(new XM(id, name, coverImgUrl));
|
||||
list.add(new XM(id, name, coverImgUrl));
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
gj.sc(e);
|
||||
}
|
||||
try {
|
||||
String hq = wl.hq("/search?keywords=" + name +"&type=1000");
|
||||
String hq = wl.hq("/search?keywords=" + str + "&type=1000");
|
||||
JSONArray jsonArray = new JSONObject(hq).getJSONObject("result")
|
||||
.getJSONArray("playlists");
|
||||
int length = jsonArray.length();
|
||||
|
@ -196,52 +212,10 @@ public class search extends Fragment {
|
|||
+ "by " + jsonObject.getJSONObject("creator").getString("nickname")
|
||||
+ ",播放"
|
||||
+ formattedNumber + "次";
|
||||
xmList.add(new XM(id, name, s, coverImgUrl));
|
||||
list.add(new XM(id, name, s, coverImgUrl));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
gj.sc(e);
|
||||
}
|
||||
}
|
||||
/*
|
||||
class spq extends RecyclerView.Adapter<MyViewHoder> {
|
||||
public spq() {
|
||||
lbspq = this;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MyViewHoder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new MyViewHoder(ListMp3Binding.
|
||||
inflate(getLayoutInflater(),parent,false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MyViewHoder holder, int position) {
|
||||
MP3 x = list.get(position);
|
||||
holder.binding.name.setText(x.name);
|
||||
holder.binding.zz.setText(x.zz);
|
||||
int color = ContextCompat.getColor(holder.getContext(), R.color.text);
|
||||
if (bfqkz.xm != null && x.id.equals(bfqkz.xm.id)) {
|
||||
color = ContextCompat.getColor(holder.getContext(), R.color.text_cz);
|
||||
}
|
||||
holder.binding.name.setTextColor(color);
|
||||
holder.binding.zz.setTextColor(color);
|
||||
holder.itemView.setOnClickListener(view1 -> {
|
||||
if (bfqkz.xm == null || !bfqkz.xm.id.equals(x.id)) {
|
||||
bfqkz.xm = x;
|
||||
new url(x);
|
||||
}
|
||||
// if (!com.muqingbfq.fragment.gd.gdid.equals(bflb_db.gdid)) {
|
||||
gd.gdid = null;
|
||||
bfqkz.list.clear();
|
||||
bfqkz.list.addAll(list);
|
||||
bfq.start(search.this.getContext());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -13,13 +13,13 @@ import android.view.Menu;
|
|||
import android.view.MenuItem;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
|
||||
import com.jaeger.library.StatusBarUtil;
|
||||
import com.muqingbfq.databinding.ActivityHomeBinding;
|
||||
import com.muqingbfq.fragment.bfq_db;
|
||||
import com.muqingbfq.fragment.gd_adapter;
|
||||
|
@ -46,6 +46,7 @@ public class home extends com.muqingbfq.mq.AppCompatActivity<ActivityHomeBinding
|
|||
appCompatActivity = this;
|
||||
setTheme(R.style.Theme_muqing);
|
||||
super.onCreate(savedInstanceState);
|
||||
StatusBarUtil.setTransparent(this);
|
||||
setContentView(getViewBinding().getRoot());
|
||||
// binding.toolbar.setPadding(0, gj.getztl(this), 0, 0);
|
||||
DisplayMetrics dm = getResources().getDisplayMetrics();
|
||||
|
@ -80,11 +81,6 @@ public class home extends com.muqingbfq.mq.AppCompatActivity<ActivityHomeBinding
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void UI(@Nullable Bundle savedInstanceState) {
|
||||
|
||||
}
|
||||
|
||||
public static ComponentName componentName;
|
||||
|
||||
private class Adaper extends FragmentStateAdapter {
|
||||
|
|
|
@ -26,5 +26,7 @@ public abstract class AppCompatActivity<ViewBindingType extends ViewBinding> ext
|
|||
UI(savedInstanceState);
|
||||
}
|
||||
|
||||
protected abstract void UI(@Nullable Bundle savedInstanceState);
|
||||
protected void UI(@Nullable Bundle savedInstanceState) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:name="com.muqingbfq.fragment.search"
|
||||
android:visibility="gone"
|
||||
tools:layout="@layout/fragment_search" />
|
||||
<ListView
|
||||
android:id="@+id/search_recycler"
|
||||
|
|
|
@ -2,44 +2,19 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:background="?android:colorBackground">
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tablayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/music" />
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Playlist" />
|
||||
</com.google.android.material.tabs.TabLayout>
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<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"
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/viewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/>
|
||||
android:layout_height="match_parent" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
24
app/src/main/res/layout/recycler_v.xml
Normal file
24
app/src/main/res/layout/recycler_v.xml
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycleview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
<ProgressBar
|
||||
android:id="@+id/recyclerview_bar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true" />
|
||||
<TextView
|
||||
android:id="@+id/recyclerview_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"/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -386,6 +386,30 @@ public class LrcView extends View {
|
|||
});
|
||||
}
|
||||
|
||||
public static void Lrc(String mainLrcText, String secondLrcText) {
|
||||
StringBuilder sb = new StringBuilder("file://");
|
||||
sb.append(mainLrcText);
|
||||
if (secondLrcText != null) {
|
||||
sb.append("#").append(secondLrcText);
|
||||
}
|
||||
String flag = sb.toString();
|
||||
ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||
Callable<List<LrcEntry>> callable = () -> LrcUtils.parseLrc(
|
||||
new String[]{mainLrcText, secondLrcText});
|
||||
Future<List<LrcEntry>> future = executor.submit(callable);
|
||||
try {
|
||||
mLrcEntryList = future.get();
|
||||
} catch (InterruptedException e) {
|
||||
// 处理中断异常
|
||||
e.printStackTrace();
|
||||
} catch (ExecutionException e) {
|
||||
// 处理执行异常
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 关闭线程池
|
||||
executor.shutdown();
|
||||
}
|
||||
|
||||
/**
|
||||
* 歌词是否有效
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue
Block a user