Skip to content

Commit

Permalink
Added image fetching content provider
Browse files Browse the repository at this point in the history
  • Loading branch information
myofficework000 committed Mar 16, 2024
1 parent 8b9b480 commit e7b181b
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,26 @@ import com.example.jetpack_compose_all_in_one.ui.components.LessonHeader
import com.example.jetpack_compose_all_in_one.ui.theme.dp_15
import com.example.jetpack_compose_all_in_one.utils.LogicPager

/**
* Composable function for displaying the content related to ContentProvider.
*/
@Composable
private fun ContentProviderContent() {
// Remembering the current page using mutableStateOf
val currentPage = rememberSaveable { mutableStateOf(0) }

// LogicPager composable for handling page navigation
LogicPager(
pageCount = 3,
currentPage = currentPage
) {
// Column composable to arrange content vertically
Column(
Modifier
.fillMaxSize()
.padding(it)
) {
// Displaying header based on the current page
LessonHeader(
stringArrayResource(R.array.content_provider_header_text)[currentPage.value],
Modifier
Expand All @@ -42,6 +49,7 @@ private fun ContentProviderContent() {
TextAlign.Center
)

// Displaying content based on the current page
when (currentPage.value) {
0 -> ContactList()
1 -> ShowImages(9)
Expand All @@ -51,8 +59,12 @@ private fun ContentProviderContent() {
}
}

/**
* Preview composable function for ContentProviderScreen.
*/
@Preview
@Composable
fun ContentProviderScreen() {
// Displaying ContentProviderContent in the preview
ContentProviderContent()
}
}

0 comments on commit e7b181b

Please sign in to comment.