• 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

Any Time is Grillin Time

I owned a propane grill that wasn't good in the cold. It was the old style with a H burner of stamped metal that was covered in lava rock. It was a cheap 70s cooker. They have evolved a great deal since then. My father enjoyed grilling and was an early adopter of a natural gas grill. I'm guessing middle sixties or a bit earlier model. It was made of such heavy metal that you could cook on it long after the gas was turned off. :) It was old school enough that it had adjustable vents for air flow. The best part about that natural gas grill was we no longer had to eat his cooking over charcoals. He soaked his briquettes in gas. :) I can still see him tossing matches at the ol' charcoaler. Everything we at tasted like a 50's Studebaker :)
While I'm at it, I'll bore you with another story about that cooker. My parents were working out of town and I came home from college and invited my girlfriend over for the weekend. I cooked out burgers or steaks or something on that grill. The method was to turn it up all the way and let it burn off the left over fats when done cooking. I came home the next weekend and asked my sweetie to once again enjoy the weekend at my parents house. I went out to light the grill and found I had left it on high for a week. Needless to say... the fats had been burned off :)

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.

Samsung Galaxy

While Samsung is dumbing down the S Pen, Motorola is improving the stylus in the Moto G Stylus 2026... available April 16th in the U.S. At a third the price of the S26 Ultra, it has faster charging; a brighter screen; and, while it may have a slower processor (which won't matter for 98% of users anyway), it will sport a microSD slot capable of up to 1 TB external storage. How long has it been since a Galaxy flagship had that???

Favorite Coffee

I wouldn't have a problem watering my (unbleached) paper filters before filling the pods with freshly-ground coffee, but I prepare over a dozen pods at a time as a weekly task. I'm concerned about the coffee, and paper, sitting wet for that long. If I was preparing each pod right before brewing, then sure I'd wet the filters first: but we're talking about a Navy Chief waking up at 4:30 in the morning. All I want to do it get my heart started without going all coffee-snob to do it...
Yeah, that would be a pain. You'd have to let them fully dry before loading up the coffee. Even overnight a damp filter would ruin the coffee.

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: 23

Filter

Back
Top Bottom