From 157ca8a230f5e95299f95901118c52e4887dded4 Mon Sep 17 00:00:00 2001 From: MUQING <1966944300@qq.com> Date: Sun, 3 Dec 2023 13:21:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=AD=8C=E5=8D=95=E6=90=9C?= =?UTF-8?q?=E7=B4=A2BUG=EF=BC=8C=E4=BF=AE=E5=A4=8D=E5=B9=B3=E6=9D=BF?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E6=92=AD=E6=94=BE=E5=99=A8=E6=98=BE=E7=A4=BA?= =?UTF-8?q?BUG=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=B6=B2=E5=B7=B2=E7=9F=A5?= =?UTF-8?q?=E7=9A=84=E6=AD=8C=E5=8D=95=E6=93=8D=E4=BD=9CBUG=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=92=AD=E6=94=BE=E5=99=A8UI=E6=89=8B=E5=8A=BF?= =?UTF-8?q?=EF=BC=8C=E5=AE=8C=E5=96=84=E6=92=AD=E6=94=BE=E5=99=A8=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=86=85=E9=83=A8=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/muqingbfq/MediaPlayer.java | 2 +- app/src/main/java/com/muqingbfq/bfq.java | 26 +++++++------------ app/src/main/java/com/muqingbfq/bfq_an.java | 2 +- .../java/com/muqingbfq/fragment/Media.java | 10 ++++--- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/com/muqingbfq/MediaPlayer.java b/app/src/main/java/com/muqingbfq/MediaPlayer.java index 0ebc856..ec4d92d 100644 --- a/app/src/main/java/com/muqingbfq/MediaPlayer.java +++ b/app/src/main/java/com/muqingbfq/MediaPlayer.java @@ -167,7 +167,7 @@ public class MediaPlayer { Media.setProgress(0); Media.setname(name); Media.setzz(zz); - bfq_an.islike(Media.view.getContext()); + bfq_an.islike(); } bfq_db.setname(name); bfq_db.setzz(zz); diff --git a/app/src/main/java/com/muqingbfq/bfq.java b/app/src/main/java/com/muqingbfq/bfq.java index 8904afe..e9437a6 100644 --- a/app/src/main/java/com/muqingbfq/bfq.java +++ b/app/src/main/java/com/muqingbfq/bfq.java @@ -29,7 +29,7 @@ import org.json.JSONObject; public class bfq extends AppCompatActivity { @SuppressLint("StaticFieldLeak") public static AppCompatActivity context; - ActivityBfqBinding inflate; + public ActivityBfqBinding inflate; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { @@ -56,15 +56,6 @@ public class bfq extends AppCompatActivity { } return false; }); - if (bfqkz.xm != null) { - Media.setname(bfqkz.xm.name); - Media.setzz(bfqkz.xm.zz); - } -/* inflate.name.setOnLongClickListener(view -> { - gj.fz(bfq.this, inflate.name.getText().toString()); - gj.ts(bfq.this, "倍刢成功"); - return false; - });*/ bfq_an.kz kz = new bfq_an.kz(); inflate.kg.setOnClickListener(kz); inflate.xyq.setOnClickListener(kz); @@ -74,18 +65,17 @@ 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)); + inflate.like + .setImageTintList(ContextCompat.getColorStateList(bfq.this, R.color.text)); com.muqingbfq.fragment.gd.like.remove(String.valueOf(bfqkz.xm.id)); } else { - like.setImageTintList(ContextCompat. + inflate.like.setImageTintList(ContextCompat. getColorStateList(bfq.this, android.R.color.holo_red_dark)); JSONObject json = new JSONObject(); json.put("name", bfqkz.xm.name); @@ -100,7 +90,11 @@ public class bfq extends AppCompatActivity { e.printStackTrace(); } }); - + if (bfqkz.xm != null) { + Media.setname(bfqkz.xm.name); + Media.setzz(bfqkz.xm.zz); + bfq_an.islike(); + } } public static Bitmap bitmap; diff --git a/app/src/main/java/com/muqingbfq/bfq_an.java b/app/src/main/java/com/muqingbfq/bfq_an.java index db8d64c..45def3a 100644 --- a/app/src/main/java/com/muqingbfq/bfq_an.java +++ b/app/src/main/java/com/muqingbfq/bfq_an.java @@ -95,7 +95,7 @@ public class bfq_an { public static String getTime(long time) { return simpleDateFormat.format(new Date(time)); } - public static void islike(Context context) { + public static void islike() { try { gd.like.getJSONObject(String.valueOf(bfqkz.xm.id)); bfqkz.like_bool = true; diff --git a/app/src/main/java/com/muqingbfq/fragment/Media.java b/app/src/main/java/com/muqingbfq/fragment/Media.java index 049ec4d..c1d8ccc 100644 --- a/app/src/main/java/com/muqingbfq/fragment/Media.java +++ b/app/src/main/java/com/muqingbfq/fragment/Media.java @@ -25,6 +25,7 @@ import com.muqingbfq.bfqkz; import com.muqingbfq.databinding.FragmentBfqBinding; import com.muqingbfq.home; import com.muqingbfq.main; +import com.muqingbfq.mq.gj; import org.json.JSONObject; @@ -171,13 +172,16 @@ public class Media extends Fragment { } public static void setlike(boolean bool) { - ImageView imageView = bfq.findViewById(R.id.like); + if (bfq == null || bfq.inflate == null) { + return; + } int color = R.color.text; if (bool) { color = android.R.color.holo_red_dark; } - imageView.setImageTintList(ContextCompat. - getColorStateList(view.getContext(), color)); + gj.sc(color); + bfq.inflate.like.setImageTintList(ContextCompat. + getColorStateList(com.muqingbfq.bfq.context, color)); } public static void setImageBitmap() {