• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

UI building without XML or Compose

Hello,

independent of XML and Compose, there are also other ways to build your UI. I have written some helper classes and put together my UI with a kind of custom DSL. It works almost perfectly. 😊


override fun createLayout(target: FrameLayoutBuilder) {
instance = this
with(target) {
addLinearLayout {
setOrientationVertical()
add(ActivityHeader())
createContent(this)
add(ActivityFooter())
}
}
}


private fun createContent(target: LinearLayoutBuilder) {
with(target) {
addFrameLayout {
setLayoutWeight(1f)
addLinearLayout {
setOrientationVertical()
addFrameLayout {
setLayoutWeight(1f)
addSurfaceView {
setSurface(Playground)
}

addRelativeLayout {
setGravityBottomRight()
addTextView {
setVisibleFalse()
formatHint(this)
addReceiver(Playground.hint) {
setTextId(it)
setVisible(it != R.string.Empty)
}
}
}
}
createInfoLine(this)
}
addFrameLayout {
addReceiver(overlay) {
replace(it)
}
}
}
}
}

fun formatHint(target: TextViewBuilder) {
with(target) {
setTextSizeSP(20)
setTextColorID(R.color.hintText)
setMarginsDP(50, 10, 20, 20)
setPaddingsDP(20, 10)
setGravityRight()
setGradientBackground {
cornerRadii = getCornerRadii(getPixelFromDP(15).toFloat())
setStroke(getPixelFromDP(6), getColorFromID(R.color.black))
setColor(getColorFromID(R.color.hint))
}
}
}

fun createInfoLine(target: LinearLayoutBuilder) {
with(target) {
addLinearLayout {
setOrientationHorizontal()
setPaddingsDP(10, 0)
setBackgroundColorId(R.color.black)
addTextView {
setWidthDP(100)
setLayoutWeight(1f)
setTextSizeSP(16)
setTextColorID(R.color.white)
setFontId(R.font.nunito_bold)
addReceiver(Playground.mode) {
setText(
when (it) {
Play -> "Build Mode"
else -> "Play Mode"
}
)
}
}
addTextView {
setWidthDP(100)
setLayoutWeight(1f)
setGravityCenter()
setTextSizeSP(16)
setTextColorID(R.color.white)
setFontId(R.font.nunito_bold)
setText("V${BuildConfig.VERSION_CODE}")
}
addTextView {
setWidthDP(100)
setLayoutWeight(1f)
setGravityRight()
setTextSizeSP(16)
setTextColorID(R.color.white)
setFontId(R.font.nunito_bold)
addReceiver(Playground.currentBoardIndex) {
setText("Board ${it + 1}")
}
}
}
}

}

eine kleine Person
2

What are you currently playing?

I had to give up on the bubble game. It got where every-time I cleared a lever it automatically went to a screen trying to get me to downland the fookin Royal King game and at first all I had to do was refresh the screen. then it got to having to clear the cookies and finally it got to doing it between each play ....


Tried a few other variations of the bubble game, even the candy match one did it.

Intercourse them, been game free for several weeks, now.

Fatality 2023.

Resurrecting (!) this thread to append more information in the wake of the charges resulting from Mr. Perry’s untimely death. Of the five people charged relative to his ketamine usage, three have now pled guilty (including a doctor) and are awaiting sentencing; the other two appear willing to roll the dice on a jury, where they could essentially receive life sentences if convicted.

All of the five people charged have been sentenced; I believe they all entered plea arrangements whereby they admitted their part in Mr. Perry's death. The most severe sentence is also the most recent; the so-called "Ketamine Queen" who provided the fatal doses. She was sentenced to 15 years, and it turned out that her supply had also killed another person in 2019, which was part of why the sentence was that long. Sad all the way around.

Junk Drawer / Tool Box

I have nothing but respect for my dad. He was a hard working honest guy. Kids just weren't his deal. He was the provider and my mother kept the nest clean and kept us kids in line. Later in life we became business partners and I tried to match his effort and work ethic. I am fairly certain that I received two gifts in my life that he actually wanted me to have and went out of his way to gift them. A pocket knife that I still have and my set of SAE sockets. They mean the world to me. I'm sorry that your sister snagged up the Bell tools. She likely didn't understand the significance of a man to his son relationship.

Is there a 1x1 version of the google microphone widget?

No, you haven't missed anything: the Google widget imposes a minimum width to display the microphone, so in 1x1 or 2x1 resolution it disappears, and there's no setting to keep it there. The simplest solution is to add a direct shortcut to voice search or use Google Assistant, which gives you one-touch access to the microphone without having to use the widget.

Restore Samsung

Since I put No Root Firewall on his phone for him, I wondered if it could be a little too restrictive. I shut it down and lo and behold, porn. I would rather err the other way and keep the thing from being invaded by a bunch of crap apps, mostly overweight games that are probably just spyware, but it's not mine...
it sounds like he blocked it himself by mistake.

you can block certain IPs from connections, and it is global, meaning it blocks for the whole device not just one app.

i used to use it for sites that persistantly sent redirect after redirect.

it worked usually after a while, but the app grows larger with each one.

i now use the firewall included inside Invizible from F-droid.

Shaken bake

I use WaveUp from F-droid.

it uses the proximity sensor to allow the screen to wake by waving my hand over the top of the screen and/or by taking the phone out of its case.

if you have problems with it stopping, you can put a quick setting icon in your quick settings and that seems to keep it active.

pause when skipping videos on Facebook app or skipping by taping on buttons next to pause button

if I watch a video on Facebook and then tap to go foward or behind by 10 seconds if it has this option it automatically plays by itself then I have to tap again to pause the video. I don't want this to happen if i tap on the video it plays automatically and then pauses again when I tap it again anyway to turn these features off

do you understand what I mean

Attachments

  • Screenshot_2026-04-04-10-36-04-315_com.facebook.lite.jpg
    Screenshot_2026-04-04-10-36-04-315_com.facebook.lite.jpg
    174 KB · Views: 29

Brain Fart of the Day

I had trouble with my earbuds while mowing today. They disconnected from my phone two or three times while I was mowing my first lawn. It finally dawned on me that I had forgotten to turn off my truck. When I got near the truck my phone connected to my running truck which broke the connection to my buds. Obviously, I don't wear my hearing aids while mowing. I have to remember to turn the truck off because I can't hear if it's running without my aids.

How do I prevent Gemini from speaking aloud when I ask it a verbal question?

But I don't want to have to type it in. I want to ask it a question, which I do in a very quiet voice up to the microphone even in public and it reads that just fine. I don't then want it to start reading/squawking out the response in the loud intrusive way it does, making me have to poke at buttons to shut it up. I just can't find a simple option to stop it speaking at all.
turn down the volume.

What's your go to junk food snack?

Our new go to snack is celery sticks filled with home made pimento cheese. It was one of those "that looks good" Costco buys that was a hit. We bought a large tub of Palmetto brand Home Style Pimento Cheese with Jalapeno. In no time, we emptied the tub and needed more. Not having a desire to make another Costco run so soon, we resulted in making our own. Sharp cheddar, whipped cream cheese, finely diced jalapenos, a bit of mayo and a bit of garlic salt. I'm not claiming that it's better than the Palmetto brand sold by Costco but it isn't bad, easy to make, and handy. It's great filling for a stick of celery or a spread on crackers.

Considering Changing to Motorola Moto G Power 2025

Since I rely on the S Pen, I need a stylus phone alternative to the Galaxy S Ultra series. Samsung gives us fewer and fewer reasons to upgrade each year while charging more and more. The Moto G Stylus (2025) is highly-rated and regarded: the 2026 version is expected in April or May. It has plenty of stylus features, a headphone jack, a microSD slot and 68W charging. The stylus isn't Bluetooth capable, but the S24 Ultra was the last Galaxy device with that feature so that's a non-issue.

Filter

Back
Top Bottom