更新了歌词组件支持更多操作

This commit is contained in:
muqing 2024-02-03 16:07:02 +08:00
parent 595e887010
commit 64e7336a71
29 changed files with 489 additions and 622 deletions

View File

@ -10,6 +10,10 @@
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false" />
</inspection_tool>
<inspection_tool class="FieldMayBeFinal" enabled="true" level="INFORMATION" enabled_by_default="true" />
<inspection_tool class="IgnoreResultOfCall" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_reportAllNonLibraryCalls" value="false" />
<option name="callCheckString" value="java.io.InputStream,read|skip|available|markSupported,java.io.Reader,read|skip|ready|markSupported,java.lang.AbstractStringBuilder,capacity|codePointAt|codePointBefore|codePointCount|indexOf|lastIndexOf|offsetByCodePoints|substring|subSequence,java.lang.Boolean,.*,java.lang.Byte,.*,java.lang.Character,.*,java.lang.Double,.*,java.lang.Float,.*,java.lang.Integer,.*,java.lang.Long,.*,java.lang.Math,.*,java.lang.Object,equals|hashCode|toString,java.lang.Short,.*,java.lang.StrictMath,.*,java.lang.String,.*,java.lang.Thread,interrupted,java.math.BigDecimal,.*,java.math.BigInteger,.*,java.net.InetAddress,.*,java.net.URI,.*,java.nio.channels.AsynchronousChannelGroup,.*,java.nio.channels.Channel,isOpen,java.nio.channels.FileChannel,open|map|lock|tryLock|write,java.nio.channels.ScatteringByteChannel,read,java.nio.channels.SocketChannel,open|socket|isConnected|isConnectionPending,java.util.Arrays,.*,java.util.Collections,(?!addAll).*,java.util.List,of,java.util.Map,of|ofEntries|entry,java.util.Set,of,java.util.UUID,.*,java.util.concurrent.BlockingQueue,offer|remove,java.util.concurrent.CountDownLatch,await|getCount,java.util.concurrent.ExecutorService,awaitTermination|isShutdown|isTerminated,java.util.concurrent.ForkJoinPool,awaitQuiescence,java.util.concurrent.Semaphore,tryAcquire|availablePermits|isFair|hasQueuedThreads|getQueueLength|getQueuedThreads,java.util.concurrent.locks.Condition,await|awaitNanos|awaitUntil,java.util.concurrent.locks.Lock,tryLock|newCondition,java.util.regex.Matcher,pattern|toMatchResult|start|end|group|groupCount|matches|find|lookingAt|quoteReplacement|replaceAll|replaceFirst|regionStart|regionEnd|hasTransparentBounds|hasAnchoringBounds|hitEnd|requireEnd,java.util.regex.Pattern,.*,java.util.stream.BaseStream,.*,java.util.stream.DoubleStream,.*,java.util.stream.IntStream,.*,java.util.stream.LongStream,.*,java.util.stream.Stream,.*" />
</inspection_tool>
<inspection_tool class="InnerClassMayBeStatic" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" />

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="NullableNotNullManager">

View File

