From 830c84ffc5aa7dc3bd34c57ca9ceb34e827c1333 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Wed, 24 Jul 2024 19:21:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=BD=9C=E5=9C=A8=E6=A1=8C?= =?UTF-8?q?=E9=9D=A2=E6=AD=8C=E8=AF=8D=E5=AF=BC=E8=87=B4=E7=9A=84=E5=B4=A9?= =?UTF-8?q?=E6=BA=83=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/toside/music/mobile/lyric/LyricSwitchView.java | 5 ++++- .../main/java/cn/toside/music/mobile/lyric/LyricView.java | 4 +++- publish/changeLog.md | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/android/app/src/main/java/cn/toside/music/mobile/lyric/LyricSwitchView.java b/android/app/src/main/java/cn/toside/music/mobile/lyric/LyricSwitchView.java index edfb9fdae..3678963e4 100644 --- a/android/app/src/main/java/cn/toside/music/mobile/lyric/LyricSwitchView.java +++ b/android/app/src/main/java/cn/toside/music/mobile/lyric/LyricSwitchView.java @@ -120,6 +120,7 @@ public Animation outAnim(String str, float height) { } private void setAnima() { + if (textView == null) return; if (isShowAnima) { float size = textView.getTextSize(); setInAnimation(inAnim("top", size)); @@ -141,7 +142,9 @@ public CharSequence getText() { } 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) { diff --git a/android/app/src/main/java/cn/toside/music/mobile/lyric/LyricView.java b/android/app/src/main/java/cn/toside/music/mobile/lyric/LyricView.java index 31624eca7..32c999908 100644 --- a/android/app/src/main/java/cn/toside/music/mobile/lyric/LyricView.java +++ b/android/app/src/main/java/cn/toside/music/mobile/lyric/LyricView.java @@ -138,6 +138,7 @@ private boolean updateWH() { } private void setLayoutParamsHeight() { + if (textView == null) return; int height = textView.getPaint().getFontMetricsInt(null) * maxLineNum; if (height > maxHeight - 100) height = maxHeight - 100; layoutParams.height = height; @@ -166,7 +167,7 @@ private void updateViewPosition() { int width = (int)(maxWidth * widthPercentage); if (layoutParams.width != width) { layoutParams.width = width; - textView.setWidth(width); + if (textView != null) textView.setWidth(width); } fixViewPosition(); @@ -382,6 +383,7 @@ public void setLyric(String text, ArrayList extendedLyrics) { } text = textBuilder.toString(); } + if (textView == null) return; textView.setText(text); } diff --git a/publish/changeLog.md b/publish/changeLog.md index 851e817c3..8b58a3342 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -6,6 +6,10 @@ - 新增重复歌曲列表,可以方便移除我的列表中的重复歌曲,此列表会列出目标列表里歌曲名相同的歌曲,可在“我的列表”里的列表名菜单中使用(注:该功能与PC端的区别是可以点击歌曲名多选删除) - 新增打开当前歌曲详情页菜单,可以在歌曲菜单中使用 +### 修复 + +- 修复潜在桌面歌词导致的崩溃问题 + ### 其他 - 更新 React native 到 v0.73.9