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( |
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
| 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
| 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() { | |
| 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
| apply plugin: 'com.android.application' | |
| ext.versionMajor = 1 | |
| ext.versionMinor = 2 | |
| ext.versionPatch = 3 | |
| ext.versionClassifier = null | |
| ext.isSnapshot = true | |
| ext.minimumSdkVersion = 19 | |
| android { |
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
| apply plugin: 'com.android.application' | |
| ext.versionMajor = 1 | |
| ext.versionMinor = 2 | |
| ext.versionPatch = 3 | |
| ext.versionClassifier = null | |
| ext.isSnapshot = true | |
| android { | |
| defaultConfig { |
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
| /** Making this extension function cleans out the code a lot by removing the repetitive | |
| flowWithLifecycle() or repeatOnLifecycle() | |
| **/ | |
| fun <T> Flow<T>.safeCollect( | |
| owner: LifecycleOwner, | |
| block: (T.() -> Unit)? = null | |
| ) = owner.lifecycleScope.launch { | |
| flowWithLifecycle(owner.lifecycle).collectLatest { block?.invoke(it) } | |
| } |
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
| package com.ercnksgl.testapp.util | |
| import android.view.MotionEvent | |
| import androidx.recyclerview.widget.RecyclerView | |
| import kotlin.math.abs | |
| class DisallowParentSwipeOnItemTouchListener : RecyclerView.OnItemTouchListener { | |
| var startPoint = 0f | |
| override fun onInterceptTouchEvent( | |
| rv: RecyclerView, |