107: Update dependencies r=msfjarvis a=msfjarvis

bors r+
🤖

Co-authored-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
bors[bot] 2021-02-11 10:59:21 +00:00 committed by GitHub
commit baada58e8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 54 additions and 69 deletions

View file

@ -9,15 +9,6 @@
<package name="io.ktor" alias="false" withSubpackages="false" />
</value>
</option>
<option name="PACKAGES_IMPORT_LAYOUT">
<value>
<package name="" alias="false" withSubpackages="true" />
<package name="java" alias="false" withSubpackages="true" />
<package name="javax" alias="false" withSubpackages="true" />
<package name="kotlin" alias="false" withSubpackages="true" />
<package name="" alias="true" withSubpackages="true" />
</value>
</option>
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="100" />
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="100" />
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />

View file

@ -26,5 +26,10 @@
<option name="name" value="maven" />
<option name="url" value="https://jitpack.io" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
</component>
</project>

View file

@ -28,9 +28,12 @@ dependencies {
implementation(project(":database"))
implementation(Dependencies.AndroidX.appCompat)
implementation(Dependencies.AndroidX.browser)
implementation(Dependencies.AndroidX.Compose.activity)
implementation(Dependencies.AndroidX.Compose.compiler)
implementation(Dependencies.AndroidX.Compose.constraintLayout)
implementation(Dependencies.AndroidX.Compose.foundation)
implementation(Dependencies.AndroidX.Compose.foundationLayout)
implementation(Dependencies.AndroidX.Compose.lifecycleViewModel)
implementation(Dependencies.AndroidX.Compose.material)
implementation(Dependencies.AndroidX.Compose.navigation)
implementation(Dependencies.AndroidX.Compose.paging)

View file

@ -1,6 +1,7 @@
package dev.msfjarvis.lobsters.ui.main
import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyListState
@ -15,9 +16,8 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.setContent
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.viewinterop.viewModel
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavHostController
import androidx.navigation.compose.KEY_ROUTE
import androidx.navigation.compose.NavHost
@ -32,7 +32,7 @@ import dev.msfjarvis.lobsters.ui.posts.HottestPosts
import dev.msfjarvis.lobsters.ui.posts.SavedPosts
import dev.msfjarvis.lobsters.ui.theme.LobstersTheme
import dev.msfjarvis.lobsters.ui.urllauncher.UrlLauncher
import dev.msfjarvis.lobsters.ui.urllauncher.AmbientUrlLauncher
import dev.msfjarvis.lobsters.ui.urllauncher.LocalUrlLauncher
import dev.msfjarvis.lobsters.ui.viewmodel.LobstersViewModel
import dev.msfjarvis.lobsters.util.IconResource
import kotlinx.coroutines.CoroutineScope
@ -46,7 +46,7 @@ class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
Providers(AmbientUrlLauncher provides urlLauncher) {
Providers(LocalUrlLauncher provides urlLauncher) {
LobstersTheme {
LobstersApp()
}
@ -80,14 +80,14 @@ fun LobstersApp() {
listState = hottestPostsListState,
isPostSaved = viewModel::isPostSaved,
saveAction = viewModel::toggleSave,
modifier = Modifier.padding(bottom = innerPadding.bottom),
modifier = Modifier.padding(bottom = innerPadding.calculateBottomPadding()),
)
}
composable(Destination.Saved.route) {
SavedPosts(
posts = savedPosts,
saveAction = viewModel::toggleSave,
modifier = Modifier.padding(bottom = innerPadding.bottom),
modifier = Modifier.padding(bottom = innerPadding.calculateBottomPadding()),
)
}
}

View file

@ -12,7 +12,7 @@ import androidx.paging.LoadState
import androidx.paging.compose.LazyPagingItems
import androidx.paging.compose.items
import dev.msfjarvis.lobsters.data.local.LobstersPost
import dev.msfjarvis.lobsters.ui.urllauncher.AmbientUrlLauncher
import dev.msfjarvis.lobsters.ui.urllauncher.LocalUrlLauncher
@Composable
fun HottestPosts(
@ -22,7 +22,7 @@ fun HottestPosts(
modifier: Modifier = Modifier,
saveAction: (LobstersPost) -> Unit,
) {
val urlLauncher = AmbientUrlLauncher.current
val urlLauncher = LocalUrlLauncher.current
if (posts.loadState.refresh == LoadState.Loading) {
EmptyList(saved = false)

View file

@ -1,10 +1,10 @@
package dev.msfjarvis.lobsters.ui.posts
import androidx.compose.animation.Crossfade
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.ConstraintLayout
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
@ -22,6 +22,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.constraintlayout.compose.ConstraintLayout
import coil.transform.CircleCropTransformation
import dev.chrisbanes.accompanist.coil.CoilImage
import dev.msfjarvis.lobsters.R
@ -59,6 +60,7 @@ val TEST_POST = LobstersPost(
listOf("openbsd", "linux", "containers", "hack the planet", "no thanks"),
)
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun LobstersItem(
post: LobstersPost,
@ -70,7 +72,7 @@ fun LobstersItem(
Surface(
modifier = Modifier
.fillMaxWidth()
.clickable(
.combinedClickable(
onClick = onClick,
onLongClick = onLongClick,
),
@ -135,7 +137,7 @@ fun LobstersItem(
centerVerticallyTo(parent)
}
) {
Crossfade(current = isSaved) {
Crossfade(targetState = isSaved) {
if (it) {
IconResource(
resourceId = R.drawable.ic_favorite_24px,

View file

@ -6,7 +6,7 @@ import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import dev.msfjarvis.lobsters.data.local.LobstersPost
import dev.msfjarvis.lobsters.ui.urllauncher.AmbientUrlLauncher
import dev.msfjarvis.lobsters.ui.urllauncher.LocalUrlLauncher
@Composable
fun SavedPosts(
@ -15,7 +15,7 @@ fun SavedPosts(
saveAction: (LobstersPost) -> Unit,
) {
val listState = rememberLazyListState()
val urlLauncher = AmbientUrlLauncher.current
val urlLauncher = LocalUrlLauncher.current
if (posts.isEmpty()) {
EmptyList(saved = true)

View file

@ -1,5 +1,5 @@
package dev.msfjarvis.lobsters.ui.urllauncher
import androidx.compose.runtime.staticAmbientOf
import androidx.compose.runtime.staticCompositionLocalOf
val AmbientUrlLauncher = staticAmbientOf<UrlLauncher> { error("Needs to be provided") }
val LocalUrlLauncher = staticCompositionLocalOf<UrlLauncher> { error("Needs to be provided") }

View file

@ -1,50 +1,25 @@
/*
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.msfjarvis.lobsters.util
import androidx.annotation.DrawableRes
import androidx.compose.material.AmbientContentColor
import androidx.compose.material.Icon
import androidx.compose.material.LocalContentColor
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.DeferredResource
import androidx.compose.ui.res.loadVectorResource
import androidx.compose.ui.res.painterResource
@Composable
fun IconResource(
@DrawableRes resourceId: Int,
contentDescription: String,
modifier: Modifier = Modifier,
tint: Color = AmbientContentColor.current
tint: Color = LocalContentColor.current
) {
val deferredResource = loadVectorResource(resourceId)
deferredResource.onLoadRun { vector ->
val painter = painterResource(resourceId)
Icon(
imageVector = vector,
painter = painter,
modifier = modifier,
tint = tint,
contentDescription = contentDescription,
)
}
}
inline fun <T> DeferredResource<T>.onLoadRun(block: (T) -> Unit) {
val res = resource.resource
if (res != null) {
block(res)
}
}

View file

@ -37,8 +37,15 @@ internal fun Project.configureForRootProject() {
internal fun Project.configureForAllProjects() {
repositories {
google()
jcenter()
maven { setUrl("https://jitpack.io") }
mavenCentral()
jcenter() {
content {
// Indirect dependencies
// https://youtrack.jetbrains.com/issue/IDEA-261387
includeModule("org.jetbrains.trove4j", "trove4j")
includeGroup("org.jetbrains.kotlinx")
}
}
}
tasks.withType<KotlinCompile> {
kotlinOptions {

View file

@ -9,13 +9,13 @@ object Plugins {
const val androidGradlePlugin = "com.android.tools.build:gradle:7.0.0-alpha05"
const val androidGradlePlugin_lintModel = "com.android.tools.lint:lint-model:30.0.0-alpha05"
const val daggerGradlePlugin = "com.google.dagger:hilt-android-gradle-plugin:${DAGGER_HILT_VERSION}"
const val kotlinGradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21-2"
const val kotlinGradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.30"
const val jsemver = "com.github.zafarkhaja:java-semver:0.9.0"
const val sqldelightGradlePlugin = "com.squareup.sqldelight:gradle-plugin:1.4.4"
}
object Dependencies {
const val COMPOSE_VERSION = "1.0.0-alpha11"
const val COMPOSE_VERSION = "1.0.0-alpha12"
object Kotlin {
@ -35,12 +35,15 @@ object Dependencies {
object Compose {
const val activity = "androidx.activity:activity-compose:1.3.0-alpha02"
const val compiler = "androidx.compose.compiler:compiler:$COMPOSE_VERSION"
const val constraintLayout = "androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha02"
const val foundation = "androidx.compose.foundation:foundation:$COMPOSE_VERSION"
const val foundationLayout = "androidx.compose.foundation:foundation-layout:$COMPOSE_VERSION"
const val lifecycleViewModel = "androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha01"
const val material = "androidx.compose.material:material:$COMPOSE_VERSION"
const val navigation = "androidx.navigation:navigation-compose:1.0.0-alpha06"
const val paging = "androidx.paging:paging-compose:1.0.0-alpha06"
const val navigation = "androidx.navigation:navigation-compose:1.0.0-alpha07"
const val paging = "androidx.paging:paging-compose:1.0.0-alpha07"
const val runtime = "androidx.compose.runtime:runtime:$COMPOSE_VERSION"
const val ui = "androidx.compose.ui:ui:$COMPOSE_VERSION"
const val uiUnit = "androidx.compose.ui:ui-unit:$COMPOSE_VERSION"
@ -54,7 +57,7 @@ object Dependencies {
object Lifecycle {
private const val version = "2.3.0-rc01"
private const val version = "2.3.0"
const val runtimeKtx = "androidx.lifecycle:lifecycle-runtime-ktx:$version"
const val viewmodelKtx = "androidx.lifecycle:lifecycle-viewmodel-ktx:$version"
}
@ -62,7 +65,7 @@ object Dependencies {
object ThirdParty {
const val accompanist = "dev.chrisbanes.accompanist:accompanist-coil:0.5.0"
const val accompanist = "dev.chrisbanes.accompanist:accompanist-coil:0.5.1"
object Moshi {

View file

@ -4,7 +4,6 @@
*/
internal val additionalCompilerArgs = listOf(
"-Xallow-jvm-ir-dependencies",
"-Xopt-in=kotlin.RequiresOptIn",
"-Xskip-prerelease-check"
)