修复BUG,更新UI

This commit is contained in:
muqing 2024-02-04 16:57:24 +08:00
parent 847d857fee
commit 69ce2897fe

View File

@ -39,7 +39,6 @@ public class bfq_db extends Fragment implements GestureDetector.OnGestureListene
if (bfqkz.mt == null) {
return;
}
// gj.sc(isMusicServiceBound);播放/暂停按钮点击事件 if (isMusicServiceBound)
if (bfqkz.mt.isPlaying()) {
bfqkz.mt.pause();
} else {
@ -47,7 +46,6 @@ public class bfq_db extends Fragment implements GestureDetector.OnGestureListene
}
// setkg(bfqkz.mt.isPlaying());
});
binding.txb.setOnClickListener(view -> bflb_db.start(getContext()));
gestureDetector = new GestureDetector(getContext(), this);
binding.getRoot().setOnTouchListener((view, motionEvent) -> {
@ -77,8 +75,9 @@ public class bfq_db extends Fragment implements GestureDetector.OnGestureListene
super.onPause();
handler.removeCallbacks(runnable);
}
MP3 mp3;
boolean isPlaying = false;
boolean isPlaying = false, isvisible = false;
Handler handler = new Handler();
Runnable runnable = new Runnable() {
@Override
@ -90,6 +89,14 @@ public class bfq_db extends Fragment implements GestureDetector.OnGestureListene
if (bfqkz.mt != null && bfqkz.mt.isPlaying() != isPlaying) {
setkg(bfqkz.mt.isPlaying());
}
if (isvisible != bfqkz.list.isEmpty()) {
isvisible = bfqkz.list.isEmpty();
if (isvisible) {
binding.getRoot().setVisibility(View.GONE);
} else {
binding.getRoot().setVisibility(View.VISIBLE);
}
}
handler.postDelayed(this, 1000);
}
};