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
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 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 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 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 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 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 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 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) |
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
@HiltViewModel | |
class HomeScreenViewModel @Inject constructor( | |
private val imageRepository: ImageRepository | |
) : ViewModel() { | |
var state by mutableStateOf(HomeScreenState()) | |
private set | |
fun onEvent(event: HomeScreenEvents) { | |
when (event) { |
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
@Module | |
@InstallIn(SingletonComponent::class) | |
abstract class RepositoryModule { | |
@Binds | |
@Singleton | |
abstract fun bindImageRepository( | |
imageRepositoryImpl: ImageRepositoryImpl | |
): ImageRepository | |
} |
NewerOlder