romainguy
01/30/2021, 10:09 PMShakil Karim
01/31/2021, 5:56 PMMark Murphy
01/31/2021, 7:43 PMcontent
composable lambda. I am more worried about cases where the library itself should be calling composable functions for certain roles, but it has no a priori way of knowing what those functions are.
For example, if a library wants to render a button, it needs some composable for that. But Button()
is a Compose Material thing, and the argument made here on several occasions is that Compose Material is just one possible design system. Somehow, the library needs a way to know "this is how I build a button", in such a way that it uses the app's chosen design system. Do we have a pattern for doing this? For apps themselves, they can simply use the right composable functions, but published libraries do not have that option, as they will be used by many apps.
My fear is that, in the absence of such a pattern, libraries will tend towards "you can have any design system you want, so long as it is Compose Material".Vincent Williams
02/01/2021, 1:30 AMbuildFeatures {
compose = true
}
I get the following error:
com.intellij.openapi.externalSystem.model.ExternalSystemException: Could not create task ':app:compileDebugKotlin'.
org/jetbrains/kotlin/gradle/tasks/KotlinCompile
Any ideas why? Im trying to use compose alpha 10 on the latest canary AS and kotlin 1.4.21Photoxor
02/01/2021, 2:41 AMPopup
has changed in alpha11. Width is now limited to parent width. Is this intended?Archie
02/01/2021, 6:40 AM@Composable
fun PoppingInCard() {
// Creates a transition state with an initial state where visible = false
val visibleState = remember { MutableTransitionState(false) }
// Sets the target state of the transition state to true. As it's different than the initial
// state, a transition from not visible to visible will be triggered.
visibleState.targetState = true
...
}
I was wondering whether doing:
visibleState.targetState = true
is fine? Like to create an "Intro Animation"? or is it better to put that inside a SideEffect
? or is there a better way?Rafs
02/01/2021, 7:48 AMHatice Sarp
02/01/2021, 11:30 AMval paginatedBlockedUsers = settingsViewModel.fetchBlockedUsers().collectAsLazyPagingItems()
LazyColumn {
itemsIndexed(paginatedBlockedUsers) { index, item ->
if (item != null) {
UserListItem(
item = item
)
}
}
After upgrading from Alpha 9 to Alpha 11 when paging is on alpha-05, I get following error:
one of the following functions can be called with the arguments supplied:
public inline fun <T> LazyListScope.itemsIndexed(items: Array<TypeVariable(T)>, crossinline itemContent: LazyItemScope.(index: Int, item: TypeVariable(T)) -> Unit): Unit defined in androidx.compose.foundation.lazy
public inline fun <T> LazyListScope.itemsIndexed(items: List<TypeVariable(T)>, crossinline itemContent: LazyItemScope.(index: Int, item: TypeVariable(T)) -> Unit): Unit defined in androidx.compose.foundation.lazy
How do I use .collectAsLazyPagingItems() and itemsIndexed(paginatedItem) { index, item -> } in alpha 11 ?Se7eN
02/01/2021, 11:30 AMval items = viewModel.items.collectAsState(initial = listOf())
LazyColumn {
items(items.value.size) { index ->
...
}
}
But if I do val items = viewModel.items.collectAsState(..).value
and items(items.size)
, it works fine. Why doesn't the first snippet work?Yasin Kaçmaz
02/01/2021, 11:32 AMdarkmoon_uk
02/01/2021, 12:15 PMPiotr
02/01/2021, 1:54 PMloloof64
02/01/2021, 3:32 PMExecution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find androidx.ui:ui-tooling:1.0.0-alpha11.
Searched in the following locations:
- <https://dl.google.com/dl/android/maven2/androidx/ui/ui-tooling/1.0.0-alpha11/ui-tooling-1.0.0-alpha11.pom>
- <https://jcenter.bintray.com/androidx/ui/ui-tooling/1.0.0-alpha11/ui-tooling-1.0.0-alpha11.pom>
Required by:
project :app
Possible solution:
- Declare repository providing the artifact, see the documentation at <https://docs.gradle.org/current/userguide/declaring_repositories.html>
Here my build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
compose_version = '1.0.0-alpha11'
}
ext.kotlin_version = "1.4.21"
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.0-alpha05'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Here my app build.gradle
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 30
defaultConfig {
applicationId "com.loloof64.chessexercisesorganizer"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), '<http://proguard-rules.pro|proguard-rules.pro>'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
useIR = true
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
kotlinCompilerVersion '1.4.10'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.ui:ui-tooling:$compose_version"
implementation "androidx.compose.material:material-icons-extended:$compose_version"
def nav_compose_version = "1.0.0-alpha06"
implementation "androidx.navigation:navigation-compose:$nav_compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0-rc01'
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
I've just downloaded the latest Android Studio canary todayJulianK
02/01/2021, 4:05 PMloloof64
02/01/2021, 4:30 PMImage(asset = vectorResource(id = imageRef), modifier = modifier)
spierce7
02/01/2021, 4:36 PMMaterialTheme.typography.h1
statically when I want to set an h1, but how would I gain access to the theme that is actually set to get it’s typography, and potentially overridden styles?Rick Regan
02/01/2021, 5:21 PMMehdi Haghgoo
02/01/2021, 5:23 PMSinan Gunes
02/01/2021, 6:01 PMZach Klippenstein (he/him) [MOD]
02/01/2021, 7:17 PMViewTreeViewModelStoreOwner
to be configured when AbstractComposeView
is attached: Is that requirement just there to ensure that the viewModel()
composable function always works, if any code in the composition happens to call it? Or is there actually something in the Compose foundation that’s relying on a ViewModel
?krzysztof
02/01/2021, 8:01 PM@Preview
on alpha10
? Marking composable with Preview
gets me androidx.ui.tooling.preview.PreviewActivity is not an Activity subclass or alias
. Using AS 4.2 Beta 4.Maryam Alhuthayfi [MOD]
02/01/2021, 8:20 PMkrzysztof
02/01/2021, 8:40 PMlivedata
of said data class was part of state in my view model. I started to observe it as state. What I found out is, I believe, is an optimisation that compose is applying, but correct me if I’m wrong here. When I postValue
with a new data class, with changed property that is declared in primary constructor, compose
catches that and triggers recomposition on state - so that’s correct. Now, postValue
with my data class with a change to a property that was not part of the primary constructor - compose
does not trigger recomposition, even if observer in observeAsState
is triggered.Jordi Saumell
02/01/2021, 9:08 PMJeisson Sáchica
02/01/2021, 10:01 PMjava.lang.NullPointerException: null cannot be cast to non-null type androidx.compose.ui.graphics.AndroidPathEffect
when using a androidx.compose.ui.graphics.PathEffect
on a ContentDrawScope.drawCircle
?Vincent Williams
02/02/2021, 12:15 AMSlackbot
02/02/2021, 2:38 AMspierce7
02/02/2021, 3:17 AMShakil Karim
02/02/2021, 7:56 AMAlbert Chang
02/02/2021, 8:15 AMScrollableController
for scrollable modifier? I'm trying to implement something similar to the PagerSnapHelper
of RecyclerView but found it difficult using FlingConfig
because I have to know current offset, page size, etc to calculate fling distance and if I implement it using FloatDecayAnimationSpec
then it can't be stateless.