File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
core/util/src/main/java/com/android/developers/androidify/util
feature/creation/src/main/java/com/android/developers/androidify/creation Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -50,10 +50,17 @@ fun areBothWindowDimensionsAtLeastMedium(): Boolean {
5050 sizeClass.isWidthAtLeastBreakpoint(WindowSizeClass .WIDTH_DP_MEDIUM_LOWER_BOUND )
5151}
5252
53+ /* **
54+ * This function is useful to understand if the window is too small to show the vertically stacked
55+ * photo empty state. It should align items horizontally only if the window is horizontal and
56+ * if the amount of vertical space is smaller than medium
57+ */
5358@Composable
54- fun isHorizontalWindow (): Boolean {
59+ fun shouldShowHorizontalPhotoPrompt (): Boolean {
5560 val sizeClass = calculateWindowSizeClass()
56- return sizeClass.minWidthDp >= sizeClass.minHeightDp
61+ val isHorizontalWindow = sizeClass.minWidthDp >= sizeClass.minHeightDp
62+ val isHeightSmallerThanMedium = ! sizeClass.isHeightAtLeastBreakpoint(WindowSizeClass .HEIGHT_DP_MEDIUM_LOWER_BOUND )
63+ return isHorizontalWindow && isHeightSmallerThanMedium
5764}
5865
5966/* **
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ import com.android.developers.androidify.theme.components.SecondaryOutlinedButto
9898import com.android.developers.androidify.theme.sharedBoundsRevealWithShapeMorph
9999import com.android.developers.androidify.theme.sharedBoundsWithDefaults
100100import com.android.developers.androidify.util.dashedRoundedRectBorder
101- import com.android.developers.androidify.util.isHorizontalWindow
101+ import com.android.developers.androidify.util.shouldShowHorizontalPhotoPrompt
102102import com.android.developers.androidify.creation.R as CreationR
103103
104104@Composable
@@ -171,7 +171,7 @@ private fun UploadEmptyState(
171171 onChooseImagePress : () -> Unit ,
172172 modifier : Modifier = Modifier ,
173173) {
174- if (isHorizontalWindow ()) {
174+ if (shouldShowHorizontalPhotoPrompt ()) {
175175 HorizontallyAlignedUploadEmptyState (
176176 onCameraPressed = onCameraPressed,
177177 onChooseImagePress = onChooseImagePress,
You can’t perform that action at this time.
0 commit comments