Bruno_
11/05/2019, 7:15 PMstartActivityForResult
? technically I could make everything that I need global, but it would cause spaghetti codenglauber
11/06/2019, 1:01 AMKarthick
11/06/2019, 4:17 AMamar_1995
11/06/2019, 6:39 AMandrew
11/07/2019, 12:21 AMjoeykaan
11/07/2019, 7:24 AMamar_1995
11/07/2019, 7:37 AMColumn(modifier = ExpandedHeight, crossAxisAlignment = CrossAxisAlignment.End, mainAxisAlignment = MainAxisAlignment.End ) {
Column(modifier = Spacing(16.dp)) {
val icon = +imageResource(R.drawable.add)
FloatingActionButton(icon = icon, color = Color.Red, elevation = 8.dp)
}
}
Also tried using +vectorResource(R.drawable.add) as ImageJakub Valigura
11/07/2019, 9:47 AMamar_1995
11/07/2019, 10:32 AMcontext
as input parameter while calling from setContent
.
How to use the same function calling from @Preview
function
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MainScreen(applicationContext)
}
}
}
@Composable
fun MainScreen(context: Context) { ...}
@Preview
@Composable
fun testPreview() {
MainScreen( needToGetContextHere )
}
As in preview function we cannot pass any parameter. Is there any other approach to preview this ??
I think of one solution is to make context
global. Is there any other better approach ??Antanas A.
11/08/2019, 2:09 PMcodeslubber
11/08/2019, 3:41 PMzak.taccardi
11/09/2019, 9:20 PMAhmed Elhanafy
11/09/2019, 11:06 PMMuh Rahmatullah
11/10/2019, 6:37 AMcompose
, anko
& litho
? thanks!eneim
11/11/2019, 4:17 AMamar_1995
11/11/2019, 6:53 AMjava.lang.RuntimeException: Unable to start activity ComponentInfo{<http://package.name/package.name.MainActivity|package.name/package.name.MainActivity>}: java.lang.IllegalStateException: Composition requires an active composition context
amar_1995
11/11/2019, 10:41 AMresources
folder, editor shows error that file doesn't exists.Carlos Muñoz
11/11/2019, 10:55 AMBruno_
11/11/2019, 2:17 PMZach Klippenstein (he/him) [MOD]
11/11/2019, 8:28 PMamar_1995
11/12/2019, 9:26 AMtopAppBar
I wrote this sample code
TopAppBar(
title = { Text(text = "Sample App") },
navigationIcon = {
SimpleImageButton(R.drawable.hamburger) {
openDrawer()
}
},
actionData = listOf(+imageResource(R.drawable.search),+imageResource(R.drawable.img_translate))
) {
AppBarIcon(icon = it, onClick = { Toast.makeText(context, "Clicked ", Toast.LENGTH_SHORT).show()})
}
I do have list of two action item, now how to decide which action icon is clicked ? Is there is any way to check image type inside if-else
or when
statement.Ngenge Senior
11/12/2019, 10:48 AM@Composable
fun MaterialCard() {
val image = +imageResource(R.drawable.photographer)
Card(shape = RoundedCornerShape(size = 8.dp)) {
Column(modifier = Spacing(16.dp)) {
SimpleImage(image = image)
Text("A day in Shark Fin Cove",style = (+themeTextStyle { h6 }).withOpacity(.6f))
Text("Davenport, California",style = (+themeTextStyle { body2 }).withOpacity(.87f))
Text("December, 2018",style = (+themeTextStyle { body2 }).withOpacity(0.6f))
Row() {
Button(text = "Got it",style = ContainedButtonStyle(rippleColor = Color.Green))
Button(text = "Cancel",style = TextButtonStyle())
}
}
}
}
amar_1995
11/13/2019, 9:27 AMsetContentView
which is responsible to load xml layout and setContent
in single activity class ?amar_1995
11/13/2019, 12:41 PMTextField
to get userInput. But I am not able to write anything in TextFeild
@Composable
fun EditTextView(text: String) {
val textState = +state{ text }
Padding(left = 8.dp, top = 8.dp, right = 8.dp) {
Surface(
color = Color.Gray,
shape = RoundedCornerShape(8.dp)
) {
Padding(padding = 5.dp) {
TextField(value = textState.value,
onValueChange = { textState.value = it })
}
}
}
}
ursus
11/14/2019, 3:37 AMBalakrishna Sangem
11/14/2019, 3:35 PMVerticalScroller
, Is it a lot laggy.amar_1995
11/15/2019, 7:04 AMsetViewContent
which accept composable function as input parameter similar to setContent
. So I want know what is a diference between setViewContent
and setContent
and its use-cases.
And my second question is that setContent
and setViewContent
both return CompositionContext?
. So what is the usage of CompositionContext ?kioba
11/15/2019, 1:43 PMSteve
11/15/2019, 6:21 PMspierce7
11/15/2019, 7:11 PMspierce7
11/15/2019, 7:11 PMLeland Richardson [G]
11/15/2019, 7:28 PMAdam Powell
11/15/2019, 9:36 PM