Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Padding issue for each event #74

Open
epg2024 opened this issue Dec 6, 2024 · 0 comments
Open

Padding issue for each event #74

epg2024 opened this issue Dec 6, 2024 · 0 comments

Comments

@epg2024
Copy link

epg2024 commented Dec 6, 2024

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:
scrolling_issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant