henrikhorbovyi
07/07/2020, 6:44 PMSergey Y.
07/07/2020, 7:26 PMAnes
07/07/2020, 7:50 PMConstraintLayout(modifier = Modifier.padding(16.dp)) {
val (headerImage, title, subtitle, date, like) = createRefs()
val modifier = Modifier
.preferredHeight(180.dp)
.fillMaxWidth()
.clip(RoundedCornerShape(8.dp))
.constrainAs(headerImage) {
top.linkTo(parent.top)
centerHorizontallyTo(parent)
}
Image(
asset = image,
modifier = modifier,
contentScale = ContentScale.Crop
)
likeCounter(
isFavorite = isFavorite.value,
tintColor = colors.primary,
updateCounts = { newValue -> isFavorite.value = newValue },
modifier = Modifier.constrainAs(like) {
top.linkTo(headerImage.bottom)
end.linkTo(parent.end)
}
)
Text(
text = "Hello this is nothing from nothing withing " +
"nothing and usually besides nothing and embedded in nothing",
style = typography.h6,
maxLines = 2,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.constrainAs(title) {
top.linkTo(headerImage.bottom)
start.linkTo(parent.start)
end.linkTo(like.start)
width to Dimension.fillToConstraints
}
)
}
henrikhorbovyi
07/08/2020, 1:48 AMGridLayout
in Compose?Alejandro Rios
07/08/2020, 1:55 AMBottomAppBar
inside a Scaffold
, a simple one, but keeps showing me an error Type mismatch related to this ((BottomAppBar.FabConfiguration?) → Unit)?
Alejandro Rios
07/08/2020, 1:55 AM@Composable
@Preview(showBackground = true)
fun DefaultRecipeCard() {
Scaffold(topAppBar = {
TopAppBar(
title = {
Text(text = "ComposablecookBok")
}
)
}, bodyContent = {
RecipeList(defaultRecipes)
}, bottomAppBar = BottomAppBar {
Text(
text = "Jetpack Compose",
modifier = Modifier.padding(16.dp)
)
}
)
}
Alejandro Rios
07/08/2020, 1:56 AMSiyamed
07/08/2020, 4:05 AMSiyamed
07/08/2020, 4:06 AMpajatopmr
07/08/2020, 6:07 AMremember
function as doing two things: 1) providing an initial value in performing a composition and 2) caching that value for subsequent compositions?Timo Drick
07/08/2020, 8:51 AMcoolchandrakumar
07/08/2020, 9:48 AMAndroidView(view = webview(ctx, "test"))
Facing crash in Huawei device while using AndroidView for converting ClassicView to compose. It is working in emulator and samsung device
fun webview(ctx: Context, html: String) = WebView(ctx).apply {
Log.d("ChanLog", "webview: $html")
this.webViewClient = WebViewClient()
loadData("<html><body><h1>Ch($html)</h1></body></html>", "text/html", "utf-8")
}
at androidx.ui.core.AndroidViewsHandler.onDescendantInvalidated(AndroidViewsHandler.kt:40)
at android.view.HwApsImpl.isNonEmptyFrameCase(HwApsImpl.java:353)
at android.view.ViewGroup.invalidateChild(ViewGroup.java:5984)
at android.view.View.invalidateInternal(View.java:17751)
at android.view.View.invalidate(View.java:17702)
at android.view.View.setFrame(View.java:22267)
at android.webkit.WebView.access$701(WebView.java:107)
AJ
07/08/2020, 2:12 PMModelList
of objects (like a Story
object with a title and body). When updating an object in my ModelList
, my UI doesn't change. However, if I add an element to the list, or just re-assign the entire list after changes, then the UI updates. Is this behavior expected? What is the best way to manage changing objects within a list that are represented on a Jetpack Compose UI, like in a VerticalScroller or LazyColumnItems so that it actually updates?John O'Reilly
07/08/2020, 5:08 PMAndroidView
to contain a layout that in turn contains a com.google.android.gms.maps.SupportMapFragment
. It works fine if that's only screen but just added some navigation and when I show another screen and then come back to this one again I'm getting following. Is there any recommended approach available right now to work around this?
Binary XML file line #6: Duplicate id 0x7f08009a, tag null, or parent id 0xffffffff with another fragment for com.google.android.gms.maps.SupportMapFragment
Lilly
07/09/2020, 12:32 AMConstraintLayout
for all layouts. In non-compose layouts I used to use only ConstraintLayout
for all layouts and never regret. I mean, are there any use cases where you would use Rows/Columns
where ConstraintLayout
wouldn't also fit?Harish Gupta
07/09/2020, 5:18 AMNikhil
07/09/2020, 9:44 AMSrSouza
07/09/2020, 5:39 PMJoe Jensen
07/09/2020, 11:46 PMYamila Gammeri
07/10/2020, 1:02 AMTolriq
07/10/2020, 7:05 AMaipok
07/10/2020, 12:36 PMonFocusChange
for view in compose? I meant that keyboard is not always called automatically and we need a view reference in order to present it or hide it. It there any clean way to handle from composable?Desmond Teo
07/10/2020, 1:24 PMnglauber
07/10/2020, 2:27 PM@RunWith(JUnit4::class)
class ExampleInstrumentedTest {
@get:Rule
val composeTestRule = createComposeRule()
@Test
fun testProductQuantity() {
var quantity = 0
composeTestRule.setContent {
MaterialTheme {
MyComponent(onUpdate = { quantity += it })
}
}
findByTag("Product_Inc")
.doClick()
.doClick()
runOnIdleCompose {
assertEquals(quantity, 2)
}
}
}
When I press the run button, I can see the loading on the Run panel on Android Studio, but after a few seconds I get this message:
java.lang.AssertionError: Activity never becomes requested state "[CREATED, STARTED, RESUMED, DESTROYED]" (last lifecycle transition = "PRE_ON_CREATE")
caelum19
07/10/2020, 2:41 PMiex
07/11/2020, 10:03 AMiex
07/11/2020, 10:31 AMclass MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
Text("Hello world!")
}
}
}
java.lang.NoSuchMethodError: No static method setContent$default(Landroidx/activity/ComponentActivity;Landroidx/compose/Recomposer;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)Landroidx/compose/Composition; in class Landroidx/ui/core/WrapperKt; or its super classes (declaration of 'androidx.ui.core.WrapperKt' appears in /data/app/com.match.android-863fKnuh3LTaDvTF4A7agg==/base.apk)
nglauber
07/11/2020, 1:59 PMAndroidView
. Does this issue still happening?
I have a layout with a TextView
and a CalendarView
and I’m just trying to show/hide the CalendarView
when I click on the TextView
. But the screen is frozen… 😕
@Composable
fun MyCalendar() {
var currentDate by state { Date() }
AndroidView(resId = R.layout.my_layout) { view ->
val textView = view.findViewById<TextView>(R.id.txtDate)
val calendarView = view.findViewById<CalendarView>(R.id.calendarView)
calendarView?.visibility = View.GONE
textView?.text = currentDate.toString()
textView?.setOnClickListener {
calendarView?.let {
it.visibility = if (it.visibility == View.VISIBLE)
View.GONE
else View.VISIBLE
}
}
}
}
Socheat KHAUV
07/11/2020, 3:56 PMImage(asset = CustomAndroidImageAsset(bitmap = p.bitmap))
But some how when framework starting to draw the image. there is an implementation inside AndroidCanvas.kt call the following function
image.asAndroidBitmap()
This function always throw UnsupportedOperationException("Unable to obtain android.graphics.Bitmap")
which is correct because my CustomAndroidImageAsset is not AndroidImageAsset.
Mabye you could expose AndroidImageAsset for external use as well ?iex
07/11/2020, 7:01 PMModel
annotation) don't resonate that much with me. I like the unidirectional flow with MVVM and live data. I'm considering implementing MVI like described here https://medium.com/swlh/android-mvi-with-jetpack-compose-b0890f5156ac but without the "innovation" of letting the state to directly create the Compose views. I'd let the fragment create those in response to the state. Are there any problems with this approach?iex
07/11/2020, 7:01 PMModel
annotation) don't resonate that much with me. I like the unidirectional flow with MVVM and live data. I'm considering implementing MVI like described here https://medium.com/swlh/android-mvi-with-jetpack-compose-b0890f5156ac but without the "innovation" of letting the state to directly create the Compose views. I'd let the fragment create those in response to the state. Are there any problems with this approach?MutableState
or @Model
but instead pushing down immutable objects with all the state will turn off optimizations or something?Adam Powell
07/11/2020, 7:19 PM@Immutable
then they will be compared to previous parameter values and a composable function call will be skipped if the parameters are stable and equaliex
07/11/2020, 8:48 PMLeland Richardson [G]
07/11/2020, 9:55 PMiex
07/12/2020, 4:22 PM