```Skipped 3614 frames! The application may be do...
# compose-android
v
Copy code
Skipped 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 up
Copy code
@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"

                            )
                        }

                    }
                }
            }
        }
    }
}
This is the code that fails
Copy code
@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)


                }

            }


        }
    )


}
If I create the BottomViewContent view from another BottomViewContent view, the application is not slow like a boomer at the super market
k
Since this isn't your first time doing this, I'll remind you about something that applies not only to this Slack, but to online programming forums in general. We're all frustrated when things don't work the way we expect. Sarcastic comments along the way will only serve to turn people away from the substance of your question. Focus on what is not working, and use neutral language to describe what you tried and what you want to achieve. Insulting other people's work (especially when you are asking for help from some of those same people whose work you're insulting), and insulting other people's age isn't the flex you might think it is.
šŸ‘† 7
šŸ‘Ž 1
šŸ‘†šŸ½ 1
šŸ‘†šŸ» 3
šŸ‘†šŸ¾ 1
v
Whose work is being insulted, except my own? Or do you mean the "system" Look its annoying enough and pisses me off enough that people consider coorperations people, But this is MY computer, which I built, no company built it, its my SYSTEM, Why are you mad that im "insulting" my system Also its MY phone, and My code, everything here is MINE and im not even insulting it but even if i was again... mine, jeez apparently saying "how dare my code not work" is an insult against people now SO NOW ILL REMIND YOU, instead of looking for problems in peoples wording, and doing a tone police fallacy, maybe focus on the content and read it and realize that its literally like getting mad at a function or thread or whatever, like seriously ur being annoying Ill also say, that there are VERY few places on discord like this and many of them relate to programming, infact once you leave beginner programming servers, even if the docs are not clear, you get insulted for not reading them even if you did, and you know what, people there get effective and useful help while people in beginner programming discords (even though they say all levels are allowed) wont get help past the very basics Like chill, its not that deep
c
There are dozens of questions on this channel every day. When skimming through the questions, which ones do you think they're going to pick? Or even read to completion? The ones that are succinct and to the point? Or ones that have some all-caps sentences that look like insults? Also, the reason to try to keep your tone neutral is that there are folks from across the globe here. It is easier to avoid misunderstanding by sticking to the core question. In short, you're helping others help you by focusing on the question.
k
Here’s a hypothetical. Imagine that you’re at an Android conference, and after a session you come up to the stage to ask the speakers a few questions about how to do things on Android. Now imagine getting in their face, like an inch away, and starting to scream at the top of your lungs. This is what you’re doing here every time you turn caps on and launch into one of these tirades. How do you think it’s going to go in real life? Will people calmly look beyond the screaming and try to somehow focus on the substance of the question? Or will they turn away and go on to the next question from another person?
v
Last I checked this is not an IRL conference as what you do in person is a LOT different than what you do online. For example, in person im sure people would say and you just fanangle this here and not fully explain themselves because they are RIGHT THERE, the person if they dont understand can just ask for clarification and not have an issue. As far as readability of my question. its like a small MINI paragraph at most and is not longer than most questions here and is like almost all Necessary info for the question. It is succint and it gets to the point. Sure some of it is in CAPS but that does not change that. THE INTERNET IS NOT IRL and people need to stop treating it like it is. In fact I would argue that the only useless information here is the tone policing responses that try to claim false information about what I stated.
k
It’s up to you to decide if you want people to answer your questions or not
šŸ’Æ 3
v
Yeah well since yall went and whined in #meta i no longer want help on this question, Ill leave it up for reference but wont respond to it or answer any clarification, nor post any solutions I find on my own. I disagree that what I said is insulting as you all say it is but if you feel so strongly this question is doing all that then I dont want to participate in this question... Thanks for your opinions and hopefully ill make a question sometime that you want to participate in
k
Here’s how it usually goes, whether one likes it or not. In forums such as these, people don’t like two things. They don’t like negativity, but even more than that, they don’t like their time being wasted. All-caps online means shouting. Some might find it quirky or endearing. Some might find it immature and disagreeable. When you say ā€œWHEN I TRY TO PUT IT INTO ANOTHER THREAD, THE SYSTEM HAS THE AUDACITY TO TELL ME NOT ALLOWED, HOW DARRRRRRRRRRRRRRRRRRRRE !!!!ā€ it is quite clear that you are talking about a part of the stack that is under your code, a part of the stack written by others (even if it runs on your device), a part of the stack written by some of the people that are in this forum. Certain design and implementation decisions went into single-threadedness of this UI toolkit, and using the words ā€œaudacityā€ and ā€œdareā€ is negativity. People don’t like negativity, online or in real life. Negativity pushes people away. But even more than that, people don’t want their time wasted. X/Y problem is one example of that, where a person asks ā€œI’m doing X but it’s not workingā€, and after a few exchanges it turns out that it’s actually Y that they want to solve, and X isn’t the right solution to begin with. You want to show that you’ve put time into your question. It’s not just dumping a piece of code into the question and expecting people to jump in. Is the code short? If it gets close to 100 lines or so, people leave. Is the code self-contained? Can people copy-paste it into their environment and have it compile and run without any other helper functions or dependencies that are missing? Is the code as simple as it can get? Frequently, in the process of getting to such a sample, you find the issue, as you remove more and more code and get to the piece that is the problem. Tone policing is necessary to keep any online forum from devolving into an abandoned ghost town. Scroll any of the forums here. Do you see people all-capping? Do you see people peppering their posts with venting, personal attacks or other similar distractions? You don’t. In the words of somebody much wiser than me, it’s called ā€œwe don’t do that hereā€. Help people help you. Help people decide that they should take five or ten minutes out of their day interacting with your post, with your question, with your issue. Don’t push them away, unless the only purpose of your post is to vent your frustration.
šŸ‘Ž 1
🚫 1
🤔 1
āŒ 1
šŸ‘ 1
šŸ’Æ 7
a
@Vishnu Shrikar despite your opinion, this method of asking question violates our community guidelines. Failure to follow the guidelines would lead for you to get banned. Consider this your second warning āš ļø
šŸ‘Ž 1
v
Yeah, why dont you point out the guideline? Because right now people are saying "all caps = insult" U know I play video games, and if anyone says "how dare the game deny me, or how their the boss kill me" People dont take that as insulting the devs of the game... You people need a grip on reality
k
https://kotlinlang.org/community/slackccugl.html which is one Google ā€œkotlin lang slack community guidelinesā€ search away
v
Lol I read those vague rules. They don't apply here unless someone work with actually insulted which once again due to common internet using your brain... does not. Which is why I want the mod to clarify
By the way this is actually really interesting question but instead of discussing that you people care about using the word dare shows that you guys aren't genuine about learning and rather care about community. Sjws lol