This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"asset":{ | |
"generator":"Khronos glTF Blender I/O v3.5.30", | |
"version":"2.0" | |
}, | |
"extensionsUsed":[ | |
"KHR_lights_punctual" | |
], | |
"extensionsRequired":[ | |
"KHR_lights_punctual" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.victor.tutorial | |
import android.animation.ValueAnimator | |
import android.opengl.Matrix | |
import android.view.Choreographer | |
import android.view.SurfaceView | |
import androidx.lifecycle.DefaultLifecycleObserver | |
import androidx.lifecycle.Lifecycle | |
import androidx.lifecycle.LifecycleOwner | |
import com.google.android.filament.MaterialInstance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun VideoView( | |
onVideoLoaded: () -> Unit, | |
onVideoEnded: () -> Unit, | |
) { | |
val context = LocalContext.current | |
val lifecycle = LocalLifecycleOwner.current.lifecycle | |
val exoPlayer = ExoPlayer.Builder(context) | |
.build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun Camera( | |
onNoCameraAvailable: (Exception) -> Unit, | |
) { | |
val context = LocalContext.current | |
val lifecycleOwner = LocalLifecycleOwner.current | |
val preview = Preview.Builder().build() | |
val previewView = remember { PreviewView(context) } | |
val cameraSelector = CameraSelector.Builder() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Marquee { | |
Row { | |
Text(text = "This is my 1st text") | |
Icon(Icons.Default.KeyboardArrowRight, contentDescription = "") | |
Text(text = "This is my 2nd text") | |
Box(modifier = Modifier.size(16.dp).background(Color.Black)) | |
Text(text = "This is my 3rd text") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun Marquee( | |
modifier: Modifier = Modifier, | |
gradientEdgeColor: Color = Color.White, | |
content: @Composable (Modifier) -> Unit | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
layout( | |
width = constraints.maxWidth, | |
height = mainText.height | |
) { | |
mainText.place(offset, 0) | |
secondPlaceableWithOffset?.let { | |
it.first.place(it.second, 0) | |
} | |
gradient?.place(0, 0) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (mainText.width <= constraints.maxWidth) { | |
.. | |
} else { | |
// horizontal spacing between the main and second text components | |
val spacing = constraints.maxWidth * 2 / 3 | |
textLayoutInfoState.value = TextLayoutInfo( | |
textWidth = mainText.width + spacing, | |
containerWidth = constraints.maxWidth | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (mainText.width <= constraints.maxWidth) { | |
mainText = subcompose(MarqueeLayers.SecondaryText) { | |
createText(Modifier.fillMaxWidth()) | |
}.first().measure(constraints) | |
textLayoutInfoState.value = null | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gradient: Placeable? = null | |
var secondPlaceableWithOffset: Pair<Placeable, Int>? = null |