修复歌单搜索BUG,修复平板模式播放器显示BUG,修复液已知的歌单操作BUG

添加播放器UI手势,完善播放器控制内部组件
This commit is contained in:
muqing 2023-12-03 13:00:14 +08:00
parent 5e39127b19
commit 137a7135e7
4 changed files with 50 additions and 40 deletions

View File

@ -12,16 +12,20 @@ import android.os.Bundle;
import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import com.muqingbfq.databinding.ActivityBfqBinding;
import com.muqingbfq.fragment.Media;
import org.json.JSONObject;
public class bfq extends AppCompatActivity {
@SuppressLint("StaticFieldLeak")
public static AppCompatActivity context;
@ -70,8 +74,33 @@ public class bfq extends AppCompatActivity {
inflate.control.setOnClickListener(new bfq_an.control(inflate.control));
if (bfqkz.mt != null && bfqkz.mt.build.isPlaying()) {
inflate.kg.setImageResource(R.drawable.bf);
bfq_an.islike(this);
}
text();
inflate.like.setOnClickListener(view1 -> {
ImageView like = (ImageView) view1;
try {
if (bfqkz.like_bool) {
like.setImageTintList(ContextCompat.getColorStateList(bfq.this, R.color.text));
com.muqingbfq.fragment.gd.like.remove(String.valueOf(bfqkz.xm.id));
} else {
like.setImageTintList(ContextCompat.
getColorStateList(bfq.this, android.R.color.holo_red_dark));
JSONObject json = new JSONObject();
json.put("name", bfqkz.xm.name);
json.put("zz", bfqkz.xm.zz);
json.put("picUrl", bfqkz.xm.picurl);
com.muqingbfq.fragment.gd.like.put(String.valueOf(bfqkz.xm.id), json);
}
com.muqingbfq.mq.wj.xrwb(com.muqingbfq.mq.wj.mp3_like,
com.muqingbfq.fragment.gd.like.toString());
bfqkz.like_bool = !bfqkz.like_bool;
} catch (Exception e) {
e.printStackTrace();
}
});
}
public static Bitmap bitmap;

View File

@ -133,28 +133,6 @@ public class Media extends Fragment {
});
}
//初始化播放器列表
bfq.findViewById(R.id.like).setOnClickListener(view1 -> {
ImageView like = (ImageView) view1;
try {
if (bfqkz.like_bool) {
like.setImageTintList(ContextCompat.getColorStateList(view.getContext(), R.color.text));
com.muqingbfq.fragment.gd.like.remove(String.valueOf(bfqkz.xm.id));
} else {
like.setImageTintList(ContextCompat.
getColorStateList(view.getContext(), android.R.color.holo_red_dark));
JSONObject json = new JSONObject();
json.put("name", bfqkz.xm.name);
json.put("zz", bfqkz.xm.zz);
json.put("picUrl", bfqkz.xm.picurl);
com.muqingbfq.fragment.gd.like.put(String.valueOf(bfqkz.xm.id), json);
}
com.muqingbfq.mq.wj.xrwb(com.muqingbfq.mq.wj.mp3_like,
com.muqingbfq.fragment.gd.like.toString());
bfqkz.like_bool = !bfqkz.like_bool;
} catch (Exception e) {
e.printStackTrace();
}
});
if (bfqkz.xm != null) {
main.handler.removeCallbacks(bfqkz.mt.updateSeekBar); // 在播放开始时启动更新进度
long duration = bfqkz.mt.build.getDuration();
@ -163,7 +141,7 @@ public class Media extends Fragment {
long position = bfqkz.mt.build.getCurrentPosition();
setProgress((int) position);
main.handler.post(bfqkz.mt.updateSeekBar); // 在播放开始时启动更新进度
bfq_an.islike(com.muqingbfq.bfq.context);
new Thread() {
@Override
public void run() {
@ -176,7 +154,9 @@ public class Media extends Fragment {
}
private boolean isTablet(Context context) {
return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
return (context.getResources().
getConfiguration().screenLayout &
Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
public static LrcView getlrcView() {

View File

@ -46,6 +46,23 @@
android:layout_weight="1"
tools:layout="@layout/fragment_bfq" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<ImageView
android:id="@+id/like"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@mipmap/like"
app:tint="@color/text"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -40,22 +40,6 @@
tools:ignore="MissingConstraints" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<ImageView
android:id="@+id/like"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@mipmap/like"
app:tint="@color/text"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"