Skip to content

Commit

Permalink
Merges alpha05 branch to main (#228)
Browse files Browse the repository at this point in the history
* [Jetcaster] Update to SNAPSHOT 6891475 (#216)

* Update Jetcaster to SNAPSHOT 6891475
* Fix episode title being centered

* [Crane] Update to SNAPSHOT 6891475 (#217)

* [Jetchat] Update to SNAPSHOT 6891475

Change-Id: I4a9e194aabce890638da09a632de33928ad5237f

* Spotless

Change-Id: Ic46c8dcfd12451ff3988a1127ac97062b0b440fb

* [Rally] Update to SNAPSHOT 6891475

Change-Id: I3252cfe051737927d76cc8559d24bf516a720d3c

* [Jetsurvey] Bump to alpha05

* [Jetsurvey] Using onSizeChanged to set the branding height

* [Jetsurvey] Bump to alpha05

* [Jetsurvey] Using onSizeChanged to set the branding height

* [Rally] Removes maven central snapshot repo

Change-Id: I473f1f55b40e4c81fc655568828db3ab94fea0a6

* [Jetchat] Removes maven central snapshot repo

Change-Id: I5b16871c3ef1a612da8b6f1d96309f2bc40c19d3

* [Jetsnack] Update to snapshot 6901934.

Change-Id: I1d6a951b9cba9994241315348daedaac1b5f278c

* [Jetsnack] Remove unused import.

Change-Id: Ieacdb2dc7253fe25977c123ee3d140b7bdb81f0d

* [Owl] Accept modifiers in search suggestion items.

Change-Id: I9a5bf25e5bfa4632738e1e03539039a9959a03f0

* [Owl] Update to snapshot 6901934.

Change-Id: I15c92c5252e61b8918bbb9c80cbdc679e3809555

* Bump JetNews to alpha05 (#221)

Changes:
- Use new produceState API in launchUiStateProducer
- Rename launchUiStateProducer to produceUiState to match naming
- Change launchInComposition to new API LaunchedTask
- Replace Box/Surface with new Box import
- Update modifiers for Text composable to work with new layout rules
- Update to use new AmbientContentColor and AmbientEmphasisLevels

Bugfix:
- Fix size of error case in [HomeScreenErrorAndContent], avoiding
  the swipe to refresh drawing in the incorrect place.

* [Readme] Removes known issues (#222)

* [All] Updates to alpha05 (#227)

* [All] Updates to 6901934 snapshot

* [All] Updates to alpha05

Co-authored-by: Chris Banes <[email protected]>
Co-authored-by: Jose Alcerreca <[email protected]>
Co-authored-by: Florina Muntenescu <[email protected]>
Co-authored-by: Florina Muntenescu <[email protected]>
Co-authored-by: Jose Alcérreca <[email protected]>
Co-authored-by: Nick Butcher <[email protected]>
Co-authored-by: Nick Butcher <[email protected]>
Co-authored-by: Sean McQuillan <[email protected]>
  • Loading branch information
9 people authored Oct 14, 2020
1 parent ef2c759 commit 7da64ff
Show file tree
Hide file tree
Showing 73 changed files with 446 additions and 374 deletions.
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

0 comments on commit 7da64ff

Please sign in to comment.