Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ff64a77
[Jetcaster] Update to SNAPSHOT 6891475 (#216)
chrisbanes Oct 8, 2020
f2eb002
[Crane] Update to SNAPSHOT 6891475 (#217)
manuelvicnt Oct 9, 2020
48b8213
[Jetchat] Update to SNAPSHOT 6891475
JoseAlcerreca Oct 9, 2020
2c47c1a
Spotless
JoseAlcerreca Oct 9, 2020
38eff0b
[Rally] Update to SNAPSHOT 6891475
JoseAlcerreca Oct 12, 2020
3ef25ab
[Jetsurvey] Bump to alpha05
florina-muntenescu Oct 13, 2020
1a0e2cd
[Jetsurvey] Using onSizeChanged to set the branding height
florina-muntenescu Oct 13, 2020
cd6cc13
Merge pull request #223 from android/fm/jetsurvey_alpha05
florina-muntenescu Oct 13, 2020
7285d77
[Jetsurvey] Bump to alpha05
florina-muntenescu Oct 13, 2020
94c4e96
[Jetsurvey] Using onSizeChanged to set the branding height
florina-muntenescu Oct 13, 2020
4f1f177
[Rally] Removes maven central snapshot repo
JoseAlcerreca Oct 13, 2020
abc776f
Merge branch 'dev_alpha05' of github.com:android/compose-samples into…
JoseAlcerreca Oct 13, 2020
eb1fde4
[Rally] Update to SNAPSHOT 6891475
JoseAlcerreca Oct 13, 2020
edf370e
[Jetchat] Removes maven central snapshot repo
JoseAlcerreca Oct 13, 2020
49af7f4
Merge remote-tracking branch 'github/dev_alpha05' into dev_jetchat_al…
JoseAlcerreca Oct 13, 2020
f7a193c
Merge pull request #218 from JoseAlcerreca/dev_jetchat_alpha05
JoseAlcerreca Oct 13, 2020
2a5305f
[Jetsnack] Update to snapshot 6901934.
nickbutcher Oct 13, 2020
6d1f8bd
[Jetsnack] Remove unused import.
nickbutcher Oct 13, 2020
e09d997
[Owl] Accept modifiers in search suggestion items.
nickbutcher Oct 13, 2020
64e0508
Merge pull request #224 from android/nb/jetsnack_alpha05
nickbutcher Oct 13, 2020
0e3edfc
[Owl] Update to snapshot 6901934.
nickbutcher Oct 13, 2020
40b99f8
Bump JetNews to alpha05 (#221)
objcode Oct 14, 2020
f59851e
Merge branch 'dev_alpha05' into nb/owl_alpha05
nickbutcher Oct 14, 2020
a3bfd5d
Merge pull request #225 from android/nb/owl_alpha05
nickbutcher Oct 14, 2020
a50a961
[Readme] Removes known issues (#222)
manuelvicnt Oct 14, 2020
5fe42bd
[All] Updates to alpha05 (#227)
manuelvicnt Oct 14, 2020
7143bfa
Merge branch 'main' into dev_alpha05
manuelvicnt Oct 14, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Crane/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,14 @@ android {
}

buildFeatures {
compose true
compose true

// Disable unused AGP features
buildConfig false
aidl false
renderScript false
resValues false
shaders false
}
composeOptions {
kotlinCompilerVersion Libs.Kotlin.version
Expand All @@ -92,7 +99,6 @@ dependencies {
implementation Libs.AndroidX.Compose.animation
implementation Libs.AndroidX.UI.tooling

implementation Libs.AndroidX.appcompat
implementation Libs.Accompanist.coil

androidTestImplementation Libs.AndroidX.Test.runner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
package androidx.compose.samples.crane.base

import androidx.annotation.DrawableRes
import androidx.compose.foundation.AmbientContentColor
import androidx.compose.foundation.BaseTextField
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Icon
import androidx.compose.foundation.Text
import androidx.compose.foundation.contentColor
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.padding
Expand Down Expand Up @@ -63,7 +63,7 @@ fun CraneUserInput(
modifier: Modifier = Modifier,
caption: String? = null,
@DrawableRes vectorImageId: Int? = null,
tint: Color = contentColor()
tint: Color = AmbientContentColor.current
) {
CraneBaseUserInput(
modifier = modifier,
Expand Down Expand Up @@ -111,7 +111,7 @@ private fun CraneBaseUserInput(
@DrawableRes vectorImageId: Int? = null,
showCaption: () -> Boolean = { true },
tintIcon: () -> Boolean,
tint: Color = contentColor(),
tint: Color = AmbientContentColor.current,
children: @Composable () -> Unit
) {
Surface(modifier = modifier, color = MaterialTheme.colors.primaryVariant) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ package androidx.compose.samples.crane.base
import androidx.compose.foundation.Image
import androidx.compose.foundation.Text
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.Stack
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.preferredHeight
Expand All @@ -46,7 +46,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.unit.dp
import dev.chrisbanes.accompanist.coil.CoilImageWithCrossfade
import dev.chrisbanes.accompanist.coil.CoilImage

@Composable
fun ExploreSection(
Expand Down Expand Up @@ -89,11 +89,12 @@ private fun ExploreItem(
.padding(top = 12.dp, bottom = 12.dp)
) {
ExploreImageContainer {
CoilImageWithCrossfade(
CoilImage(
data = item.imageUrl,
fadeIn = true,
contentScale = ContentScale.Crop,
loading = {
Stack(Modifier.fillMaxSize()) {
Box(Modifier.fillMaxSize()) {
Image(
modifier = Modifier.preferredSize(36.dp).align(Alignment.Center),
asset = vectorResource(id = R.drawable.ic_crane_logo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ package androidx.compose.samples.crane.calendar
import androidx.compose.foundation.ScrollableColumn
import androidx.compose.foundation.Text
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.Stack
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
Expand Down Expand Up @@ -210,7 +210,7 @@ private fun DayStatusContainer(
children: @Composable () -> Unit
) {
if (status.isMarked()) {
Stack {
Box {
val color = MaterialTheme.colors.secondary
Circle(color = color)
if (status == DaySelectedStatus.FirstDay) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package androidx.compose.samples.crane.calendar
import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.activity.ComponentActivity
import androidx.compose.foundation.Image
import androidx.compose.foundation.Text
import androidx.compose.foundation.layout.Column
Expand All @@ -42,7 +42,7 @@ fun launchCalendarActivity(context: Context) {
context.startActivity(intent)
}

class CalendarActivity : AppCompatActivity() {
class CalendarActivity : ComponentActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package androidx.compose.samples.crane.details
import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.annotation.VisibleForTesting
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.Text
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -73,7 +73,7 @@ data class DetailsActivityArg(
val longitude: String
)

class DetailsActivity : AppCompatActivity() {
class DetailsActivity : ComponentActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import androidx.compose.material.BackdropValue
import androidx.compose.material.DrawerValue
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.ModalDrawerLayout
import androidx.compose.material.rememberBackdropState
import androidx.compose.material.rememberBackdropScaffoldState
import androidx.compose.material.rememberDrawerState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
Expand Down Expand Up @@ -82,7 +82,7 @@ fun CraneHomeContent(

BackdropScaffold(
modifier = modifier,
backdropScaffoldState = rememberBackdropState(BackdropValue.Revealed),
scaffoldState = rememberBackdropScaffoldState(BackdropValue.Revealed),
frontLayerScrimColor = Color.Transparent,
appBar = {
HomeTabBar(openDrawer, tabSelected, onTabSelected = { tabSelected = it })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

package androidx.compose.samples.crane.home

import androidx.compose.foundation.Box
import androidx.compose.foundation.ContentGravity
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.launchInComposition
import androidx.compose.runtime.LaunchedTask
import androidx.compose.samples.crane.R
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.vectorResource
import kotlinx.coroutines.delay
Expand All @@ -31,8 +31,8 @@ private const val SplashWaitTime: Long = 2000

@Composable
fun LandingScreen(modifier: Modifier = Modifier, onTimeout: () -> Unit) {
Box(modifier = modifier.fillMaxSize(), gravity = ContentGravity.Center) {
launchInComposition {
Box(modifier = modifier.fillMaxSize(), alignment = Alignment.Center) {
LaunchedTask {
delay(SplashWaitTime)
onTimeout()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
package androidx.compose.samples.crane.home

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.activity.ComponentActivity
import androidx.compose.animation.DpPropKey
import androidx.compose.animation.core.FloatPropKey
import androidx.compose.animation.core.Spring.StiffnessLow
import androidx.compose.animation.core.spring
import androidx.compose.animation.core.transitionDefinition
import androidx.compose.animation.core.tween
import androidx.compose.animation.transition
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.Stack
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
Expand All @@ -43,7 +43,7 @@ import androidx.compose.ui.platform.setContent
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp

class MainActivity : AppCompatActivity() {
class MainActivity : ComponentActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand All @@ -59,7 +59,7 @@ class MainActivity : AppCompatActivity() {

var splashShown by remember { mutableStateOf(SplashState.Shown) }
val transition = transition(splashTransitionDefinition, splashShown)
Stack {
Box {
LandingScreen(
modifier = Modifier.drawOpacity(transition[splashAlphaKey]),
onTimeout = { splashShown = SplashState.Completed }
Expand Down
17 changes: 1 addition & 16 deletions Crane/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import com.example.crane.buildsrc.Libs
import com.example.crane.buildsrc.Urls
import com.example.crane.buildsrc.Versions
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

buildscript {
repositories {
Expand Down Expand Up @@ -57,7 +56,7 @@ subprojects {
}
}

tasks.withType(KotlinCompile).configureEach {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
// Treat all Kotlin warnings as errors
allWarningsAsErrors = true
Expand All @@ -69,18 +68,4 @@ subprojects {
freeCompilerArgs += '-Xallow-jvm-ir-dependencies'
}
}

// Crane uses Compose alpha03 and Android Gradle Plugin 4.2.0-alpha13 which are incompatible
// TODO: Remove this workaround when updating to >alpha04
configurations.configureEach {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def group = details.requested.group
def module = details.requested.module.name
def version = details.requested.version

if (group == 'androidx.compose.compiler' && module == 'compiler') {
details.useTarget("androidx.compose:compose-compiler:$version")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package com.example.crane.buildsrc

object Versions {
const val ktLint = "0.38.1"
const val ktLint = "0.39.0"
}

object Libs {
Expand All @@ -26,23 +26,21 @@ object Libs {
const val googleMaps = "com.google.android.libraries.maps:maps:3.1.0-beta"

object Accompanist {
private const val version = "0.2.2"
private const val version = "0.3.1"
const val coil = "dev.chrisbanes.accompanist:accompanist-coil:$version"
}

object Kotlin {
private const val version = "1.4.0"
private const val version = "1.4.10"
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 AndroidX {
const val appcompat = "androidx.appcompat:appcompat:1.3.0-alpha02"

object Compose {
const val snapshot = ""
const val version = "1.0.0-alpha03"
const val version = "1.0.0-alpha05"

const val runtime = "androidx.compose.runtime:runtime:$version"
const val runtimeLivedata = "androidx.compose.runtime:runtime-livedata:$version"
Expand Down
6 changes: 3 additions & 3 deletions JetNews/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ dependencies {

implementation 'androidx.appcompat:appcompat:1.3.0-alpha02'
implementation 'androidx.activity:activity-ktx:1.1.0'
implementation 'androidx.core:core-ktx:1.5.0-alpha02'
implementation 'androidx.core:core-ktx:1.5.0-alpha04'

implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.0-alpha07"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.0-alpha07"
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.0-beta01"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.0-beta01"

androidTestImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test:rules:1.3.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,7 @@ private fun DrawerButton(
Text(
text = label,
style = MaterialTheme.typography.body2,
color = textIconColor,
modifier = Modifier.fillMaxWidth()
color = textIconColor
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

package com.example.jetnews.ui

import androidx.compose.foundation.Box
import androidx.compose.foundation.layout.Stack
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.offsetPx
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.FractionalThreshold
Expand Down Expand Up @@ -48,7 +47,7 @@ fun SwipeToRefreshLayout(
true
}

Stack(
Box(
modifier = Modifier.swipeable(
state = state,
anchors = mapOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package com.example.jetnews.ui.article

import android.content.Context
import android.content.Intent
import androidx.compose.foundation.AmbientContentColor
import androidx.compose.foundation.Icon
import androidx.compose.foundation.Text
import androidx.compose.foundation.contentColor
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
Expand Down Expand Up @@ -57,12 +57,12 @@ import com.example.jetnews.data.posts.impl.post3
import com.example.jetnews.model.Post
import com.example.jetnews.ui.ThemedPreview
import com.example.jetnews.ui.home.BookmarkButton
import com.example.jetnews.utils.launchUiStateProducer
import com.example.jetnews.utils.produceUiState
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking

/**
* Stateful Article Screen that manages state using [launchUiStateProducer]
* Stateful Article Screen that manages state using [produceUiState]
*
* @param postId (state) the post to show
* @param postsRepository data source for this screen
Expand All @@ -75,7 +75,7 @@ fun ArticleScreen(
postsRepository: PostsRepository,
onBack: () -> Unit
) {
val (post) = launchUiStateProducer(postsRepository, postId) {
val (post) = produceUiState(postsRepository, postId) {
getPost(postId)
}
// TODO: handle errors when the repository is capable of creating them
Expand Down Expand Up @@ -129,7 +129,7 @@ fun ArticleScreen(
Text(
text = "Published in: ${post.publication?.name}",
style = MaterialTheme.typography.subtitle2,
color = contentColor()
color = AmbientContentColor.current
)
},
navigationIcon = {
Expand Down
Loading