Skip to content

Commit 47ddaed

Browse files
Refactor Settings Compose Setup
This PR refines the Settings screen setup using Jetpack Compose: * **Navigation Routing**: Updated navigation logic to use **Serialized Routes**, as recommended in the [official Compose navigation documentation](https://developer.android.com/develop/ui/compose/navigation). * **Screen Title Management**: Migrated screen title handling to a Compose-native approach instead of using `addOnDestinationChangedListener`. * **Toolbar Enhancements**: * Refined the toolbar layout and styling to improve alignment with Material theming. * Implemented proper ripple effects and consistent color usage. * Fixed back navigation behavior to align with Compose conventions. * **Theming Note**: The current Compose-based theme system does not yet fully replicate the color palette used in the legacy (pre-Compose) implementation, especially across different services. A `TODO` has been added in code, and a separate task will be created to address this comprehensively.
1 parent 7eec974 commit 47ddaed

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

app/src/main/java/org/schabi/newpipe/ui/Toolbar.kt

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.RowScope
77
import androidx.compose.foundation.layout.fillMaxSize
88
import androidx.compose.foundation.layout.fillMaxWidth
99
import androidx.compose.foundation.layout.padding
10+
import androidx.compose.foundation.lazy.LazyColumn
1011
import androidx.compose.foundation.rememberScrollState
1112
import androidx.compose.foundation.text.input.rememberTextFieldState
1213
import androidx.compose.foundation.verticalScroll
@@ -143,19 +144,21 @@ fun Toolbar(
143144
}
144145
}
145146
} else {
146-
Column(Modifier.verticalScroll(rememberScrollState())) {
147+
LazyColumn(Modifier.verticalScroll(rememberScrollState())) {
147148
searchResults.forEach { result ->
148-
ListItem(
149-
headlineContent = {
150-
SearchSuggestionItem(result)
151-
},
152-
modifier = Modifier
153-
.clickable {
154-
textFieldState.edit { replace(0, length, result) }
155-
expanded = false
156-
}
157-
.fillMaxWidth()
158-
)
149+
item {
150+
ListItem(
151+
headlineContent = {
152+
SearchSuggestionItem(result)
153+
},
154+
modifier = Modifier
155+
.clickable {
156+
textFieldState.edit { replace(0, length, result) }
157+
expanded = false
158+
}
159+
.fillMaxWidth()
160+
)
161+
}
159162
}
160163
}
161164
}

0 commit comments

Comments
 (0)