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

Feature/detail view bottom icons #106

Closed
wants to merge 10 commits into from
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2020-2022 Photos.network developers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package photos.network

import java.time.Instant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,8 @@ class PhotosScreenTests {
fun swipe_right_should_select_previous_image() {
// given
val photo1 = generateTestPhoto(filename = "photo1.jpg")
val photo2 = generateTestPhoto(filename = "photo2.jpg")
val uiState = PhotosUiState(
photos = listOf(photo1, photo2),
photos = listOf(photo1),
selectedIndex = 1,
selectedPhoto = photo1,
isLoading = false,
Expand Down
51 changes: 51 additions & 0 deletions app/src/main/kotlin/photos/network/ui/PhotoBottomIcons.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,67 @@
*/
package photos.network.ui

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.material.Icon
import androidx.compose.material.IconButton
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.Download
import androidx.compose.material.icons.filled.Share
import androidx.compose.material.icons.filled.Shield
import androidx.compose.material.icons.outlined.Shield
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import photos.network.theme.AppTheme

@Composable
fun PhotoBottomIcons(
modifier: Modifier = Modifier
) {
Row(
modifier = modifier,
horizontalArrangement = Arrangement.SpaceEvenly
) {
IconButton(
onClick = {
// TODO: show share dialog
}
) {
Icon(Icons.Default.Share, null, tint = Color.White)
}

IconButton(
onClick = {
// TODO: show photo size selection dialog
}
) {
Icon(Icons.Default.Download, null, tint = Color.White)
}

IconButton(
onClick = {
// TODO: change photo privacy settings
}
) {
// TODO: change icon regarding photo settings
if (true) {
Icon(Icons.Default.Shield, null, tint = Color.White)
} else {
Icon(Icons.Outlined.Shield, null, tint = Color.White)
}
}

IconButton(
onClick = {
// TODO: show delete dialog
}
) {
Icon(Icons.Default.Delete, null, tint = Color.White)
}
}
}

@Preview
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/kotlin/photos/network/ui/PhotoTopIcons.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import photos.network.theme.AppTheme

Expand All @@ -34,7 +35,7 @@ fun PhotoTopIcons(
IconButton(
onClick = { onBackPressed() }
) {
Icon(Icons.Filled.ArrowBack, null)
Icon(Icons.Filled.ArrowBack, null, tint = Color.White)
}
}
}
Expand Down