This file contains hidden or 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
MyEventListener { _, event -> | |
when (event) { | |
Lifecycle.Event.ON_CREATE -> { | |
} | |
Lifecycle.Event.ON_START -> { | |
} | |
Lifecycle.Event.ON_RESUME -> { | |
} |
This file contains hidden or 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 androidx.compose.runtime.Composable | |
import androidx.compose.runtime.DisposableEffect | |
import androidx.lifecycle.Lifecycle | |
import androidx.lifecycle.LifecycleEventObserver | |
import androidx.lifecycle.LifecycleOwner | |
import androidx.lifecycle.compose.LocalLifecycleOwner | |
@Composable | |
fun MyEventListener( |
This file contains hidden or 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
private fun GeneratePDF() { | |
try { | |
val path = | |
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) | |
.toString() + "/MyPDF" | |
val file = File(path, "my_file.pdf") | |
val pdfWriter = PdfWriter(file) | |
val pdfDocument = PdfDocument(pdfWriter) |
This file contains hidden or 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.content.ContentValues.TAG | |
import android.util.Log | |
import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.material3.Text | |
import androidx.compose.runtime.Composable | |
import androidx.compose.ui.Modifier | |
@Composable | |
fun Stack018() { | |
val textToDraw = |
This file contains hidden or 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
val imageLoader = ImageLoader.Builder(context) | |
.components { | |
add(VideoFrameDecoder.Factory()) | |
}.crossfade(true) | |
.build() | |
val painter = rememberAsyncImagePainter( | |
model = state.galleryFiles[page].uri, | |
imageLoader = imageLoader, | |
) |
This file contains hidden or 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.content.Context | |
import android.webkit.JavascriptInterface | |
import android.widget.Toast | |
class JavaScriptInterface { | |
private val context : Context | |
constructor(context : Context){ |
This file contains hidden or 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.webkit.WebView | |
import androidx.compose.foundation.layout.Column | |
import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.runtime.Composable | |
import androidx.compose.ui.Modifier | |
import androidx.compose.ui.viewinterop.AndroidView | |
@Composable | |
fun WebViewCommunication(modifier: Modifier = Modifier) { | |
Column(modifier = Modifier.fillMaxSize()){ |
This file contains hidden or 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
<!DOCTYPE > | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<script type="text/javascript"> | |
function init() | |
{ | |
var testVal = 'Hello Android !!'; | |
AndroidFunction.showToast(testVal); | |
} |
This file contains hidden or 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 MyListView( | |
images: List<Image> | |
) { | |
LazyVerticalGrid( | |
contentPadding = PaddingValues(4.dp), | |
columns = GridCells.Fixed(2), | |
modifier = Modifier.fillMaxSize() | |
) { | |
items(images, key = { |
This file contains hidden or 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
@OptIn(ExperimentalMaterial3Api::class, ExperimentalComposeUiApi::class) | |
@Composable | |
fun HomeScreen(state: HomeScreenState, onEvent: (HomeScreenEvents) -> Unit) { | |
val keyboardManager = LocalSoftwareKeyboardController.current | |
Scaffold(topBar = { | |
TopAppBar( | |
title = { | |
Text(text = "MVI App", color = MaterialTheme.colorScheme.onPrimary) |
NewerOlder