Skip to content

Commit

Permalink
Merge branch 'dev_alpha09' into jetchat_alpha09
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseAlcerreca authored Dec 16, 2020
2 parents c619d03 + 0b9d1a2 commit 70c88fd
Show file tree
Hide file tree
Showing 23 changed files with 98 additions and 156 deletions.
13 changes: 6 additions & 7 deletions Jetcaster/app/src/main/java/com/example/jetcaster/Graph.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,14 @@ import java.io.File
*/
object Graph {
lateinit var okHttpClient: OkHttpClient
private set

lateinit var database: JetcasterDatabase
private set

val transactionRunner: TransactionRunner
private val transactionRunner: TransactionRunner
get() = database.transactionRunnerDao()

val syndFeedInput by lazy { SyndFeedInput() }
private val syndFeedInput by lazy { SyndFeedInput() }

val podcastRepository by lazy {
PodcastsRepository(
Expand All @@ -61,7 +60,7 @@ object Graph {
)
}

val podcastFetcher by lazy {
private val podcastFetcher by lazy {
PodcastsFetcher(
okHttpClient = okHttpClient,
syndFeedInput = syndFeedInput,
Expand All @@ -77,7 +76,7 @@ object Graph {
)
}

val episodeStore by lazy {
private val episodeStore by lazy {
EpisodeStore(
episodesDao = database.episodesDao()
)
Expand All @@ -92,10 +91,10 @@ object Graph {
)
}

val mainDispatcher: CoroutineDispatcher
private val mainDispatcher: CoroutineDispatcher
get() = Dispatchers.Main

val ioDispatcher: CoroutineDispatcher
private val ioDispatcher: CoroutineDispatcher
get() = Dispatchers.IO

fun provide(context: Context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class PodcastStore(
return podcastDao.followedPodcastsSortedByLastEpisode(limit)
}

suspend fun followPodcast(podcastUri: String) {
private suspend fun followPodcast(podcastUri: String) {
podcastFollowedEntryDao.insert(PodcastFollowedEntry(podcastUri = podcastUri))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class PodcastsRepository(
private val episodeStore: EpisodeStore,
private val categoryStore: CategoryStore,
private val transactionRunner: TransactionRunner,
private val mainDispatcher: CoroutineDispatcher
mainDispatcher: CoroutineDispatcher
) {
private var refreshingJob: Job? = null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import androidx.compose.material.IconButton
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.material.Tab
import androidx.compose.material.TabConstants.defaultTabIndicatorOffset
import androidx.compose.material.TabDefaults.tabIndicatorOffset
import androidx.compose.material.TabPosition
import androidx.compose.material.TabRow
import androidx.compose.material.Text
Expand Down Expand Up @@ -251,7 +251,7 @@ private fun HomeCategoryTabs(
val selectedIndex = categories.indexOfFirst { it == selectedCategory }
val indicator = @Composable { tabPositions: List<TabPosition> ->
HomeCategoryTabIndicator(
Modifier.defaultTabIndicatorOffset(tabPositions[selectedIndex])
Modifier.tabIndicatorOffset(tabPositions[selectedIndex])
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class HomeViewModel(
refresh(force = false)
}

fun refresh(force: Boolean) {
private fun refresh(force: Boolean) {
viewModelScope.launch {
runCatching {
refreshing.value = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.preferredSize
import androidx.compose.foundation.layout.preferredWidth
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyRowForIndexed
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.material.AmbientContentAlpha
import androidx.compose.material.AmbientContentColor
import androidx.compose.material.ContentAlpha
Expand All @@ -44,7 +44,7 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material.icons.filled.PlaylistAdd
import androidx.compose.material.icons.rounded.PlayCircleFilled
import androidx.compose.material.ripple.rememberRippleIndication
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Providers
import androidx.compose.runtime.collectAsState
Expand Down Expand Up @@ -210,7 +210,7 @@ fun EpisodeListItem(
contentScale = ContentScale.Fit,
colorFilter = ColorFilter.tint(AmbientContentColor.current),
modifier = Modifier
.clickable(indication = rememberRippleIndication(bounded = false, radius = 24.dp)) {
.clickable(indication = rememberRipple(bounded = false, radius = 24.dp)) {
/* TODO */
}
.preferredSize(36.dp)
Expand Down Expand Up @@ -281,20 +281,21 @@ private fun CategoryPodcastRow(
modifier: Modifier = Modifier
) {
val lastIndex = podcasts.size - 1
LazyRowForIndexed(
items = podcasts,
LazyRow(
modifier = modifier,
contentPadding = PaddingValues(start = Keyline1, top = 8.dp, end = Keyline1, bottom = 24.dp)
) { index, (podcast, _, isFollowed) ->
TopPodcastRowItem(
podcastTitle = podcast.title,
podcastImageUrl = podcast.imageUrl,
isFollowed = isFollowed,
onToggleFollowClicked = { onTogglePodcastFollowed(podcast.uri) },
modifier = Modifier.preferredWidth(128.dp)
)
) {
itemsIndexed(items = podcasts) { index: Int, (podcast, _, isFollowed): PodcastWithExtraInfo ->
TopPodcastRowItem(
podcastTitle = podcast.title,
podcastImageUrl = podcast.imageUrl,
isFollowed = isFollowed,
onToggleFollowClicked = { onTogglePodcastFollowed(podcast.uri) },
modifier = Modifier.preferredWidth(128.dp)
)

if (index < lastIndex) Spacer(Modifier.preferredWidth(24.dp))
if (index < lastIndex) Spacer(Modifier.preferredWidth(24.dp))
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.VerticalGradient
import kotlin.math.pow

/**
Expand Down Expand Up @@ -64,7 +64,7 @@ fun Modifier.verticalGradientScrim(

var height by remember { mutableStateOf(0f) }
val brush = remember(color, numStops, startYPercentage, endYPercentage, height) {
VerticalGradient(
Brush.verticalGradient(
colors = colors,
startY = height * startYPercentage,
endY = height * endYPercentage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class PagerState(

@Immutable
private data class PageData(val page: Int) : ParentDataModifier {
override fun Density.modifyParentData(parentData: Any?): Any? = this@PageData
override fun Density.modifyParentData(parentData: Any?): Any = this@PageData
}

private val Measurable.page: Int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,28 @@ object Versions {
}

object Libs {
const val androidGradlePlugin = "com.android.tools.build:gradle:7.0.0-alpha02"
const val androidGradlePlugin = "com.android.tools.build:gradle:7.0.0-alpha03"
const val jdkDesugar = "com.android.tools:desugar_jdk_libs:1.0.9"

const val junit = "junit:junit:4.13"

const val material = "com.google.android.material:material:1.1.0"

object Accompanist {
private const val version = "0.4.0"
private const val version = "0.4.1.compose-7033025-SNAPSHOT"
const val coil = "dev.chrisbanes.accompanist:accompanist-coil:$version"
const val insets = "dev.chrisbanes.accompanist:accompanist-insets:$version"
}

object Kotlin {
private const val version = "1.4.20"
private const val version = "1.4.21"
const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$version"
const val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$version"
const val extensions = "org.jetbrains.kotlin:kotlin-android-extensions:$version"
}

object Coroutines {
private const val version = "1.4.1"
private const val version = "1.4.2"
const val core = "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version"
const val android = "org.jetbrains.kotlinx:kotlinx-coroutines-android:$version"
const val test = "org.jetbrains.kotlinx:kotlinx-coroutines-test:$version"
Expand All @@ -62,8 +62,8 @@ object Libs {
const val coreKtx = "androidx.core:core-ktx:1.5.0-alpha04"

object Compose {
private const val snapshot = ""
const val version = "1.0.0-alpha08"
private const val snapshot = "7033025"
private const val version = "1.0.0-SNAPSHOT"

@get:JvmStatic
val snapshotUrl: String
Expand Down Expand Up @@ -110,7 +110,7 @@ object Libs {

object Rome {
private const val version = "1.14.1"
val rome = "com.rometools:rome:$version"
val modules = "com.rometools:rome-modules:$version"
const val rome = "com.rometools:rome:$version"
const val modules = "com.rometools:rome-modules:$version"
}
}
5 changes: 3 additions & 2 deletions Jetcaster/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Mon Dec 14 17:32:45 GMT 2020
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-rc-1-bin.zip
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.example.jetsnack.ui.components

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.PaddingValues
Expand All @@ -26,13 +27,14 @@ import androidx.compose.foundation.layout.defaultMinSizeConstraints
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.ButtonConstants
import androidx.compose.material.ButtonDefaults
import androidx.compose.material.MaterialTheme
import androidx.compose.material.ProvideTextStyle
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import com.example.jetsnack.ui.theme.JetsnackTheme
Expand All @@ -48,7 +50,7 @@ fun JetsnackButton(
disabledBackgroundGradient: List<Color> = JetsnackTheme.colors.interactiveSecondary,
contentColor: Color = JetsnackTheme.colors.textInteractive,
disabledContentColor: Color = JetsnackTheme.colors.textHelp,
contentPadding: PaddingValues = ButtonConstants.DefaultContentPadding,
contentPadding: PaddingValues = ButtonDefaults.ContentPadding,
content: @Composable RowScope.() -> Unit
) {
JetsnackSurface(
Expand All @@ -58,8 +60,10 @@ fun JetsnackButton(
border = border,
modifier = modifier
.clip(shape)
.horizontalGradientBackground(
colors = if (enabled) backgroundGradient else disabledBackgroundGradient
.background(
Brush.horizontalGradient(
colors = if (enabled) backgroundGradient else disabledBackgroundGradient
)
)
.clickable(
onClick = onClick,
Expand All @@ -72,8 +76,8 @@ fun JetsnackButton(
Row(
Modifier
.defaultMinSizeConstraints(
minWidth = ButtonConstants.DefaultMinWidth,
minHeight = ButtonConstants.DefaultMinHeight
minWidth = ButtonDefaults.MinWidth,
minHeight = ButtonDefaults.MinHeight
)
.fillMaxWidth()
.padding(contentPadding),
Expand Down
Loading

0 comments on commit 70c88fd

Please sign in to comment.