mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
Fix issue with bottomsheet content being behind navbar
This commit is contained in:
parent
3b54be0d91
commit
012a8fe24f
8 changed files with 26 additions and 24 deletions
|
|
@ -61,11 +61,6 @@ class RealmInventoryLocalRepository(realm: Realm) :
|
|||
return realm.where(Equipment::class.java)
|
||||
.equalTo("klass", "armoire")
|
||||
.beginGroup()
|
||||
.equalTo("released", true)
|
||||
.or()
|
||||
.isNull("released")
|
||||
.endGroup()
|
||||
.beginGroup()
|
||||
.equalTo("owned", false)
|
||||
.or()
|
||||
.isNull("owned")
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ class ShopRecyclerAdapter : androidx.recyclerview.widget.RecyclerView.Adapter<Vi
|
|||
val sectionHolder = holder as? SectionViewHolder ?: return
|
||||
sectionHolder.bind(obj.text)
|
||||
sectionHolder.bind(obj.endDate)
|
||||
(sectionHolder.headerContainer.layoutParams as? LinearLayout.LayoutParams)?.topMargin = if (position > 1) {
|
||||
(sectionHolder.headerContainer?.layoutParams as? LinearLayout.LayoutParams)?.topMargin = if (position > 1) {
|
||||
40.dpToPx(context)
|
||||
} else {
|
||||
16.dpToPx(context)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import com.habitrpg.android.habitica.ui.views.CurrencyView
|
|||
import java.util.Date
|
||||
|
||||
class SectionViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
val headerContainer: LinearLayout = itemView.findViewById(R.id.header_container)
|
||||
val headerContainer: LinearLayout? = itemView.findViewById(R.id.header_container)
|
||||
private val label: TextView = itemView.findViewById(R.id.label)
|
||||
private val switchesInLabel: TextView? = itemView.findViewById(R.id.switches_in_label)
|
||||
private val selectionSpinner: Spinner? = itemView.findViewById(R.id.class_selection_spinner)
|
||||
|
|
|
|||
|
|
@ -6,13 +6,16 @@ import androidx.activity.compose.BackHandler
|
|||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.navigationBarsIgnoringVisibility
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.windowInsetsBottomHeight
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.BottomSheetScaffoldState
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.ModalBottomSheet
|
||||
import androidx.compose.material3.SheetState
|
||||
import androidx.compose.material3.SheetValue
|
||||
import androidx.compose.material3.rememberModalBottomSheetState
|
||||
import androidx.compose.runtime.Composable
|
||||
|
|
@ -50,6 +53,7 @@ fun Fragment.showAsBottomSheet(content: @Composable (() -> Unit) -> Unit) {
|
|||
}
|
||||
|
||||
// Helper method
|
||||
@OptIn(ExperimentalLayoutApi::class)
|
||||
private fun addContentToView(
|
||||
viewGroup: ViewGroup,
|
||||
content: @Composable (() -> Unit) -> Unit,
|
||||
|
|
@ -58,14 +62,16 @@ private fun addContentToView(
|
|||
ComposeView(viewGroup.context).apply {
|
||||
setContent {
|
||||
HabiticaTheme {
|
||||
BottomSheetWrapper(viewGroup, this, content)
|
||||
Column {
|
||||
BottomSheetWrapper(viewGroup, this@apply, content)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class)
|
||||
@Composable
|
||||
private fun BottomSheetWrapper(
|
||||
parent: ViewGroup,
|
||||
|
|
@ -79,18 +85,24 @@ private fun BottomSheetWrapper(
|
|||
|
||||
val systemUiController = rememberSystemUiController()
|
||||
val statusBarColor = colorResource(R.color.content_background)
|
||||
val navigationbarColor = colorResource(R.color.brand_50)
|
||||
DisposableEffect(systemUiController) {
|
||||
systemUiController.setStatusBarColor(statusBarColor.copy(alpha = 0.3f), darkIcons = true)
|
||||
onDispose {}
|
||||
systemUiController.setNavigationBarColor(navigationbarColor, darkIcons = true)
|
||||
onDispose {
|
||||
systemUiController.setNavigationBarColor(navigationbarColor, darkIcons = false)
|
||||
systemUiController.setStatusBarColor(statusBarColor.copy(alpha = 0.3f), darkIcons = true)
|
||||
}
|
||||
}
|
||||
|
||||
val radius = 20.dp
|
||||
ModalBottomSheet(
|
||||
{},
|
||||
containerColor = Color.Transparent,
|
||||
scrimColor = colorResource(R.color.content_background).copy(alpha = 0.5f),
|
||||
scrimColor = colorResource(R.color.gray_5).copy(alpha = 0.3f),
|
||||
sheetState = modalBottomSheetState,
|
||||
shape = RoundedCornerShape(topStart = radius, topEnd = radius),
|
||||
dragHandle = {},
|
||||
content = {
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
|
|
@ -116,6 +128,9 @@ private fun BottomSheetWrapper(
|
|||
modalBottomSheetState.hide() // will trigger the LaunchedEffect
|
||||
}
|
||||
}
|
||||
Spacer(Modifier.windowInsetsBottomHeight(
|
||||
WindowInsets.navigationBarsIgnoringVisibility
|
||||
))
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ buildscript {
|
|||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.3.2'
|
||||
classpath 'com.android.tools.build:gradle:8.4.1'
|
||||
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
|
||||
classpath 'com.google.gms:google-services:4.4.1'
|
||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:3.0.1'
|
||||
|
|
|
|||
|
|
@ -63,14 +63,6 @@ Submit a new Beta Build to Google Play
|
|||
|
||||
Deploy a new version to the Google Play
|
||||
|
||||
### android upload_to_slack
|
||||
|
||||
```sh
|
||||
[bundle exec] fastlane android upload_to_slack
|
||||
```
|
||||
|
||||
Upload the latest output APK to slack
|
||||
|
||||
----
|
||||
|
||||
This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.
|
||||
|
|
|
|||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,6 +1,6 @@
|
|||
#Mon Apr 22 16:17:19 CEST 2024
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
NAME=4.3.7
|
||||
CODE=7881
|
||||
CODE=7891
|
||||
Loading…
Reference in a new issue