修复潜在桌面歌词导致的崩溃问题

This commit is contained in:
lyswhut 2024-07-24 19:21:40 +08:00
parent 0e612eee2d
commit 830c84ffc5
3 changed files with 11 additions and 2 deletions

View File

@ -120,6 +120,7 @@ public final class LyricSwitchView extends TextSwitcher {
} }
private void setAnima() { private void setAnima() {
if (textView == null) return;
if (isShowAnima) { if (isShowAnima) {
float size = textView.getTextSize(); float size = textView.getTextSize();
setInAnimation(inAnim("top", size)); setInAnimation(inAnim("top", size));
@ -141,7 +142,9 @@ public final class LyricSwitchView extends TextSwitcher {
} }
public TextPaint getPaint() { public TextPaint getPaint() {
return ((TextView)this.getCurrentView()).getPaint(); TextView v = (TextView)this.getCurrentView();
if (v == null) return null;
return v.getPaint();
} }
public void setWidth(int i) { public void setWidth(int i) {

View File

@ -138,6 +138,7 @@ public class LyricView extends Activity implements View.OnTouchListener {
} }
private void setLayoutParamsHeight() { private void setLayoutParamsHeight() {
if (textView == null) return;
int height = textView.getPaint().getFontMetricsInt(null) * maxLineNum; int height = textView.getPaint().getFontMetricsInt(null) * maxLineNum;
if (height > maxHeight - 100) height = maxHeight - 100; if (height > maxHeight - 100) height = maxHeight - 100;
layoutParams.height = height; layoutParams.height = height;
@ -166,7 +167,7 @@ public class LyricView extends Activity implements View.OnTouchListener {
int width = (int)(maxWidth * widthPercentage); int width = (int)(maxWidth * widthPercentage);
if (layoutParams.width != width) { if (layoutParams.width != width) {
layoutParams.width = width; layoutParams.width = width;
textView.setWidth(width); if (textView != null) textView.setWidth(width);
} }
fixViewPosition(); fixViewPosition();
@ -382,6 +383,7 @@ public class LyricView extends Activity implements View.OnTouchListener {
} }
text = textBuilder.toString(); text = textBuilder.toString();
} }
if (textView == null) return;
textView.setText(text); textView.setText(text);
} }

View File

@ -6,6 +6,10 @@
- 新增重复歌曲列表可以方便移除我的列表中的重复歌曲此列表会列出目标列表里歌曲名相同的歌曲可在“我的列表”里的列表名菜单中使用该功能与PC端的区别是可以点击歌曲名多选删除 - 新增重复歌曲列表可以方便移除我的列表中的重复歌曲此列表会列出目标列表里歌曲名相同的歌曲可在“我的列表”里的列表名菜单中使用该功能与PC端的区别是可以点击歌曲名多选删除
- 新增打开当前歌曲详情页菜单,可以在歌曲菜单中使用 - 新增打开当前歌曲详情页菜单,可以在歌曲菜单中使用
### 修复
- 修复潜在桌面歌词导致的崩溃问题
### 其他 ### 其他
- 更新 React native 到 v0.73.9 - 更新 React native 到 v0.73.9