-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/tags-ia' into issue/20621-tags-feed-onboarding
- Loading branch information
Showing
14 changed files
with
633 additions
and
167 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
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
38 changes: 38 additions & 0 deletions
38
...java/org/wordpress/android/ui/reader/views/compose/tagsfeed/ReaderTagsFeedComposeUtils.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,38 @@ | ||
package org.wordpress.android.ui.reader.views.compose.tagsfeed | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.platform.LocalConfiguration | ||
import androidx.compose.ui.platform.LocalDensity | ||
import androidx.compose.ui.unit.Dp | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.min | ||
import androidx.compose.ui.unit.sp | ||
|
||
object ReaderTagsFeedComposeUtils { | ||
const val LOADING_POSTS_COUNT = 5 | ||
|
||
const val POST_ITEM_TITLE_MAX_LINES = 2 | ||
val POST_ITEM_IMAGE_SIZE = 64.dp | ||
private val POST_ITEM_HEIGHT = 150.sp // use SP to scale with text size, which is the main content of the item | ||
private val POST_ITEM_MAX_WIDTH = 320.dp | ||
private const val POST_ITEM_WIDTH_PERCENTAGE = 0.8f | ||
|
||
val PostItemHeight: Dp | ||
@Composable | ||
get() { | ||
with(LocalDensity.current) { | ||
return POST_ITEM_HEIGHT.toDp() | ||
} | ||
} | ||
|
||
val PostItemWidth: Dp | ||
@Composable | ||
get() { | ||
val localConfiguration = LocalConfiguration.current | ||
val screenWidth = remember(localConfiguration) { | ||
localConfiguration.screenWidthDp.dp | ||
} | ||
return min((screenWidth * POST_ITEM_WIDTH_PERCENTAGE), POST_ITEM_MAX_WIDTH) | ||
} | ||
} |
Oops, something went wrong.