Skip to content

Commit

Permalink
ui fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
prapooskur committed Oct 20, 2024
1 parent e65366c commit 4212c3a
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 12 deletions.
Binary file not shown.
Binary file not shown.
19 changes: 18 additions & 1 deletion app/composeApp/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,22 @@
"outputFile": "composeApp-release.apk"
}
],
"elementType": "File"
"elementType": "File",
"baselineProfiles": [
{
"minApi": 28,
"maxApi": 30,
"baselineProfiles": [
"baselineProfiles/1/composeApp-release.dm"
]
},
{
"minApi": 31,
"maxApi": 2147483647,
"baselineProfiles": [
"baselineProfiles/0/composeApp-release.dm"
]
}
],
"minSdkVersionForDexing": 24
}
4 changes: 2 additions & 2 deletions app/composeApp/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<!-- Accepts URIs that begin with "http://www.example.com/gizmos” -->
<data android:scheme="https"
android:host="pisa.ucsc.edu"
android:pathPrefix="/class_search" />
android:pathPattern="/class_search/index.php" />
<!-- note that the leading "/" is required for pathPrefix-->
</intent-filter>

Expand All @@ -52,7 +52,7 @@
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "example://gizmos" -->
<data android:scheme="slugcourses"
android:host="/detail" />
android:host="detail" />
</intent-filter>
</activity>
</application>
Expand Down
7 changes: 4 additions & 3 deletions app/composeApp/src/commonMain/kotlin/ChatScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@ class ChatScreen : Screen {
contentAlignment = Alignment.Center
) {
Scaffold(
modifier = Modifier.widthIn(max = 1200.dp),
modifier = Modifier.widthIn(max = 1200.dp).systemBarsPadding(),
content = { paddingValues ->
Logger.d(paddingValues.toString(), tag =TAG )
LazyColumn(
Modifier
.padding(paddingValues)
.padding(paddingValues=paddingValues)
.padding(horizontal = 8.dp)
.fillMaxSize(),
verticalArrangement = Arrangement.Bottom,
Expand Down Expand Up @@ -151,7 +152,7 @@ class ChatScreen : Screen {
}
)
// kinda cursed but no better way to get padding for taskbar without messing up other insets
Spacer(Modifier.padding(WindowInsets.navigationBars.asPaddingValues()))
// Spacer(Modifier.padding(WindowInsets.navigationBars.asPaddingValues()))
}
}
)
Expand Down
34 changes: 29 additions & 5 deletions app/composeApp/src/commonMain/kotlin/ResultsScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import androidx.compose.runtime.*
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -204,12 +206,14 @@ data class ResultsScreen(
val uiState by screenModel.uiState.collectAsState()
val coroutineScope = rememberCoroutineScope()

var searchTopBarHeight by remember { mutableStateOf(0.dp) }
val density = LocalDensity.current // Get density in composable context

Row(Modifier.fillMaxSize()) {
// List pane
var searchQuery by rememberSaveable{ mutableStateOf(query) }
Column(Modifier.fillMaxHeight().weight(0.5f)) {
Scaffold(
contentWindowInsets = WindowInsets(0.dp),
topBar = {
SearchTopBar(
searchQuery,
Expand All @@ -222,6 +226,12 @@ data class ResultsScreen(
onBack = {
navigator.pop()
},
modifier = Modifier.padding(bottom=8.dp).onGloballyPositioned { coordinates ->
// Convert pixels to dp
searchTopBarHeight = with(density) {
coordinates.size.height.toDp()
}
}
)
},
content = { paddingValues ->
Expand All @@ -246,7 +256,7 @@ data class ResultsScreen(
},
)

Box(Modifier.pullRefresh(pullRefreshState).padding(paddingValues)) {
Box(Modifier.pullRefresh(pullRefreshState).padding(top = paddingValues.calculateTopPadding())) {
LazyColumn(
modifier = Modifier
.fillMaxSize(),
Expand Down Expand Up @@ -316,11 +326,11 @@ data class ResultsScreen(
)
}
},
modifier = Modifier.heightIn(min=56.dp)
modifier = Modifier.height(searchTopBarHeight)
)
},
content = { paddingValues ->
Box(Modifier.padding(paddingValues).fillMaxSize()) {
Box(Modifier.fillMaxSize().padding(top = paddingValues.calculateTopPadding()+8.dp)) {
CourseDetailPane(
courseInfo = courseInfo,
courseUrl = uiState.detailPane.selectedUrl,
Expand Down Expand Up @@ -437,4 +447,18 @@ data class ResultsScreen(
searchType
)
}
}
}

/*
@Preview
@Composable
fun ResultsPreview() {
ResultsScreen(
term=2248,
query="",
type = listOf(Type.IN_PERSON,Type.HYBRID,Type.SYNC_ONLINE,Type.ASYNC_ONLINE),
genEd = emptyList(),
searchType = ""
)
}
*/
3 changes: 2 additions & 1 deletion app/composeApp/src/commonMain/kotlin/SettingsScreen.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.*
Expand Down Expand Up @@ -31,7 +32,7 @@ class SettingsScreen : Screen {
val showChat = settingsRepository.getShowChatFlow().collectAsState(initial = settingsRepository.getShowChat()).value
val showFavorites = settingsRepository.getShowFavoritesFlow().collectAsState(initial = settingsRepository.getShowFavorites()).value

Column {
Column(Modifier.fillMaxSize()) {
BoringNormalTopBar(titleText = "Settings", onBack = { navigator.pop() }, showBack = false)
LazyColumn {
item {
Expand Down

0 comments on commit 4212c3a

Please sign in to comment.