桌面歌词的最大字体大小允许调整到500

This commit is contained in:
lyswhut 2022-05-18 15:45:24 +08:00
parent 5d00d81b43
commit 9438c5e1b9
3 changed files with 13 additions and 5 deletions

View File

@ -131,6 +131,12 @@ public class LyricView extends Activity implements View.OnTouchListener {
return true;
}
private void setLayoutParamsHeight() {
int height = textView.getPaint().getFontMetricsInt(null) * maxLineNum + 8;
if (height > maxHeight - 100) height = maxHeight - 100;
layoutParams.height = height;
}
private void fixViewPosition() {
int maxX = maxWidth - layoutParams.width;
int x = (int)(maxWidth * prevViewPercentageX);
@ -138,6 +144,8 @@ public class LyricView extends Activity implements View.OnTouchListener {
else if (x > maxX) x = maxX;
if (layoutParams.x != x) layoutParams.x = x;
setLayoutParamsHeight();
int maxY = maxHeight - layoutParams.height;
int y = (int)(maxHeight * prevViewPercentageY);
if (y < 0) y = 0;
@ -309,8 +317,7 @@ public class LyricView extends Activity implements View.OnTouchListener {
// layoutParams.width= DisplayUtil.dp2px(mContext,55);
// layoutParams.height= DisplayUtil.dp2px(mContext,55);
layoutParams.width = (int)(maxWidth * widthPercentage);
// layoutParams.height = 100;
layoutParams.height = textView.getPaint().getFontMetricsInt(null) * maxLineNum + 8;
setLayoutParamsHeight();
//显示位置与指定位置的相对位置差
layoutParams.x = (int)(maxWidth * prevViewPercentageX);
@ -343,7 +350,7 @@ public class LyricView extends Activity implements View.OnTouchListener {
if (textView == null) return;
this.maxLineNum = maxLineNum;
textView.setMaxLines(maxLineNum);
layoutParams.height = textView.getPaint().getFontMetricsInt(null) * maxLineNum + 8;
setLayoutParamsHeight();
int maxY = maxHeight - layoutParams.height;
int y = layoutParams.y;
@ -515,7 +522,7 @@ public class LyricView extends Activity implements View.OnTouchListener {
this.textSize = size;
if (windowManager == null || textView == null) return;
textView.setTextSize(size);
layoutParams.height = textView.getPaint().getFontMetricsInt(null) * maxLineNum + 8;
setLayoutParamsHeight();
windowManager.updateViewLayout(textView, layoutParams);
}

View File

@ -13,6 +13,7 @@
- 允许桌面歌词拖动到状态栏上(感谢@ftevxk
- 允许选择更新日志弹窗里的文本内容
- 桌面歌词的最大字体大小允许调整到500#107
### 修复

View File

@ -33,7 +33,7 @@ export default memo(() => {
<Text style={{ color: theme.secondary10 }}>{isSliding ? sliderSize : fontSize}</Text>
<Slider
minimumValue={100}
maximumValue={360}
maximumValue={500}
onSlidingComplete={handleSlidingComplete}
onValueChange={handleValueChange}
onSlidingStart={handleSlidingStart}