Skip to content

Padding issue for each event  #74

Description

@epg2024

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions