Vishnu Shrikar
01/06/2024, 6:53 AMSkipped 3614 frames! The application may be doing too much work on its main thread.
2024-01-06 00:50:55.335 14485-14627 OpenGLRenderer com.example.voicemailreader I Davey! duration=30150ms; Flags=1, FrameTimelineVsyncId=2207817, IntendedVsync=135945501994094, Vsync=135975618659556, InputEventId=0, HandleInputStart=135975627054378, AnimationStart=135975627061826, PerformTraversalsStart=135975627065264, DrawStart=135975649409066, FrameDeadline=135945516660760, FrameInterval=135975626947451, FrameStartTime=8333333, SyncQueued=135975650291358, SyncStart=135975650341253, IssueDrawCommandsStart=135975650379430, SwapBuffers=135975650861358, FrameCompleted=135975652198753, DequeueBufferDuration=9739, QueueBufferDuration=636146, GpuCompleted=135975651478128, SwapBuffersCompleted=135975652198753, DisplayPresentTime=5275176910390976339,
So im just creating and destroying composableviews in my main thread here but WHEN I TRY TO PUT IT INTO ANOTHER THREAD, THE SYSTEM HAS THE AUDACITY TO TELL ME NOT ALLOWED, HOW DARRRRRRRRRRRRRRRRRRRRE !!!!
So... any ideas?
note the program DOES work, but it takes a bit of time and i have to click wait on the popup that comes upVishnu Shrikar
01/06/2024, 6:54 AM@Composable
fun TopViewContent( activity: MainActivity, wm: WindowManager, view: ComposeView) {
Box(modifier = Modifier
.fillMaxSize()
.border(2.dp, Color.Red)
.background(Color.Transparent)
.pointerInput(Unit) {
detectTapGestures { offset ->
println("YO YO I LIVE")
val intarr = IntArray(2)
view.getLocationOnScreen(intarr)
val viewoffset = Offset(intarr[0].toFloat(), intarr[1].toFloat())
val x = offset.x + viewoffset.x
val y = offset.y + viewoffset.y
println("VIEWOFST ${viewoffset.x} ${viewoffset.y}")
println("TOUCHOFST: ${offset.x} ${offset.y}")
println("OFFST: $x $y")
val bounding = view.width / 4 * 3 to view.height / 10 * 9
if (x < bounding.first && y > bounding.second) {
MainActivity.actionQueue.add {
Shell
.cmd(tapCmdBuilder(x, y))
.exec()
}
val viewParamsPair = voiceMailView(
activity.applicationContext, activity = activity, wm
) { a, w, v ->
BottomViewContent(
activity = a,
wm = w,
view = v,
)
}.apply {
viewKillList.add(this)
} to vmParamsBuilder()
activity.removeView(wm, view, viewParamsPair)
}
}
//activity.finish()
// wm.removeViewImmediate(view)
}
) {
LazyColumn(
modifier = Modifier
.fillMaxWidth()
.fillMaxHeight(0.9f)
.background(Color.Black)
.padding(top = 40.dp)
) {
// val voicemails = listOf(
// Voicemail(
// "12345678",
// 1,
// 3458,
// "hoooboop"
// )
// )
val voicemails = MainActivity.fakeVmList
items(voicemails.size) { index ->
val voicemail = voicemails[index]
Card(
modifier = Modifier
.fillMaxWidth()
//.border(2.dp, Color.Green)
.padding(bottom = 20.dp),
colors = CardDefaults.cardColors(
containerColor = Color.Black
)
) {
Row(
modifier = Modifier
.fillMaxWidth()
.align(Alignment.CenterHorizontally),
horizontalArrangement = Arrangement.SpaceBetween
) {
Box(modifier = Modifier.fillMaxWidth(.2f)){
Icon(
bitmap = MainActivity.getContactPhoto(activity, voicemail.from)
.asImageBitmap(),
contentDescription = null,
modifier = Modifier
.width(64.dp)
.height(64.dp)
.align(Alignment.CenterStart),
tint = Color.Unspecified
)
}
Column(
modifier = Modifier
.fillMaxWidth()
.padding(start = 10.dp),
horizontalAlignment = Alignment.Start
) {
TpText(
textAlign = TextAlign.Left,
color = Color.Red,
text = voicemail.from
)
TpText(
multiplier = 0.6,
color = Color.Red,
text = "Date"
)
TpText(
multiplier = 0.8,
textAlign = TextAlign.Left,
color = Color.Red,
text = "This is a message for PLACEHOLDER FOR ACTUAL TRANSCRIPT YO"
)
}
}
}
}
}
}
}
Vishnu Shrikar
01/06/2024, 6:54 AMVishnu Shrikar
01/06/2024, 6:55 AM@Composable
fun BottomViewContent(activity: MainActivity, wm: WindowManager, view: ComposeView) {
Box(modifier = Modifier
.fillMaxSize()
.border(2.dp, Color.Red)
.background(Color.Transparent)
.pointerInput(Unit) {
detectTapGestures { offset ->
val intarr = IntArray(2)
view.getLocationOnScreen(intarr)
val viewoffset = Offset(intarr[0].toFloat(), intarr[1].toFloat())
val x = offset.x + viewoffset.x
val y = offset.y + viewoffset.y
println("VIEWOFST ${viewoffset.x} ${viewoffset.y}")
println("TOUCHOFST: ${offset.x} ${offset.y}")
println("OFFST: $x $y")
//activity.finish()
val bounding = view.width / 4 * 3
if (x < bounding) {
MainActivity.actionQueue.add {
Shell
.cmd(tapCmdBuilder(x, y))
.exec()
}
val viewParamsPair = voiceMailView(
activity.applicationContext, activity = activity, wm
) { a, w, v ->
BottomViewContent(
activity = a,
wm = w,
view = v,
)
}.apply {
viewKillList.add(this)
} to vmParamsBuilder()
activity.removeView(wm, view, viewParamsPair)
} else {
println("MAIN")
MainActivity.mainWM.addView(
ComposeView(
activity.applicationContext
).apply {
MainActivity.viewKillList.add(this)
this.setViewTreeLifecycleOwner(activity.lifecycleOwner)
this.setViewTreeSavedStateRegistryOwner(activity.registryOwner)
this.setContent {
TopViewContent(activity = activity, wm = wm, view = this)
}
},
vmParamsBuilder2()
)
wm.removeView(view)
}
}
}
)
}
Vishnu Shrikar
01/06/2024, 6:56 AMKirill Grouchnikov
01/06/2024, 2:19 PMVishnu Shrikar
01/07/2024, 12:53 AMcurioustechizen
01/07/2024, 2:52 AMKirill Grouchnikov
01/07/2024, 3:17 AMVishnu Shrikar
01/07/2024, 3:39 AMKirill Grouchnikov
01/07/2024, 3:41 AMVishnu Shrikar
01/07/2024, 6:55 AMKirill Grouchnikov
01/07/2024, 1:04 PMandylamax
01/08/2024, 12:39 PMVishnu Shrikar
01/08/2024, 3:19 PMKirill Grouchnikov
01/08/2024, 4:09 PMVishnu Shrikar
01/08/2024, 4:20 PMVishnu Shrikar
01/08/2024, 4:22 PM