attribute vec4 a_Position;
attribute vec2 a_TexCoordinate;
varying vec2 v_TexCoordinate;
void main()
{
v_TexCoordinate = a_TexCoordinate;
gl_Position = a_Position;
}
ChatGPT
This is a simple vertex shader written in GLSL (OpenGL Shading Language).
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
#### Nav | |
-keepnames class androidx.navigation.fragment.NavHostFragment | |
-keepnames class * extends android.os.Parcelable | |
-keepnames class * extends java.io.Serializable | |
#### OkHttp, Retrofit and Moshi | |
-dontwarn okhttp3.** |
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
/* | |
* Copyright 2019, The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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 | |
private fun LazyListState.rememberIsScrollingUpState(): State<Boolean> { | |
var previousIndex by remember(this) { mutableIntStateOf(firstVisibleItemIndex) } | |
var previousScrollOffset by remember(this) { mutableIntStateOf(firstVisibleItemScrollOffset) } | |
return remember(this) { | |
derivedStateOf { | |
if (previousIndex != firstVisibleItemIndex) { | |
previousIndex > firstVisibleItemIndex |
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
import 'package:video_player/video_player.dart'; | |
class VideoQuestion extends StatefulWidget { | |
final String videoUrl; | |
VideoQuestion({Key? key, required this.videoUrl}) | |
: super(key: key); | |
@override | |
State<VideoQuestion> createState() => _VideoQuestionState(); |
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
import android.app.AppOpsManager | |
import android.app.AppOpsManager.OnOpChangedListener | |
import android.content.Context | |
import android.os.Build | |
import android.os.Process | |
import androidx.core.content.getSystemService | |
import kotlinx.coroutines.Dispatchers | |
import kotlinx.coroutines.channels.awaitClose | |
import kotlinx.coroutines.flow.Flow |
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
fun main() { | |
var delta = -1 | |
val m = 3 | |
val offsets: List<Int> = (0..10).scan(0) { acc, _ -> | |
(acc + delta).also { | |
if (it == -m || it == m) { | |
delta = -delta | |
} | |
} |
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
class MyEffectPreviewView : GLView { | |
constructor(context: Context?) : super(context) | |
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) | |
private var index = 0 | |
private var bitmaps: List<Bitmap> = emptyList() | |
override fun onGLDraw(canvas: ICanvasGL) { | |
val bitmaps = this.bitmaps | |
val index = this.index |
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
// ----------------------------------------------------------------------------- Domain | |
interface HomeRepository { | |
suspend fun fetchData(): String | |
suspend fun syncData() | |
fun observeData(): Flow<String> | |
} | |
// -----------------------------------------------------------------------------Demo: Home screen UI | |
sealed interface HomeAction { | |
object FetchData : HomeAction |