@ -8,10 +8,10 @@ import java.util.Objects;
public class MP3 implements Serializable {
public String id, name, zz, url;
// 音乐的贴图
public Object picurl;
public String picurl;
public MP3(String id, String name, String zz, Object picurl) {
public MP3(String id, String name, String zz, String picurl) {
this.id = id;
this.name = name;
this.zz = zz;

View File

@ -1,11 +1,13 @@
package com.muqingbfq;
import static com.muqingbfq.bfqkz.xm;
import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.AudioAttributes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
@ -14,11 +16,11 @@ import com.bumptech.glide.request.target.Target;
import com.mpatric.mp3agic.ID3v2;
import com.mpatric.mp3agic.Mp3File;
import com.muqingbfq.fragment.bflb_db;
import com.muqingbfq.fragment.bfq_db;
import com.muqingbfq.fragment.mp3;
import com.muqingbfq.fragment.search;
import com.muqingbfq.mq.gj;
import com.muqingbfq.mq.wj;
import java.io.IOException;
public class MediaPlayer extends android.media.MediaPlayer {
@ -116,7 +118,7 @@ public class MediaPlayer extends android.media.MediaPlayer {
boolean isFirstResource) {
Bitmap bitmap = null;
try {
Mp3File mp3file = new Mp3File(wj.mp3 + bfqkz.xm.id);
Mp3File mp3file = new Mp3File(bfqkz.xm.picurl);
if (mp3file.hasId3v2Tag()) {
ID3v2 id3v2Tag = mp3file.getId3v2Tag();
byte[] albumImage = id3v2Tag.getAlbumImage();
@ -148,9 +150,7 @@ public class MediaPlayer extends android.media.MediaPlayer {
@SuppressLint("NotifyDataSetChanged")
public void bfui() {
String name = xm.name, zz = bfqkz.xm.zz;
setTX();
bfq_db.setname(name + "/" + zz);
if (bflb_db.adapter != null) {
bflb_db.adapter.notifyDataSetChanged();
}

View File

@ -194,6 +194,7 @@ public class MyButtonClickReceiver extends BroadcastReceiver {
} else {
bfqkz.mt.start();
}
bfqkz.notify.tzl();
}
/**

View File

@ -7,6 +7,7 @@ import android.annotation.SuppressLint;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@ -42,19 +43,17 @@ import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
public class activity_search extends FragmentActivity {
public class activity_search extends FragmentActivity<ActivitySearchBinding> {
private ArrayAdapter<String> adapter;
private List<String> json_list = new ArrayList<>();
private final List<String> list = new ArrayList<>();
ListView listPopupWindow;
ActivitySearchBinding binding;
@SuppressLint("NotifyDataSetChanged")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivitySearchBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
setContentView(getViewBinding().getRoot());
FlexboxLayoutManager manager = new FlexboxLayoutManager(this);
//设置主轴排列方式
manager.setFlexDirection(FlexDirection.ROW);
@ -182,6 +181,11 @@ public class activity_search extends FragmentActivity {
return super.onCreateOptionsMenu(menu);
}
@Override
protected ActivitySearchBinding getViewBindingObject(LayoutInflater layoutInflater) {
return ActivitySearchBinding.inflate(layoutInflater);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
int itemId = item.getItemId();

View File

@ -3,7 +3,6 @@ package com.muqingbfq.api;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
import android.widget.TextView;
import androidx.annotation.NonNull;
@ -145,16 +144,13 @@ public class FileDownloader {
id3v2Tag.setLyrics(com.muqingbfq.api.url.Lrc(x.id));
ByteArrayOutputStream o = new ByteArrayOutputStream();
if (x.picurl instanceof String) {
Request build = new Request.Builder().url(x.picurl.toString())
Request build = new Request.Builder().url(x.picurl)
.build();
Response execute = client.newCall(build).execute();
if (execute.isSuccessful()) {
id3v2Tag.setAlbumImage(execute.body().bytes()
, "image/jpeg");
}
} else if (x.picurl instanceof Bitmap) {
id3v2Tag.setAlbumImage(((Bitmap) x.picurl).getNinePatchChunk()
, "image/jpeg");
}
o.close();
mp3file.save(file_url + x.id);

View File

@ -166,12 +166,9 @@ public class playlist extends Thread {
if (mp3file.hasId3v2Tag()) {
// 获取 ID3v2 标签实例
ID3v2 id3v2tag = mp3file.getId3v2Tag();
byte[] albumImage = id3v2tag.getAlbumImage();
Bitmap bitmap = BitmapFactory.decodeByteArray(albumImage,
0, albumImage.length);
MP3 mp3 = new MP3(a.toString(), id3v2tag.getTitle(),
id3v2tag.getArtist()
, bitmap);
, a.toString());
list.add(mp3);
}
} catch (Exception e) {

View File

@ -33,6 +33,7 @@ public class url extends Thread {
getLrc(x.id);
try {
if (wj.cz(x.id)) {
x.url = x.id;
return x;
} else if (wj.cz(wj.mp3 + x.id)) {
x.url = wj.mp3 + x.id;

View File

@ -7,25 +7,27 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import com.google.android.material.slider.Slider;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.mpatric.mp3agic.ID3v2;
import com.mpatric.mp3agic.Mp3File;
import com.muqingbfq.api.FileDownloader;
import com.muqingbfq.databinding.ActivityBfqBinding;
import com.muqingbfq.fragment.Media;
import com.muqingbfq.fragment.bfq_db;
import com.muqingbfq.mq.AppCompatActivity;
import com.muqingbfq.mq.gj;
import com.muqingbfq.mq.wj;
@ -34,57 +36,47 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import me.wcy.lrcview.LrcView;
public class bfq extends AppCompatActivity<ActivityBfqBinding> {
public class bfq extends AppCompatActivity {
public ActivityBfqBinding binding;
public String lrc;
public MP3 mp3;
public boolean isplay = true;
private void setLrc() {
ViewGroup.LayoutParams layoutParams = binding.cardview.getLayoutParams();
DisplayMetrics dm = getResources().getDisplayMetrics();
main.k = dm.widthPixels;
main.g = dm.heightPixels;
layoutParams.height = main.k - 100;
layoutParams.width = main.k - 100;
binding.cardview.setLayoutParams(layoutParams);
// bfqkz.mt.seekTo(Math.toIntExact(time));
if (!gj.isTablet(this)) {
binding.lrcView.setOnClickListener((view) -> {
View kp = binding.kp1;
if (kp.getVisibility() == View.VISIBLE) {
kp.setVisibility(View.GONE);
ViewGroup.LayoutParams layoutParams = binding.cardview.getLayoutParams();
DisplayMetrics dm = getResources().getDisplayMetrics();
main.k = dm.widthPixels;
main.g = dm.heightPixels;
layoutParams.height = main.k - 100;
layoutParams.width = main.k - 100;
binding.cardview.setLayoutParams(layoutParams);
binding.cardview.setOnClickListener((view) -> {
if (binding.cardview.getVisibility() == View.VISIBLE) {
binding.cardview.setVisibility(View.GONE);
binding.lrcView.setVisibility(View.VISIBLE);
} else {
kp.setVisibility(View.VISIBLE);
binding.cardview.setVisibility(View.VISIBLE);
binding.lrcView.setVisibility(View.GONE);
}
// binding.lrcView.setLrcline(kp.getVisibility() == View.VISIBLE);
});
binding.lrcView.setOnTapListener((view, x, y) -> {
View kp = binding.kp1;
if (kp.getVisibility() == View.VISIBLE) {
kp.setVisibility(View.GONE);
binding.lrcView.
setDraggable(true, (a, time) -> {
bfqkz.mt.seekTo((int) time);
return false;
});
if (binding.cardview.getVisibility() == View.VISIBLE) {
binding.cardview.setVisibility(View.GONE);
binding.lrcView.setVisibility(View.VISIBLE);
} else {
kp.setVisibility(View.VISIBLE);
binding.lrcView.
setDraggable(false,null);
binding.cardview.setVisibility(View.VISIBLE);
binding.lrcView.setVisibility(View.GONE);
}
});
binding.lrcView.
setDraggable(false, null);
} else {
binding.lrcView.setOnClickListener(null);
binding.lrcView.
setDraggable(false, null);
}
binding.lrcView.
setDraggable(true, (a, time) -> {
bfqkz.mt.seekTo((int) time);
return false;
});
binding.tdt.addOnChangeListener((slider, value, fromUser) ->
setTime_b(bfq_an.getTime((long) value)));
binding.tdt.addOnSliderTouchListener(new Slider.OnSliderTouchListener() {
@ -113,12 +105,9 @@ public class bfq extends AppCompatActivity {
@SuppressLint("ClickableViewAccessibility")
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);/*getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);*/
binding = ActivityBfqBinding.inflate(getLayoutInflater());
Intent intent = getIntent();
protected void UI(@Nullable Bundle savedInstanceState) {
// getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
setLrc();
setContentView(binding.getRoot());
binding.toolbar.setNavigationOnClickListener(view1 -> finish());
binding.toolbar.setOnMenuItemClickListener(item -> {
if (item.getItemId() == R.id.fx && bfqkz.xm != null) {
@ -142,6 +131,7 @@ public class bfq extends AppCompatActivity {
setOnClickListener(view1 -> com.muqingbfq.fragment.bflb_db.start(this));
binding.control.setOnClickListener(new bfq_an.control(binding.control));
// binding.fragmentBfq.setOnTouchListener(new Touch());
binding.toolbar.setOnTouchListener(new Touch());
binding.getRoot().setOnTouchListener(new Touch());
@ -178,33 +168,34 @@ public class bfq extends AppCompatActivity {
new FileDownloader(bfq.this).downloadFile(bfqkz.xm);
}
});
Intent intent = getIntent();
mp3 = (MP3) intent.getSerializableExtra("MP3");
new Thread() {
@Override
public void run() {
super.run();
if (mp3 != null) {
if (bfqkz.xm == null || !bfqkz.xm.equals(mp3)) {
bfqkz.xm = mp3;
bfqkz.mp3(com.muqingbfq.api.url.hq(mp3));
}
}
main.handler.post(() -> {
if (mp3 != null) {
UI();
}
if (bfqkz.mt != null && bfqkz.mt.isPlaying()) {
binding.kg.setImageResource(R.drawable.bf);
}
});
main.handler.post(runnable);
}
}.start();
// UI();
new thread().start();
}
class thread extends Thread {
@Override
public void run() {
super.run();
if (mp3 != null) {
if (bfqkz.xm == null || !bfqkz.xm.equals(mp3)) {
bfqkz.xm = mp3;
bfqkz.mp3(com.muqingbfq.api.url.hq(mp3));
}
}
main.handler.post(() -> {
if (mp3 != null) {
sx();
}
if (bfqkz.mt != null && bfqkz.mt.isPlaying()) {
binding.kg.setImageResource(R.drawable.bf);
}
});
main.handler.post(runnable);
}
}
public void UI() {
public void sx() {
setname(mp3.name);
setzz(mp3.zz);
bfq_an.islike();
@ -240,6 +231,11 @@ public class bfq extends AppCompatActivity {
super.onConfigurationChanged(newConfig);
}
@Override
protected ActivityBfqBinding getViewBindingObject(LayoutInflater layoutInflater) {
return ActivityBfqBinding.inflate(layoutInflater);
}
public class Touch implements View.OnTouchListener {
private float downY;
@ -247,7 +243,7 @@ public class bfq extends AppCompatActivity {
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
LinearLayout root = binding.getRoot();
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN:
downY = motionEvent.getRawY();
@ -257,32 +253,34 @@ public class bfq extends AppCompatActivity {
float moveY = motionEvent.getRawY();
//移动的距离
float dy = moveY - downY;
//重新设置控件的位置移动
if (dy < 0) {
return true;
} else if (dy > main.g - main.g / 5.0) {
if (dy > main.g - main.g / 5.0) { // touchSlop是系统最小识别滑动距离可以避免抖动
// 在这里根据deltaY更新视图位置
finish();
return true;
} else if (dy < 0) {
return true;
}
root.setTranslationY(dy);
break;
binding.getRoot().setTranslationY(dy);
return true;
case MotionEvent.ACTION_UP:
if (binding.getRoot().getY() > main.g - main.g / 1.5) {
finish();
return true;
}
ObjectAnimator animator = ObjectAnimator.ofFloat(root, "y", root.getY(), 0);
ObjectAnimator animator = ObjectAnimator.ofFloat(binding.getRoot()
, "y", binding.getRoot().getY(), 0);
animator.setDuration(300);
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
root.setY(0);
binding.getRoot().setY(0);
}
});
animator.start();
break;
}
return true;
return false;
}
}
@ -303,7 +301,7 @@ public class bfq extends AppCompatActivity {
int position = bfqkz.mt.getCurrentPosition();
Progress(position);
}
if (!mp3.equals(bfqkz.xm)) {
if (mp3 != null && !mp3.equals(bfqkz.xm)) {
mp3 = bfqkz.xm;
setname(mp3.name);
setzz(mp3.zz);
@ -342,7 +340,6 @@ public class bfq extends AppCompatActivity {
//暂停
kgsetImageResource(R.drawable.zt);
}
bfq_db.setkg(bool);
if (bfqkz.notify != null) {
bfqkz.notify.tzl_button();
}
@ -350,17 +347,29 @@ public class bfq extends AppCompatActivity {
}
public void setImageBitmap() {
if (wj.cz(bfqkz.xm.picurl)) {
try {
Mp3File mp3file = new Mp3File(bfqkz.xm.picurl);
if (mp3file.hasId3v2Tag()) {
ID3v2 id3v2Tag = mp3file.getId3v2Tag();
byte[] albumImage = id3v2Tag.getAlbumImage();
binding.cardview.setImage(BitmapFactory.
decodeByteArray(albumImage, 0, albumImage.length));
}
return;
} catch (Exception a) {
gj.sc(getClass() + " yc:" + a);
}
}
binding.cardview.setImage(bfqkz.xm.picurl);
}
@Override
public void finish() {
super.finish();
binding = null;
main.handler.removeCallbacks(runnable); // 在播放开始时启动更新进度
}
public void setTime_a(String str) {
binding.timeA.setText(str);
}
@ -384,5 +393,4 @@ public class bfq extends AppCompatActivity {
binding.tdt.setValue(progress);
binding.lrcView.updateTime(progress);
}
}

View File

@ -21,6 +21,7 @@ import androidx.media.MediaBrowserServiceCompat;
import com.muqingbfq.api.url;
import com.muqingbfq.mq.BluetoothMusicController;
import com.muqingbfq.mq.gj;
import com.muqingbfq.mq.wj;
import java.util.ArrayList;
import java.util.List;

View File

@ -25,7 +25,7 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class fragment_clean extends FragmentActivity {
public class fragment_clean extends FragmentActivity<ActivityCleanBinding> {
List<String[]> list = new ArrayList<>();
List<String> list_box = new ArrayList<>();
ActivityCleanBinding binding;
@ -58,7 +58,7 @@ public class fragment_clean extends FragmentActivity {
return new VH(inflate);
}
@SuppressLint("ClickableViewAccessibility")
@SuppressLint({"ClickableViewAccessibility", "SetTextI18n"})
@Override
public void onBindViewHolder(@NonNull VH holder, int position) {
String[] s = list.get(position);
@ -111,6 +111,11 @@ public class fragment_clean extends FragmentActivity {
return super.onCreateOptionsMenu(menu);
}
@Override
protected ActivityCleanBinding getViewBindingObject(LayoutInflater layoutInflater) {
return ActivityCleanBinding.inflate(layoutInflater);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {

View File

@ -1,7 +1,6 @@
package com.muqingbfq.fragment;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.view.GestureDetector;
@ -9,15 +8,12 @@ import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import com.google.gson.reflect.TypeToken;
import com.muqingbfq.MP3;
import com.muqingbfq.R;
import com.muqingbfq.bfq;
@ -25,53 +21,20 @@ import com.muqingbfq.bfq_an;
import com.muqingbfq.bfqkz;
import com.muqingbfq.databinding.FragmentBfqDbBinding;
import com.muqingbfq.main;
import com.muqingbfq.mq.wj;
import com.muqingbfq.mq.gj;
import java.lang.reflect.Type;
import java.util.List;
import java.util.Objects;
public class bfq_db extends Fragment implements GestureDetector.OnGestureListener {
@SuppressLint("StaticFieldLeak")
public static View view;
FragmentBfqDbBinding binding;
private GestureDetector gestureDetector;
@SuppressLint({"ClickableViewAccessibility", "SetTextI18n"})
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (view == null) {
String jsonList = this.getContext().getSharedPreferences("list", Context.MODE_PRIVATE)
.getString("listData", null); // 获取保存的 JSON 字符串
if (jsonList != null) {
Type type = new TypeToken<List<MP3>>() {
}.getType();
bfqkz.list = new com.google.gson.Gson().fromJson(jsonList, type);
// JSON 字符串转换回列表数据
}
bfqkz.xm = wj.getMP3FromFile();
if (bfqkz.xm != null) {
new Thread() {
@Override
public void run() {
super.run();
MP3 hq = com.muqingbfq.api.url.hq(bfqkz.xm);
if (hq == null) {
return;
}
try {
bfqkz.mt.DataSource(hq);
} catch (Exception e) {
com.muqingbfq.mq.gj.sc(e);
}
}
}.start();
}
}
FragmentBfqDbBinding binding = FragmentBfqDbBinding.inflate(getLayoutInflater(),
binding = FragmentBfqDbBinding.inflate(getLayoutInflater(),
container, false);
view = binding.getRoot();
binding.kg.setOnClickListener(v -> {
if (bfqkz.mt == null) {
return;
@ -82,17 +45,15 @@ public class bfq_db extends Fragment implements GestureDetector.OnGestureListene
} else {
bfqkz.mt.start();
}
setkg(bfqkz.mt.isPlaying());
// setkg(bfqkz.mt.isPlaying());
});
binding.txb.setOnClickListener(view -> bflb_db.start(getContext()));
// view.setOnClickListener(vw -> bfq.start(getContext()));
gestureDetector = new GestureDetector(getContext(), this);
view.setOnTouchListener((view, motionEvent) -> {
/* if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.bj));
return true;
}*/
binding.getRoot().setOnTouchListener((view, motionEvent) -> {
if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
binding.name.setTranslationX(0);
}
return gestureDetector.onTouchEvent(motionEvent);
});
// 恢复列表数据
@ -102,41 +63,53 @@ public class bfq_db extends Fragment implements GestureDetector.OnGestureListene
if (bfqkz.mt != null) {
setkg(bfqkz.mt.isPlaying());
}
return view;
}
private static <T extends View> T findViewById(int id) {
return view.findViewById(id);
}
public static void setkg(boolean bool) {
if (view != null) {
ImageView imageView = findViewById(R.id.kg);
if (bool) {
imageView.setImageResource(R.drawable.bf);
} else {
imageView.setImageResource(R.drawable.zt);
}
}
}
public static void setname(String str) {
if (view != null) {
TextView textView = findViewById(R.id.name);
textView.setText(str);
}
}
public static TextView getname() {
if (view != null) {
return findViewById(R.id.name);
}
return null;
return binding.getRoot();
}
@Override
public boolean onDown(@NonNull MotionEvent motionEvent) {
view.setBackgroundColor(Color.parseColor("#80F2ECF6"));
public void onResume() {
super.onResume();
main.handler.post(runnable);
}
@Override
public void onPause() {
super.onPause();
main.handler.removeCallbacks(runnable);
}
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 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"));
return true;
}
@ -147,28 +120,27 @@ public class bfq_db extends Fragment implements GestureDetector.OnGestureListene
@Override
public boolean onSingleTapUp(@NonNull MotionEvent motionEvent) {
bfq.startactivity(getContext(), bfqkz.xm);
// view.setBackgroundColor(ContextCompat.getColor(getContext(),R.color.bj));
// view.setBackgroundColor(ContextCompat.getColor(getContext(),R.color.bj));
binding.getRoot().setBackgroundColor(ContextCompat.getColor(getContext(), R.color.bj));
return true;
}
@Override
public boolean onScroll(@Nullable MotionEvent motionEvent, @NonNull MotionEvent motionEvent1,
float v, float v1) {
getname().setTranslationX(view.getTranslationX() - v);
view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.bj));
binding.name.setTranslationX(binding.name.getTranslationX() - v);
binding.getRoot().setBackgroundColor(ContextCompat.getColor(getContext(), R.color.bj));
return false;
}
@Override
public void onLongPress(@NonNull MotionEvent motionEvent) {
binding.getRoot().setBackgroundColor(ContextCompat.getColor(getContext(), R.color.bj));
}
@Override
public boolean onFling(@Nullable MotionEvent e1,
@NonNull MotionEvent e2, float v, float v1) {
view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.bj));
binding.getRoot().setBackgroundColor(ContextCompat.getColor(getContext(), R.color.bj));
float distance = e1.getX() - e2.getX();
float threshold = main.k / 2.0f;
// 判断手势方向并限制滑动距离
@ -181,7 +153,6 @@ public class bfq_db extends Fragment implements GestureDetector.OnGestureListene
// 在这里添加你的逻辑代码
bfq_an.syq();
}
getname().setTranslationX(0);
return true;
}
}

View File

@ -1,6 +1,7 @@
package com.muqingbfq.fragment;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
@ -24,7 +25,8 @@ import com.muqingbfq.api.playlist;
import com.muqingbfq.api.resource;
import com.muqingbfq.bfq_an;
import com.muqingbfq.bfqkz;
import com.muqingbfq.databinding.FragmentMp3Binding;
import com.muqingbfq.databinding.ActivityGdBinding;
import com.muqingbfq.databinding.ActivityMp3Binding;
import com.muqingbfq.databinding.ListGdBBinding;
import com.muqingbfq.databinding.ListGdBinding;
import com.muqingbfq.main;
@ -41,19 +43,16 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class gd extends com.muqingbfq.mq.FragmentActivity {
public class gd extends com.muqingbfq.mq.FragmentActivity<ActivityGdBinding> {
public static String gdid;
private final List<XM> list = new ArrayList<>();
public static RecyclerView.Adapter<VH> adapter;
int k;
FragmentMp3Binding binding;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = FragmentMp3Binding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
setContentView(getViewBinding().getRoot());
Intent intent = getIntent();
binding.title.setText(intent.getStringExtra("name"));
adapter = new baseadapter(this, list);
@ -65,6 +64,11 @@ public class gd extends com.muqingbfq.mq.FragmentActivity {
new start(id);
}
@Override
protected ActivityGdBinding getViewBindingObject(LayoutInflater layoutInflater) {
return ActivityGdBinding.inflate(layoutInflater);
}
@SuppressLint("NotifyDataSetChanged")
class start extends Thread {
String id;

View File

@ -31,7 +31,7 @@ import com.muqingbfq.api.playlist;
import com.muqingbfq.bfq;
import com.muqingbfq.bfq_an;
import com.muqingbfq.bfqkz;
import com.muqingbfq.databinding.FragmentMp3Binding;
import com.muqingbfq.databinding.ActivityMp3Binding;
import com.muqingbfq.databinding.ListMp3Binding;
import com.muqingbfq.list.MyViewHoder;
import com.muqingbfq.main;
@ -43,21 +43,19 @@ import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
public class mp3 extends FragmentActivity {
public class mp3 extends FragmentActivity<ActivityMp3Binding> {
private List<MP3> list = new ArrayList<>();
private List<MP3> list_ys = new ArrayList<>();
public static Adapter adapter;
FragmentMp3Binding binding;
// private static String id;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = FragmentMp3Binding.inflate(getLayoutInflater());
setContentView(getViewBinding().getRoot());
Intent intent = getIntent();
binding.title.setText(intent.getStringExtra("name"));
String id = intent.getStringExtra("id");
setContentView(binding.getRoot());
adapter = new Adapter(list);
binding.lb.setLayoutManager(new LinearLayoutManager(this));
binding.lb.setAdapter(adapter);
@ -94,6 +92,11 @@ public class mp3 extends FragmentActivity {
return super.onCreateOptionsMenu(menu);
}
@Override
protected ActivityMp3Binding getViewBindingObject(LayoutInflater layoutInflater) {
return ActivityMp3Binding.inflate(layoutInflater);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
int itemId = item.getItemId();

View File

@ -8,10 +8,12 @@ import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.media.MediaBrowserCompat;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
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;
@ -27,20 +29,24 @@ import com.muqingbfq.mq.gj;
import java.util.ArrayList;
import java.util.List;
public class home extends AppCompatActivity {
public class home extends com.muqingbfq.mq.AppCompatActivity<ActivityHomeBinding> {
@SuppressLint("StaticFieldLeak")
public static AppCompatActivity appCompatActivity;
ActivityHomeBinding binding;
// ActivityHomeBinding binding;
public MediaBrowserCompat mBrowser;
@Override
protected ActivityHomeBinding getViewBindingObject(LayoutInflater layoutInflater) {
return ActivityHomeBinding.inflate(layoutInflater);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
appCompatActivity = this;
setTheme(R.style.Theme_muqing);
super.onCreate(savedInstanceState);
binding = ActivityHomeBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
setContentView(getViewBinding().getRoot());
// binding.toolbar.setPadding(0, gj.getztl(this), 0, 0);
DisplayMetrics dm = getResources().getDisplayMetrics();
main.k = dm.widthPixels;
@ -67,12 +73,18 @@ public class home extends AppCompatActivity {
//检测更新
new gj.jianchagengxin(this);
UI();
// startService(new Intent(this, FloatingLyricsService.class));
} catch (Exception e) {
yc.tc(this, e);
}
}
@Override
protected void UI(@Nullable Bundle savedInstanceState) {
}
public static ComponentName componentName;
private class Adaper extends FragmentStateAdapter {

View File

@ -1,62 +0,0 @@
package com.muqingbfq.login;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import com.muqingbfq.R;
import com.muqingbfq.mq.FragmentActivity;
import com.muqingbfq.mq.gj;
import com.muqingbfq.mq.wl;
import org.json.JSONException;
import org.json.JSONObject;
public class enroll extends FragmentActivity {
EditText edit_account, edit_username,
edit_password, edit_email;
public String account, username, password, email, appID;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_enroll);
Intent intent = getIntent();
//获取UID编辑框
edit_account = findViewById(R.id.edit_user);
edit_username = findViewById(R.id.edit_name);
//设置密码编辑框
edit_password = findViewById(R.id.edit_password);
edit_email = findViewById(R.id.edit_email);
edit_username.setText(
intent.getStringExtra("user"));
appID = intent.getStringExtra("appID");
findViewById(R.id.enroll).setOnClickListener(view -> a());
}
public void a() {
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
View v = getWindow().peekDecorView();
if (null != v) {
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
}
private void end() {
Intent intent = new Intent(); // 创建一个新意图
Bundle bundle = new Bundle(); // 创建一个新包裹
// 往包裹存入名叫response_time的字符串
bundle.putString("user", account);
// 往包裹存入名叫response_content的字符串
bundle.putString("password", password);
intent.putExtras(bundle); // 把快递包裹塞给意图
// 携带意图返回上一个页面RESULT_OK表示处理成功
setResult(Activity.RESULT_OK, intent);
finish(); // 结束当前的活动页面
}
}

View File

@ -1,170 +0,0 @@
package com.muqingbfq.login;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.bumptech.glide.Glide;
import com.muqingbfq.R;
import com.muqingbfq.databinding.ActivityUserEditingBinding;
import com.muqingbfq.fragment.sz;
import com.muqingbfq.main;
import com.muqingbfq.mq.FragmentActivity;
import com.muqingbfq.mq.gj;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.io.IOException;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
public class user_editing extends FragmentActivity {
//头像用户名签名性别背景
ImageView imageViewa;
EditText edit_name, edit_qianming;
ImageView imageViewb;
String file_a, file_b;
ActivityUserEditingBinding binding;
@SuppressLint("CheckResult")
ActivityResultLauncher<Intent> setimagea =
registerForActivityResult(new ActivityResultContracts.StartActivityForResult(),
result -> {
if (result.getResultCode() == RESULT_OK) {
Intent data = result.getData();
if (data != null) {
Uri uri = data.getData();
file_a = getImagePath(uri);
Glide.with(user_editing.this)
.load(file_a)
.error(R.drawable.icon)
.into(imageViewa);
// 处理选择的图片
}
}
}), setimageb =
registerForActivityResult(new ActivityResultContracts.StartActivityForResult(),
result -> {
if (result.getResultCode() == RESULT_OK) {
Intent data = result.getData();
if (data != null) {
Uri imageUri = data.getData();
file_b = getImagePath(imageUri);
Glide.with(user_editing.this)
.load(file_b)
.error(R.drawable.icon)
.into(imageViewb);
// 处理选择的图片
}
}
});
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityUserEditingBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
imageViewa = findViewById(R.id.image1);
edit_name = findViewById(R.id.edit_name);
edit_qianming = findViewById(R.id.edit_qianming);
imageViewb = findViewById(R.id.image2);
new Thread() {
@Override
public void run() {
super.run();
try {
// user_message.string string = user_message.get();
/*
main.handler.post(() -> {
Glide.with(user_editing.this)
.load(string.headIcon())
.into(imageViewa);
edit_name.setText(string.userName());
edit_qianming.setText(string.introduce());
Glide.with(user_editing.this)
.load(string.cover())
.into(imageViewb);
String gender = string.gender();
if (gender.equals("1")) {
gender = "";
} else {
gender = "";
}
binding.autoComplete.setText(gender);
});*/
} catch (Exception e) {
gj.sc(e);
}
}
}.start();
View.OnClickListener onClickListener = view -> {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_MIME_TYPES, new String[]{"image/jpeg", "image/png", "image/jpg", "image/gif"}); // 指定可选的文件类型
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true); // 仅显示本地存储的文件
// 检查权限
if (ContextCompat.checkSelfPermission(user_editing.this,
Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
// 如果没有写入存储的权限则请求权限
ActivityCompat.requestPermissions(user_editing.this,
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
1);
} else {
if (view.getId() == R.id.image1) {
setimagea.launch(new Intent(Intent.ACTION_PICK,
MediaStore.Images.Media.EXTERNAL_CONTENT_URI));
} else if (view.getId() == R.id.image2) {
setimageb.launch(new Intent(Intent.ACTION_PICK,
MediaStore.Images.Media.EXTERNAL_CONTENT_URI));
}
}
};
imageViewa.setOnClickListener(onClickListener);
imageViewb.setOnClickListener(onClickListener);
binding.userEnd.setOnClickListener(view ->{
finish();
// main.settoken(null, null);
});
}
// 获取图片的实际路径
private String getImagePath(Uri uri) {
String path = null;
String[] projection = {MediaStore.Images.Media.DATA};
Cursor cursor = getContentResolver().query(uri, projection, null, null, null);
if (cursor != null) {
int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
if (cursor.moveToFirst()) {
path = cursor.getString(columnIndex);
}
cursor.close();
}
return path;
}
}

View File

@ -3,6 +3,7 @@ package com.muqingbfq;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
@ -14,12 +15,15 @@ import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatDelegate;
import com.google.gson.reflect.TypeToken;
import com.muqingbfq.login.visitor;
import com.muqingbfq.mq.FloatingLyricsService;
import com.muqingbfq.mq.wj;
import com.muqingbfq.mq.wl;
import java.io.File;
import java.lang.reflect.Type;
import java.util.List;
public class main extends Application {
public static Application application;
@ -86,6 +90,32 @@ public class main extends Application {
}
AppCompatDelegate.setDefaultNightMode(i);
String jsonList = this.getSharedPreferences("list", Context.MODE_PRIVATE)
.getString("listData", null); // 获取保存的 JSON 字符串
if (jsonList != null) {
Type type = new TypeToken<List<MP3>>() {
}.getType();
bfqkz.list = new com.google.gson.Gson().fromJson(jsonList, type);
// JSON 字符串转换回列表数据
}
bfqkz.xm = wj.getMP3FromFile();
if (bfqkz.xm != null) {
new Thread() {
@Override
public void run() {
super.run();
MP3 hq = com.muqingbfq.api.url.hq(bfqkz.xm);
if (hq == null) {
return;
}
try {
bfqkz.mt.DataSource(hq);
} catch (Exception e) {
com.muqingbfq.mq.gj.sc(e);
}
}
}.start();
}
registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
@Override
@ -122,7 +152,7 @@ public class main extends Application {
try {
sleep(1000);
} catch (InterruptedException e) {
e.toString();
e.printStackTrace();
}
// gj.sc(count);
if (count != 0) {

View File

@ -0,0 +1,30 @@
package com.muqingbfq.mq;
import android.os.Bundle;
import android.view.LayoutInflater;
import androidx.annotation.Nullable;
import androidx.viewbinding.ViewBinding;
import com.jaeger.library.StatusBarUtil;
public abstract class AppCompatActivity<ViewBindingType extends ViewBinding> extends androidx.appcompat.app.AppCompatActivity {
protected abstract ViewBindingType getViewBindingObject(LayoutInflater layoutInflater);
protected ViewBindingType getViewBinding() {
binding = getViewBindingObject(getLayoutInflater());
return binding;
}
public ViewBindingType binding;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
StatusBarUtil.setTransparent(this);
setContentView(getViewBinding().getRoot());
UI(savedInstanceState);
}
protected abstract void UI(@Nullable Bundle savedInstanceState);
}

View File

@ -1,14 +1,26 @@
package com.muqingbfq.mq;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewbinding.ViewBinding;
import com.jaeger.library.StatusBarUtil;
import com.muqingbfq.R;
public class FragmentActivity extends AppCompatActivity {
public abstract class FragmentActivity<ViewBindingType extends ViewBinding>
extends androidx.appcompat.app.AppCompatActivity {
protected abstract ViewBindingType getViewBindingObject(LayoutInflater layoutInflater);
protected ViewBindingType getViewBinding() {
binding = getViewBindingObject(getLayoutInflater());
return binding;
}
public ViewBindingType binding;
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home) {
@ -29,6 +41,7 @@ public class FragmentActivity extends AppCompatActivity {
@Override
public void setContentView(View view) {
StatusBarUtil.setTransparent(this);
super.setContentView(view);
setToolbar();
}

View File

@ -17,7 +17,6 @@ import androidx.core.app.NotificationCompat;
import com.muqingbfq.MyButtonClickReceiver;
import com.muqingbfq.R;
import com.muqingbfq.bfq;
import com.muqingbfq.bfqkz;
import com.muqingbfq.yc;

View File

@ -14,7 +14,7 @@ import com.muqingbfq.main;
import com.muqingbfq.mq.gj;
public class CardImage extends MaterialCardView {
private ImageView imageView;
public ImageView imageView;
public CardImage(Context context) {
super(context);

View File

@ -5,6 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="?android:colorBackground"
android:orientation="vertical">
<com.google.android.material.appbar.MaterialToolbar
@ -33,59 +34,150 @@
android:id="@+id/zz"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:gravity="center_horizontal"
android:maxLines="1"
android:text="@string/zz"
android:textSize="20sp" />
</LinearLayout>
</com.google.android.material.appbar.MaterialToolbar>
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/fragment_bfq"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical">
<com.muqingbfq.view.CardImage
android:id="@+id/cardview"
android:layout_width="0dp"
android:layout_height="match_parent"
app:cardCornerRadius="16dp"
app:cardUseCompatPadding="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/lrcView"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_weight="1"/>
<me.wcy.lrcview.LrcView
android:id="@+id/lrcView"
android:layout_width="0dp"
android:layout_height="match_parent"
app:layout_constraintStart_toEndOf="@id/cardview"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_weight="1" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/bj"
android:paddingStart="6dp"
android:paddingTop="6dp"
android:paddingEnd="6dp"
android:paddingBottom="16dp">
<ImageView
android:id="@+id/like"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/like"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:tint="@color/text"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/download"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginStart="6dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/download"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/like"
app:tint="@color/text"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/control"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="16dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/mt_sx"
app:layout_constraintBottom_toBottomOf="@+id/syq"
app:layout_constraintEnd_toStartOf="@+id/syq"
app:layout_constraintTop_toTopOf="@+id/syq"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/syq"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="8dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/syq"
app:layout_constraintBottom_toBottomOf="@+id/kg"
app:layout_constraintEnd_toStartOf="@+id/kg"
app:layout_constraintTop_toTopOf="@+id/kg"
app:layout_constraintVertical_bias="0.5"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/kg"
android:layout_width="46dp"
android:layout_height="46dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/zt"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/control"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/xyq"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginStart="8dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:importantForAccessibility="no"
android:src="@drawable/xyq"
app:layout_constraintBottom_toBottomOf="@+id/kg"
app:layout_constraintStart_toEndOf="@+id/kg"
app:layout_constraintTop_toTopOf="@+id/kg"
app:layout_constraintVertical_bias="0.5" />
<ImageView
android:id="@+id/bfq_list_mp3"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/cd"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:ignore="ContentDescription" />
<LinearLayout
android:id="@+id/linearlayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/kp1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
tools:ignore="NestedWeights">
<com.muqingbfq.view.CardImage
android:id="@+id/cardview"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="16dp"
app:cardUseCompatPadding="true" />
</RelativeLayout>
<me.wcy.lrcview.LrcView
android:id="@+id/lrcView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/bj"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="3dp"
android:paddingEnd="3dp">
app:layout_constraintBottom_toTopOf="@+id/kg"
tools:layout_editor_absoluteX="20dp">
<TextView
android:id="@+id/time_a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/_00_00" />
android:text="@string/_00_00"
android:textSize="20sp" />
<com.google.android.material.slider.Slider
android:id="@+id/tdt"
@ -94,109 +186,16 @@
android:layout_weight="1"
app:labelBehavior="gone"
app:thumbColor="@color/thumbColor"
app:trackColorActive="@color/thumbColor"/>
app:trackColorActive="@color/thumbColor"
tools:ignore="SpeakableTextPresentCheck" />
<TextView
android:id="@+id/time_b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/_00_00" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:paddingBottom="16dp"
android:background="@color/bj"
android:baselineAligned="false"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:id="@+id/control"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="26dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/mt_sx"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/download"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
app:srcCompat="@drawable/download"
app:tint="@color/text"
android:layout_marginEnd="26dp"
tools:ignore="ContentDescription" />
android:text="@string/_00_00"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center">
<ImageView
android:id="@+id/syq"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="12dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/syq"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/kg"
android:layout_width="46dp"
android:layout_height="46dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/zt"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/xyq"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginStart="12dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:importantForAccessibility="no"
android:src="@drawable/xyq" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="end">
<ImageView
android:id="@+id/bfq_list_mp3"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="16dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/cd"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/like"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="26dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/like"
app:tint="@color/text"
tools:ignore="ContentDescription" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>

View File

@ -4,9 +4,10 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="?android:colorBackground"
android:fitsSystemWindows="true"
android:orientation="vertical">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
@ -33,62 +34,53 @@
android:id="@+id/zz"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:gravity="center_horizontal"
android:maxLines="1"
android:text="@string/zz"
android:textSize="20sp" />
</LinearLayout>
</com.google.android.material.appbar.MaterialToolbar>
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/fragment_bfq"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:id="@+id/linearlayout"
<com.muqingbfq.view.CardImage
android:id="@+id/cardview"
android:layout_width="256dp"
android:layout_height="256dp"
app:cardCornerRadius="16dp"
app:cardUseCompatPadding="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<me.wcy.lrcview.LrcView
android:id="@+id/lrcView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/kp1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
tools:ignore="NestedWeights">
<com.muqingbfq.view.CardImage
android:id="@+id/cardview"
android:layout_width="256dp"
android:layout_height="256dp"
app:cardCornerRadius="16dp"
app:cardUseCompatPadding="true" />
</RelativeLayout>
<me.wcy.lrcview.LrcView
android:id="@+id/lrcView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"/>
</LinearLayout>
</LinearLayout>
android:layout_height="match_parent"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:paddingStart="20dp"
android:background="@color/bj"
android:paddingEnd="20dp"
android:paddingStart="6dp"
android:paddingTop="6dp"
android:paddingEnd="6dp"
android:paddingBottom="26dp">
<ImageView
android:id="@+id/like"
android:layout_width="30dp"
android:layout_height="42dp"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/like"
app:layout_constraintBottom_toTopOf="@+id/linearLayout2"
@ -115,7 +107,8 @@
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/mt_sx"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/syq"
@ -178,8 +171,8 @@
android:id="@+id/time_a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="@string/_00_00" />
android:text="@string/_00_00"
android:textSize="20sp" />
<com.google.android.material.slider.Slider
android:id="@+id/tdt"
@ -188,14 +181,15 @@
android:layout_weight="1"
app:labelBehavior="gone"
app:thumbColor="@color/thumbColor"
app:trackColorActive="@color/thumbColor"/>
app:trackColorActive="@color/thumbColor"
tools:ignore="SpeakableTextPresentCheck" />
<TextView
android:id="@+id/time_b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="@string/_00_00" />
android:text="@string/_00_00"
android:textSize="20sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -16,11 +16,34 @@
android:textSize="26sp"
android:textColor="@color/text"/>
</com.google.android.material.appbar.MaterialToolbar>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/lb"
<RelativeLayout
android:layout_width="match_parent"
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
android:id="@+id/bfq_db"
android:layout_width="match_parent"

View File

@ -122,10 +122,12 @@ public class LrcView extends View {
public LrcView(Context context) {
this(context, null);
init(null);
}
public LrcView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
init(attrs);
}
public LrcView(Context context, AttributeSet attrs, int defStyleAttr) {
@ -135,8 +137,10 @@ public class LrcView extends View {
private void init(AttributeSet attrs) {
TypedArray ta = getContext().obtainStyledAttributes(attrs, R.styleable.LrcView);
mCurrentTextSize = ta.getDimension(R.styleable.LrcView_lrcTextSize, getResources().getDimension(R.dimen.lrc_text_size));
mNormalTextSize = ta.getDimension(R.styleable.LrcView_lrcNormalTextSize, getResources().getDimension(R.dimen.lrc_text_size));
mCurrentTextSize = ta.getDimension(R.styleable.LrcView_lrcTextSize,
getResources().getDimension(R.dimen.lrc_text_size));
mNormalTextSize = ta.getDimension(R.styleable.LrcView_lrcNormalTextSize,
getResources().getDimension(R.dimen.lrcNormalTextSize));
if (mNormalTextSize == 0) {
mNormalTextSize = mCurrentTextSize;
}

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="lrc_animation_duration">1000</integer>
<dimen name="lrc_text_size">16sp</dimen>
<dimen name="lrc_text_size">20sp</dimen>
<dimen name="lrcNormalTextSize">16sp</dimen>
<dimen name="lrc_time_text_size">12sp</dimen>
<dimen name="lrc_divider_height">16dp</dimen>
<dimen name="lrc_timeline_height">1dp</dimen>