Skip to content

Commit c54d176

Browse files
committed
Move function to better limit its scope to the Creation flow
1 parent e7fb99f commit c54d176

File tree

2 files changed

+15
-14
lines changed
  • core/util/src/main/java/com/android/developers/androidify/util
  • feature/creation/src/main/java/com/android/developers/androidify/creation

2 files changed

+15
-14
lines changed

core/util/src/main/java/com/android/developers/androidify/util/LayoutUtils.kt

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,6 @@ 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-
*/
58-
@Composable
59-
fun shouldShowHorizontalPhotoPrompt(): Boolean {
60-
val sizeClass = calculateWindowSizeClass()
61-
val isHorizontalWindow = sizeClass.minWidthDp >= sizeClass.minHeightDp
62-
val isHeightSmallerThanMedium = !sizeClass.isHeightAtLeastBreakpoint(WindowSizeClass.HEIGHT_DP_MEDIUM_LOWER_BOUND)
63-
return isHorizontalWindow && isHeightSmallerThanMedium
64-
}
65-
6653
/***
6754
* This function is useful to limit the number of buttons when the window is too small to show
6855
* everything that should otherwise appear on the screen.

feature/creation/src/main/java/com/android/developers/androidify/creation/PhotoPrompt.kt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ import androidx.compose.ui.unit.dp
8484
import androidx.compose.ui.unit.sp
8585
import androidx.graphics.shapes.RoundedPolygon
8686
import androidx.graphics.shapes.rectangle
87+
import androidx.window.core.layout.WindowSizeClass
8788
import coil3.compose.AsyncImage
8889
import coil3.request.ImageRequest
8990
import coil3.request.crossfade
@@ -97,8 +98,8 @@ import com.android.developers.androidify.theme.components.ScaleIndicationNodeFac
9798
import com.android.developers.androidify.theme.components.SecondaryOutlinedButton
9899
import com.android.developers.androidify.theme.sharedBoundsRevealWithShapeMorph
99100
import com.android.developers.androidify.theme.sharedBoundsWithDefaults
101+
import com.android.developers.androidify.util.calculateWindowSizeClass
100102
import com.android.developers.androidify.util.dashedRoundedRectBorder
101-
import com.android.developers.androidify.util.shouldShowHorizontalPhotoPrompt
102103
import com.android.developers.androidify.creation.R as CreationR
103104

104105
@Composable
@@ -186,6 +187,19 @@ private fun UploadEmptyState(
186187
}
187188
}
188189

190+
/***
191+
* This function is useful to understand if the window is too small to show the vertically stacked
192+
* photo empty state. It should align items horizontally only if the window is horizontal and
193+
* if the amount of vertical space is smaller than medium
194+
*/
195+
@Composable
196+
fun shouldShowHorizontalPhotoPrompt(): Boolean {
197+
val sizeClass = calculateWindowSizeClass()
198+
val isHorizontalWindow = sizeClass.minWidthDp >= sizeClass.minHeightDp
199+
val isHeightSmallerThanMedium = !sizeClass.isHeightAtLeastBreakpoint(WindowSizeClass.HEIGHT_DP_MEDIUM_LOWER_BOUND)
200+
return isHorizontalWindow && isHeightSmallerThanMedium
201+
}
202+
189203
@Composable
190204
private fun VerticallyAlignedUploadEmptyState(
191205
onCameraPressed: () -> Unit,

0 commit comments

Comments
 (0)