You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inside ProgramGuideItemView, we are adding first imageview for showing event image, second textview for program title, third imageview for updating event recording status. as shown in below image. Here we are facing padding issue. How to calculate correct padding values for each view to show in visible area without hiding any view, while scrolling from left to right or vice versa.
Views visible area function
private fun layoutVisibleArea(leftOffset: Int, rightOffset: Int) {
updatevisibleAreaJob?.cancel() // Cancel any ongoing job before starting a new one
titleupdateJob?.cancel() // Cancel any ongoing job before starting a new one
updatevisibleAreaJob = GlobalScope.launch {
delay(100)
getLayoutParametersFlow(
leftOffset, rightOffset
).flowOn(Dispatchers.Default) // Perform calculations on the default dispatcher
.collect { (startPadding, endPadding) ->
// Ensure UI updates are performed on the main thread
titleupdateJob = launch(Dispatchers.Main) {
//needed in future
titleView.setPaddingRelative(
startPadding, 0, endPadding+staticItemPadding , 0
)
time.setPaddingRelative(
startPadding + dynamicItemPadding, 0, endPadding + staticItemPadding, 0
)
}
}
}
}
PFA:
The text was updated successfully, but these errors were encountered:
Inside ProgramGuideItemView, we are adding first imageview for showing event image, second textview for program title, third imageview for updating event recording status. as shown in below image. Here we are facing padding issue. How to calculate correct padding values for each view to show in visible area without hiding any view, while scrolling from left to right or vice versa.
Views visible area function
private fun layoutVisibleArea(leftOffset: Int, rightOffset: Int) {
updatevisibleAreaJob?.cancel() // Cancel any ongoing job before starting a new one
titleupdateJob?.cancel() // Cancel any ongoing job before starting a new one
updatevisibleAreaJob = GlobalScope.launch {
delay(100)
getLayoutParametersFlow(
leftOffset, rightOffset
).flowOn(Dispatchers.Default) // Perform calculations on the default dispatcher
.collect { (startPadding, endPadding) ->
// Ensure UI updates are performed on the main thread
titleupdateJob = launch(Dispatchers.Main) {
//needed in future
titleView.setPaddingRelative(
startPadding, 0, endPadding+staticItemPadding , 0
)
time.setPaddingRelative(
startPadding + dynamicItemPadding, 0, endPadding + staticItemPadding, 0
)
}
}
}
}
PFA:
The text was updated successfully, but these errors were encountered: