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

💄 Use CircularProgressIndicator as the image loading screen #1513

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.CircularProgressIndicator
import androidx.compose.material.Icon
import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -47,7 +48,6 @@ import com.crosspaste.ui.base.AsyncView
import com.crosspaste.ui.base.PasteIconButton
import com.crosspaste.ui.base.chevronLeft
import com.crosspaste.ui.base.chevronRight
import com.crosspaste.ui.base.image
import com.crosspaste.ui.base.imageCompress
import com.crosspaste.ui.base.imageExpand
import com.crosspaste.ui.base.imageSlash
Expand Down Expand Up @@ -167,12 +167,16 @@ fun PasteImagesDetailView(
contentScale = imageShowMode.contentScale,
)
} else if (loadData.isLoading()) {
Icon(
painter = image(),
contentDescription = imagePath.name,
Row(
modifier = Modifier.fillMaxSize(),
tint = MaterialTheme.colors.onBackground,
)
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically,
) {
CircularProgressIndicator(
modifier = Modifier.size(180.dp),
strokeWidth = 8.dp,
)
}
} else {
Icon(
painter = imageSlash(),
Expand Down Expand Up @@ -301,7 +305,7 @@ fun detailInfoItems(
): List<PasteDetailInfoItem> {
val details =
mutableListOf(
PasteDetailInfoItem("file_Name", imagePath.name),
PasteDetailInfoItem("file_name", imagePath.name),
PasteDetailInfoItem("type", copywriter.getText("image")),
PasteDetailInfoItem("size", fileUtils.formatBytes(pasteData.size)),
PasteDetailInfoItem("remote", copywriter.getText(if (pasteData.remote) "yes" else "no")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.foundation.onClick
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.CircularProgressIndicator
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
Expand All @@ -37,7 +38,6 @@ import com.crosspaste.image.getImageDataLoader
import com.crosspaste.ui.base.AsyncView
import com.crosspaste.ui.base.TransparentBackground
import com.crosspaste.ui.base.UISupport
import com.crosspaste.ui.base.image
import com.crosspaste.ui.base.imageSlash
import com.crosspaste.utils.getFileUtils
import okio.FileSystem
Expand Down Expand Up @@ -80,9 +80,8 @@ fun SingleImagePreviewView(imagePath: Path) {
contentDescription = imagePath.name,
)
} else if (loadData.isLoading()) {
ShowImageView(
painter = image(),
contentDescription = imagePath.name,
CircularProgressIndicator(
modifier = Modifier.size(100.dp),
)
} else {
ShowImageView(
Expand Down
Loading