修复歌词字体过大显示不全问题
This commit is contained in:
parent
9376cb4e8f
commit
62f3634fe7
|
@ -46,7 +46,8 @@ public class bfq extends AppCompatActivity {
|
|||
public static View view;
|
||||
public static String lrc;
|
||||
public static com.muqingbfq.view.LrcView lrcView;
|
||||
private void setLrc(){
|
||||
|
||||
private void setLrc() {
|
||||
lrcView = binding.lrcView;
|
||||
ViewGroup.LayoutParams layoutParams = binding.cardview.getLayoutParams();
|
||||
layoutParams.height = main.k - 100;
|
||||
|
@ -67,6 +68,7 @@ public class bfq extends AppCompatActivity {
|
|||
lrcView.setOnClickListener(null);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
|
@ -134,7 +136,7 @@ public class bfq extends AppCompatActivity {
|
|||
return;
|
||||
}
|
||||
if (bfqkz.xm != null) {
|
||||
new Thread(){
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
|
@ -206,7 +208,8 @@ public class bfq extends AppCompatActivity {
|
|||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
public boolean onTouch(View view, MotionEvent motionEvent) {LinearLayout root = binding.getRoot();
|
||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||
LinearLayout root = binding.getRoot();
|
||||
switch (motionEvent.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
downY = motionEvent.getRawY();
|
||||
|
@ -217,7 +220,7 @@ public class bfq extends AppCompatActivity {
|
|||
//移动的距离
|
||||
float dy = moveY - downY;
|
||||
//重新设置控件的位置。移动
|
||||
if (dy <= 0) {
|
||||
if (dy < 0) {
|
||||
return true;
|
||||
} else if (dy > main.g - main.g / 5.0) {
|
||||
finish();
|
||||
|
@ -244,6 +247,7 @@ public class bfq extends AppCompatActivity {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setlike(boolean bool) {
|
||||
if (binding == null) {
|
||||
return;
|
||||
|
|
|
@ -81,12 +81,12 @@ public class gd_adapter extends Fragment {
|
|||
MP3 x = listmp3.get(position);
|
||||
holder.binding.wb1.setText(x.name);
|
||||
holder.binding.zz.setText(x.zz);
|
||||
int color = ContextCompat.getColor(getContext(), R.color.text);
|
||||
/* int color = ContextCompat.getColor(getContext(), R.color.text);
|
||||
if (bfqkz.xm != null && x.id.equals(bfqkz.xm.id)) {
|
||||
color = ContextCompat.getColor(getContext(), R.color.text_cz);
|
||||
}
|
||||
holder.binding.wb1.setTextColor(color);
|
||||
holder.binding.zz.setTextColor(color);
|
||||
holder.binding.zz.setTextColor(color);*/
|
||||
holder.itemView.setOnClickListener(view -> {
|
||||
if (bfqkz.xm == null || !bfqkz.xm.id.equals(x.id)) {
|
||||
bfqkz.xm = x;
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.graphics.PixelFormat;
|
|||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
@ -35,16 +36,36 @@ public class FloatingLyricsService extends Service implements View.OnClickListen
|
|||
public Runnable updateSeekBar = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (bfqkz.mt.isPlaying() && lrcView != null) {
|
||||
long position = bfqkz.mt.getCurrentPosition();
|
||||
lrcView.setTimeLrc(position);
|
||||
if (bfqkz.mt.isPlaying()) {
|
||||
int index = 0;
|
||||
for (int i = 0; i < LrcView.lrclist.size(); i++) {
|
||||
LrcView.LRC lineLrc = LrcView.lrclist.get(i);
|
||||
if (lineLrc.time <= bfqkz.mt.getCurrentPosition()) {
|
||||
index = i;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index < LrcView.lrclist.size()) {
|
||||
String text;
|
||||
if (LrcView.lrclist.size() <= 3) {
|
||||
for (LrcView.LRC a : LrcView.lrclist) {
|
||||
if (a.time == 5940000 && a.lrc.equals("纯音乐,请欣赏")) {
|
||||
text = "纯音乐,请欣赏";
|
||||
binding.lrcView.setText(text);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
LrcView.LRC currentLrc = LrcView.lrclist.get(index);
|
||||
text = currentLrc.lrc;
|
||||
if (currentLrc.tlyric != null) {
|
||||
text += "\n" + currentLrc.tlyric;
|
||||
}
|
||||
binding.lrcView.setText(text);
|
||||
}
|
||||
}
|
||||
/* boolean appInForeground = gj.isAppInForeground(FloatingLyricsService.this);
|
||||
if (appInForeground) {
|
||||
layout.setVisibility(View.GONE);
|
||||
} else {
|
||||
layout.setVisibility(View.VISIBLE);
|
||||
}*/
|
||||
// gj.sc(getClass()+"执行");
|
||||
handler.postDelayed(this, 1000); // 每秒更新一次进度
|
||||
}
|
||||
};
|
||||
|
@ -65,7 +86,7 @@ public class FloatingLyricsService extends Service implements View.OnClickListen
|
|||
}
|
||||
|
||||
Handler handler = new Handler();
|
||||
LrcView lrcView;
|
||||
FloatLrcviewBinding binding;
|
||||
WindowManager.LayoutParams params;
|
||||
|
||||
public static class SETUP {
|
||||
|
@ -104,7 +125,7 @@ public class FloatingLyricsService extends Service implements View.OnClickListen
|
|||
}
|
||||
// 创建悬浮窗歌词的 View
|
||||
// FloatLrcviewBinding
|
||||
FloatLrcviewBinding binding = FloatLrcviewBinding.inflate(LayoutInflater.from(this));
|
||||
binding = FloatLrcviewBinding.inflate(LayoutInflater.from(this));
|
||||
layout = binding.getRoot();
|
||||
layout.setOnTouchListener(this);
|
||||
// int i = WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;FLAG_NOT_TOUCH_MODAL
|
||||
|
@ -120,10 +141,11 @@ public class FloatingLyricsService extends Service implements View.OnClickListen
|
|||
|
||||
params.y = setup.Y;
|
||||
|
||||
lrcView = binding.lrcView;
|
||||
lrcView.setTextColor(setup.Color);
|
||||
lrcView.setSize(setup.size);
|
||||
lrcView.setAlpha(setup.Alpha);
|
||||
binding.lrcView.setAlpha(setup.Alpha);
|
||||
binding.lrcView.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX,
|
||||
setup.size,
|
||||
getResources().getDisplayMetrics()));
|
||||
binding.lrcView.setTextColor(Color.parseColor(setup.Color));
|
||||
|
||||
bfq_an.kz bfqAn = new bfq_an.kz();
|
||||
binding.kg.setOnClickListener(this);
|
||||
|
@ -138,7 +160,7 @@ public class FloatingLyricsService extends Service implements View.OnClickListen
|
|||
if (setup.i == 2) {
|
||||
params.flags = lock();
|
||||
layout.setBackground(null);
|
||||
lrcView.setAlpha(setup.Alpha);
|
||||
binding.lrcView.setAlpha(setup.Alpha);
|
||||
layout.findViewById(com.muqingbfq.R.id.controlLayout).setVisibility(View.GONE);
|
||||
}
|
||||
windowManager.addView(layout, params);
|
||||
|
@ -228,8 +250,6 @@ public class FloatingLyricsService extends Service implements View.OnClickListen
|
|||
}
|
||||
} else if (id == R.id.lock) {
|
||||
setyc();
|
||||
} else if (id == R.id.like) {
|
||||
// bfq
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -237,7 +257,7 @@ public class FloatingLyricsService extends Service implements View.OnClickListen
|
|||
setup.i = 2;
|
||||
params.flags = lock();
|
||||
layout.setBackground(null);
|
||||
lrcView.setAlpha(setup.Alpha);
|
||||
binding.lrcView.setAlpha(setup.Alpha);
|
||||
layout.findViewById(com.muqingbfq.R.id.controlLayout).setVisibility(View.GONE);
|
||||
windowManager.updateViewLayout(layout, params);
|
||||
baocun();
|
||||
|
@ -247,7 +267,7 @@ public class FloatingLyricsService extends Service implements View.OnClickListen
|
|||
setup.i = 1;
|
||||
params.flags = lock();
|
||||
layout.setBackgroundColor(Color.parseColor("#50000000"));
|
||||
lrcView.setAlpha(1.0f);
|
||||
binding.lrcView.setAlpha(1.0f);
|
||||
layout.findViewById(com.muqingbfq.R.id.controlLayout).setVisibility(View.VISIBLE);
|
||||
windowManager.updateViewLayout(layout, params);
|
||||
baocun();
|
||||
|
|
|
@ -168,7 +168,7 @@ public class sz extends AppCompatActivity {
|
|||
binding.lrctext.setText(text);
|
||||
}
|
||||
}
|
||||
gj.sc(getClass()+"执行");
|
||||
// gj.sc(getClass()+"执行");
|
||||
main.handler.postDelayed(this, 1000); // 每秒更新一次进度
|
||||
}
|
||||
};
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:background="#50000000">
|
||||
|
||||
<com.muqingbfq.view.LrcView
|
||||
<TextView
|
||||
android:id="@+id/lrcView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_margin="20dp"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
Loading…
Reference in New Issue
Block a user