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 contentResolver = this.contentResolver | |
val contentValues = ContentValues().apply { | |
put(MediaStore.MediaColumns.DISPLAY_NAME, "applounge") | |
put(MediaStore.MediaColumns.MIME_TYPE, "text/plain") | |
put(MediaStore.MediaColumns.RELATIVE_PATH, Environment.DIRECTORY_DOCUMENTS) | |
} | |
val uri = contentResolver.insert(MediaStore.Files.getContentUri("external"), contentValues) | |
uri?.let { | |
contentResolver.openOutputStream(it)?.use { outputStream -> |
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 CircleMap() { | |
// Define the coordinates for circle centers and their associated information | |
val circleData = listOf( | |
CircleInfo("Park A", LatLng(37.7749, -122.4194), "This is Park A"), | |
CircleInfo("Park B", LatLng(36.7783, -119.4179), "This is Park B"), | |
CircleInfo("Park C", LatLng(34.0522, -118.2437), "This is Park C") | |
) | |
// Create a mutable state to track the selected circle |
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 AnimatedBorderCard( | |
modifier: Modifier = Modifier, | |
shape: Shape = RoundedCornerShape(size = 0.dp), | |
borderWidth: Dp = 2.dp, | |
gradient: Brush = Brush.sweepGradient(listOf(Color.Gray, Color.White)), | |
animationDuration: Int = 10000, | |
onCardClick: () -> Unit = {}, | |
content: @Composable () -> Unit | |
) { |
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
#!/bin/zsh | |
function get_devices() { | |
all_devices=$(command adb devices) | |
# Drop the title | |
all_devices=${all_devices#"List of devices attached"} | |
# Drop any unauthorised devices (i.e. USB debugging disabled or authorisations revoked) | |
valid_devices=$(echo $all_devices | grep -v "([[:alnum:]-]+[[:space:]]+unauthorized$)" | grep -oE "([[:alnum:]-]+[[:space:]]+device$)") |
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 kotlin.random.Random | |
import kotlin.reflect.KClass | |
import kotlin.reflect.KFunction | |
import kotlin.reflect.KType | |
/** | |
* You can find the method explanation here on this post: | |
* https://zaqueusantos.medium.com/an-easy-way-to-create-fixture-or-dummy-classes-for-your-android-tests-with-kotlin-9d6c619237d4 | |
*/ |
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
override fun onViewCreated() { | |
observeVisitDetail() | |
} | |
private fun observeVisitDetail() { | |
viewLifecycleOwner.lifecycleScope.launch { | |
viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) { | |
viewModel.agentDetail?.collect { visitingUiState -> | |
when (visitingUiState) { | |
is VisitingDetailUiState.Success -> { |
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 visitId = savedStateHandle.get<Int>("visitId") | |
val agentDetail: StateFlow<VisitingDetailUiState>? = | |
visitId?.let { | |
useCase.getDetailAgentVisitFullResponseFlow(id = it).map { visitDetail -> | |
Log.d("MYTAG", ": got exec") | |
when (visitDetail) { | |
is SallyResponseResource.Loading -> { | |
VisitingDetailUiState.Loading | |
} |
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
override fun onViewCreated() { | |
viewModel.getAgentVisitDetailFullResponseFlow() | |
observeVisitDetail() | |
} |
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
fun getAgentVisitDetailFullResponseFlow() { | |
val visitId = savedStateHandle.get<Int>("visitId") | |
viewModelScope.launch { | |
if (visitId != null) { | |
useCase.getDetailAgentVisitFullResponseFlow(id = visitId) | |
.collectLatest { visitDetail -> | |
when (visitDetail) { | |
is SallyResponseResource.Loading -> { | |
_uiStateDetail.value = VisitingDetailUiState.Loading | |
} |
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 stateFullScreen(){ | |
// lets say we done handle our viewmodels | |
Val uiState by viewmodel.uiState.collectWithLifeCycle() | |
LaunchedEffect() { | |
viewmodel.getAgentVisitDetailFullResponse() | |
} | |
stateLessScreen( |