-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #495 from Automattic/task/410-create-dummy-stories
End of Year: Generate stories with dummy data + support dynamic lengths
- Loading branch information
Showing
23 changed files
with
304 additions
and
63 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
24 changes: 15 additions & 9 deletions
24
.../main/java/au/com/shiftyjelly/pocketcasts/endofyear/stories/EndOfYearStoriesDataSource.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
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
5 changes: 4 additions & 1 deletion
5
...es/endofyear/src/main/java/au/com/shiftyjelly/pocketcasts/endofyear/stories/StoryFake1.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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
package au.com.shiftyjelly.pocketcasts.endofyear.stories | ||
|
||
import androidx.compose.ui.graphics.Color | ||
import au.com.shiftyjelly.pocketcasts.models.entity.Podcast | ||
|
||
class StoryFake1 : Story() { | ||
class StoryFake1( | ||
val podcasts: List<Podcast>, | ||
) : Story() { | ||
override val backgroundColor: Color = Color.Magenta | ||
} |
7 changes: 6 additions & 1 deletion
7
...es/endofyear/src/main/java/au/com/shiftyjelly/pocketcasts/endofyear/stories/StoryFake2.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 |
---|---|---|
@@ -1,7 +1,12 @@ | ||
package au.com.shiftyjelly.pocketcasts.endofyear.stories | ||
|
||
import androidx.compose.ui.graphics.Color | ||
import au.com.shiftyjelly.pocketcasts.models.entity.Episode | ||
import au.com.shiftyjelly.pocketcasts.utils.seconds | ||
|
||
class StoryFake2 : Story() { | ||
class StoryFake2( | ||
val episode: Episode, | ||
) : Story() { | ||
override val storyLength: Long = 3.seconds() | ||
override val backgroundColor: Color = Color.Green | ||
} |
40 changes: 40 additions & 0 deletions
40
...fyear/src/main/java/au/com/shiftyjelly/pocketcasts/endofyear/storyviews/StoryFake1View.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,40 @@ | ||
package au.com.shiftyjelly.pocketcasts.endofyear.storyviews | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.unit.dp | ||
import au.com.shiftyjelly.pocketcasts.compose.components.PodcastItem | ||
import au.com.shiftyjelly.pocketcasts.compose.components.TextH30 | ||
import au.com.shiftyjelly.pocketcasts.endofyear.stories.StoryFake1 | ||
|
||
@Composable | ||
fun StoryFake1View( | ||
story: StoryFake1, | ||
modifier: Modifier = Modifier, | ||
) { | ||
Column { | ||
TextH30( | ||
text = "Your Top Podcasts", | ||
textAlign = TextAlign.Center, | ||
color = story.tintColor, | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.padding(bottom = 16.dp) | ||
) | ||
LazyColumn(modifier = modifier.fillMaxWidth()) { | ||
items(story.podcasts.size) { index -> | ||
PodcastItem( | ||
podcast = story.podcasts[index], | ||
onClick = {}, | ||
tintColor = story.tintColor, | ||
showDivider = false | ||
) | ||
} | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...fyear/src/main/java/au/com/shiftyjelly/pocketcasts/endofyear/storyviews/StoryFake2View.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,28 @@ | ||
package au.com.shiftyjelly.pocketcasts.endofyear.storyviews | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.unit.dp | ||
import au.com.shiftyjelly.pocketcasts.compose.components.TextH30 | ||
import au.com.shiftyjelly.pocketcasts.endofyear.stories.StoryFake2 | ||
|
||
@Composable | ||
fun StoryFake2View( | ||
story: StoryFake2, | ||
modifier: Modifier = Modifier, | ||
) { | ||
Column(modifier.padding(16.dp)) { | ||
TextH30( | ||
text = "The longest episode you listened to was ${story.episode.title}", | ||
textAlign = TextAlign.Center, | ||
color = story.tintColor, | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.padding(16.dp) | ||
) | ||
} | ||
} |
Oops, something went wrong.