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
{ | |
... | |
LazyColumn( horizontalAlignment = Alignment.CenterHorizontally, | |
verticalArrangement = Arrangement.spacedBy(8.dp)) { | |
languages?.let { list -> | |
items(list.toList(), key = { it }) { lang -> | |
BuildTransLangCard(lang = lang, listener = listener) | |
} | |
} |
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 BindTextRecognitionOutput( | |
textRecognitionViewModel: TextRecognitionViewModel, | |
textTranslationViewModel: TextTranslationViewModel, | |
listener: TextRecognitionComposableInterface | |
) { | |
//animation based on this value: if the translation is ready, show up it and hide the language choice and viceversa | |
val showTranslation = remember { textTranslationViewModel.showTranslation } | |
ConstraintLayout(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
@Composable | |
fun BindTextRecognitionOutput( | |
textRecognitionViewModel: TextRecognitionViewModel, | |
textTranslationViewModel: TextTranslationViewModel, | |
listener: TextRecognitionComposableInterface | |
) { | |
//animation based on this value | |
val showTranslationLanguages = remember { textTranslationViewModel.showLanguagesState } | |
ConstraintLayout(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
@ExperimentalPermissionsApi | |
@Composable | |
private fun BuildCameraUI() { | |
val cameraPermissionState = rememberPermissionState(Manifest.permission.CAMERA) | |
PermissionRequired( | |
permissionState = cameraPermissionState, | |
permissionNotGrantedContent = { | |
Column( | |
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
@androidx.compose.ui.tooling.preview.Preview | |
@Composable | |
private fun BindTextRecognitionOutput() { | |
ConstraintLayout(Modifier.fillMaxSize()) { | |
val (title, text, backToCameraButton) = createRefs() | |
val textValue by textRecognitionViewModel.getOutput().observeAsState() | |
val scrollState = rememberScrollState(0) | |
Text( | |
modifier = Modifier |
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 BuildCameraUI() { | |
//PERMISSION MANAGEMENT part | |
... | |
{ | |
ConstraintLayout(Modifier.fillMaxSize()) { | |
val (preview, takePhotoButton, progress) = createRefs() | |
val executor = remember(context) { ContextCompat.getMainExecutor(context) } | |
val imageCapture: MutableState<ImageCapture?> = remember { mutableStateOf(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
package com.fs.uiapplication; | |
import com.fs.uiapplication.slice.*; | |
import ohos.aafwk.ability.Ability; | |
import ohos.aafwk.content.Intent; | |
import ohos.multimodalinput.event.TouchEvent; | |
public class MainAbility extends Ability implements SwipeListener{ | |
private SwipeManager swipeManager = new SwipeManager(this); |
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
<?xml version="1.0" encoding="utf-8"?> | |
<fragment xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:map="http://schemas.android.com/apk/res-auto" | |
android:id="@+id/map" | |
class="com.huawei.hms.maps.SupportMapFragment" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
map:cameraTargetLat="45.4781878" | |
map:cameraTargetLng="9.1684945" | |
map:cameraZoom="10" /> |
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.fs.composesample | |
import androidx.appcompat.app.AppCompatActivity | |
import android.os.Bundle | |
import androidx.activity.compose.setContent | |
import androidx.compose.runtime.Composable | |
import androidx.compose.ui.Modifier | |
import androidx.compose.ui.viewinterop.AndroidView | |
import com.huawei.hms.maps.* | |
import com.huawei.hms.maps.model.LatLng |
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.fs.composesample | |
import androidx.appcompat.app.AppCompatActivity | |
import android.os.Bundle | |
import androidx.activity.compose.setContent | |
import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.runtime.Composable | |
import androidx.compose.ui.Modifier | |
import androidx.compose.ui.viewinterop.AndroidView | |
import com.huawei.hms.maps.* |
NewerOlder