-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
plugins { | ||
id("com.android.application") | ||
id("org.jetbrains.kotlin.android") | ||
id("dagger.hilt.android.plugin") | ||
id("kotlin-parcelize") | ||
kotlin("kapt") | ||
} | ||
|
||
android { | ||
namespace = "net.deaftone.eurydice" | ||
compileSdk = 34 | ||
defaultConfig { | ||
applicationId = "net.deaftone.eurydice" | ||
minSdk = 24 | ||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
vectorDrawables { | ||
useSupportLibrary = true | ||
} | ||
} | ||
|
||
buildTypes { | ||
release { | ||
isMinifyEnabled = false | ||
proguardFiles( | ||
getDefaultProguardFile("proguard-android-optimize.txt"), | ||
"proguard-rules.pro" | ||
) | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_18 | ||
targetCompatibility = JavaVersion.VERSION_18 | ||
} | ||
kotlinOptions { | ||
jvmTarget = "18" | ||
} | ||
buildFeatures { | ||
compose = true | ||
} | ||
composeOptions { | ||
kotlinCompilerExtensionVersion = "1.4.3" | ||
} | ||
packaging { | ||
resources { | ||
excludes += "/META-INF/{AL2.0,LGPL2.1}" | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
retrofit() | ||
room() | ||
hilt() | ||
compose() | ||
moshi() | ||
activity() | ||
navigation() | ||
glide() | ||
lifecycle() | ||
implementation("com.squareup:javapoet:1.13.0") | ||
implementation("com.google.dagger:hilt-android-gradle-plugin:2.45") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package net.deaftone.eurydice.ui | ||
|
||
import androidx.compose.animation.* | ||
import androidx.compose.foundation.gestures.Orientation | ||
import androidx.compose.foundation.layout.* | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.derivedStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.graphicsLayer | ||
import androidx.compose.ui.platform.LocalDensity | ||
import androidx.compose.ui.unit.Dp | ||
|
||
@Composable | ||
fun BottomSheet( | ||
peekHeight: Dp, | ||
peekContent: @Composable () -> Unit, | ||
content: @Composable () -> Unit, | ||
// swipeableState: SwipeableState<Int> = rememberSwipeableState(initialValue = 0) | ||
) { | ||
BoxWithConstraints(Modifier.fillMaxSize()) { | ||
val density = LocalDensity.current | ||
val anchors = mapOf( | ||
0f to 1, | ||
with(density) { (maxHeight - peekHeight).toPx() } to 0 | ||
) | ||
/* val peekContentAlpha = remember { | ||
derivedStateOf { | ||
if (swipeableState.progress.from == 0){ | ||
// at 0 or moving away from 0 | ||
if (swipeableState.progress.to == 0) 1f | ||
else if (swipeableState.progress.fraction < 0.25f) 1f-swipeableState.progress.fraction*4 | ||
else 0f | ||
} else { | ||
// at 1 or moving away from 1 | ||
if (swipeableState.progress.to == 1) 0f | ||
else if (swipeableState.progress.fraction > 0.75f) 1f-(1f-swipeableState.progress.fraction)*4 | ||
else 0f | ||
} | ||
} | ||
}*/ | ||
/* Box( | ||
modifier = Modifier | ||
.graphicsLayer { | ||
translationY = swipeableState.offset.value | ||
} | ||
.fillMaxSize() | ||
.align(Alignment.BottomCenter) | ||
.swipeable( | ||
state = swipeableState, | ||
anchors = anchors, | ||
orientation = Orientation.Vertical | ||
) | ||
) { | ||
*//** | ||
* Order of composable matters. | ||
* Reversed order would result in clickables in peekContent not working. | ||
* Note that the composable will overlap. Check state before reacting to a click. | ||
*//* | ||
Box(Modifier.graphicsLayer { alpha = 1f-peekContentAlpha.value }){ | ||
content() | ||
} | ||
Box(Modifier.graphicsLayer { alpha = peekContentAlpha.value }) { | ||
peekContent() | ||
} | ||
}*/ | ||
} | ||
} |