-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
163 additions
and
144 deletions.
There are no files selected for viewing
This file contains 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
53 changes: 53 additions & 0 deletions
53
compose-ui/src/main/java/com/github/sikv/photos/compose/ui/DynamicPhotoItem.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.github.sikv.photos.compose.ui | ||
|
||
import androidx.compose.runtime.Composable | ||
import com.github.sikv.photos.domain.ListLayout | ||
import com.github.sikv.photos.domain.Photo | ||
|
||
@Composable | ||
fun DynamicPhotoItem( | ||
photo: Photo, | ||
isFavorite: Boolean, | ||
listLayout: ListLayout, | ||
onPhotoClick: (Photo) -> Unit, | ||
onPhotoAttributionClick: (Photo) -> Unit, | ||
onPhotoActionsClick: (Photo) -> Unit, | ||
onToggleFavoriteClick: (Photo) -> Unit, | ||
onSharePhotoClick: (Photo) -> Unit, | ||
onDownloadPhotoClick: (Photo) -> Unit | ||
) { | ||
when (listLayout) { | ||
ListLayout.LIST -> { | ||
PhotoItem( | ||
photo = photo, | ||
isFavorite = isFavorite, | ||
onClick = { | ||
onPhotoClick(photo) | ||
}, | ||
onAttributionClick = { | ||
onPhotoAttributionClick(photo) | ||
}, | ||
onMoreClick = { | ||
onPhotoActionsClick(photo) | ||
}, | ||
onToggleFavorite = { | ||
onToggleFavoriteClick(photo) | ||
}, | ||
onShareClick = { | ||
onSharePhotoClick(photo) | ||
}, | ||
onDownloadClick = { | ||
onDownloadPhotoClick(photo) | ||
} | ||
) | ||
} | ||
ListLayout.GRID -> { | ||
PhotoItemCompact( | ||
photo = photo, | ||
onClick = { | ||
onPhotoClick(photo) | ||
} | ||
) | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
compose-ui/src/main/java/com/github/sikv/photos/compose/ui/SwitchLayoutAction.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.github.sikv.photos.compose.ui | ||
|
||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.IconButton | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import com.github.sikv.photos.domain.ListLayout | ||
|
||
@Composable | ||
fun SwitchLayoutAction( | ||
listLayout: ListLayout, | ||
onSwitchLayoutClick: () -> Unit | ||
) { | ||
val icon = when (listLayout) { | ||
ListLayout.LIST -> R.drawable.ic_view_grid_24dp | ||
ListLayout.GRID -> R.drawable.ic_view_list_24dp | ||
} | ||
|
||
IconButton( | ||
onClick = onSwitchLayoutClick | ||
) { | ||
Icon( | ||
painter = painterResource(id = icon), | ||
contentDescription = stringResource(id = R.string.switch_layout) | ||
) | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="photos">Photos</string> | ||
<string name="switch_layout">Switch layout</string> | ||
</resources> |
Oops, something went wrong.