Skip to content

Commit 5342225

Browse files
committed
Workaround for requestFocus exception in album view
1 parent 4d186ef commit 5342225

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/main/assets/changelog-alpha.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
/Alpha 353 (2024-07-05)
1+
/Alpha 354 (2024-07-06)
2+
Workaround for requestFocus exception in album view
3+
4+
/Alpha 353 (2024-07-06)
25
Improved gallery viewer with card, list, and grid modes
36
Improved network performance
47
Add Submitted Comments as an optional main menu user item (thanks to folkemat)

src/main/java/org/quantumbadger/redreader/compose/ui/AlbumScreen.kt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package org.quantumbadger.redreader.compose.ui
1919

20+
import android.util.Log
2021
import androidx.compose.foundation.ExperimentalFoundationApi
2122
import androidx.compose.foundation.background
2223
import androidx.compose.foundation.combinedClickable
@@ -169,10 +170,14 @@ fun AlbumScreen(
169170
// the screen, rather than the header at the top.
170171
// Only the `requestFocus()` call actually seems to have any effect here.
171172
LaunchedEffect(album) {
172-
focusManager.clearFocus()
173-
delay(1500)
174-
accessibilityFocusRequester.freeFocus()
175-
accessibilityFocusRequester.requestFocus()
173+
try {
174+
focusManager.clearFocus()
175+
delay(1500)
176+
accessibilityFocusRequester.freeFocus()
177+
accessibilityFocusRequester.requestFocus()
178+
} catch(e: Exception) {
179+
Log.e("AlbumScreen", "requestFocus exception", e)
180+
}
176181
}
177182

178183
DoOnce(album) {

0 commit comments

Comments
 (0)