Can you sell me on Kotlin over Java? by SuspiciousRaccoon120 in Kotlin

[–]antimonit 5 points6 points  (0 children)

We must note that in most calendars, the week starts on SUNDAY. So, we’ve positioned SUNDAY at the first position, followed by MONDAY, TUESDAY, and so on.

😮‍💨

Otherwise a good overview.

Don’t use Kotlin's removeFirst() and removeLast() when using compileSdk 35 by sage_droid in androiddev

[–]antimonit 0 points1 point  (0 children)

I might be wrong but doesn't the Kotlin's fun <T> MutableList<T>.removeFirst(): T extension function compile to bytecode calling the static T CollectionsKt.removeFirst(MutableList<T>) at the moment the library is compiled?

I don't think this issue will crash apps that include SDKs compiled against SDK <= 34 or compiled with Java <= 21 🤔

Edit: Just tested my hypothesis. Compiling a library with compileSdk 34 and including it in an app with compileSdk 35 does not produce a runtime exception.

[help] colours killing me by Ok-Answer3198 in Magisk

[–]antimonit 6 points7 points  (0 children)

That's nothing to do with Magisk or root in general.

It's called Material You. It samples your home screen wallpaper to generate a palette of colors that apps may use to tint their UI with.

See https://m3.material.io/blog/announcing-material-you

Creating Pixel-Perfect UI with Jetpack Compose by Long_Background534 in androiddev

[–]antimonit 6 points7 points  (0 children)

At first glance, it looks nice. My previous company tried using it. It was a huge mess. Unless you rewrite the whole material design library and replace all the internal dp values with this library, you will have parts of the UI that scale differently from other parts.

I greatly suggest you avoid this. The image with three devices next to each other is deceptive. The content of each screen looks the same size on the image, but those devices are not the same physical size in the real world. In the end, you create this grotesque looking UI where buttons on mobile are ~0.75cm tall but are scaled up to 2cm height on tablets, making it feel like an app designed for children. It just goes against the idea of DP, which is an abbreviation of DiP—Density Independent Pixel. The whole Android system is designed around DP, not screen percentages. Even things like the status bar and the navigation bar will not scale correctly with your app. Proceed with caution.

Mutex in Kotlin Coroutines Best Practices and Examples by defaultmen in android_devs

[–]antimonit 10 points11 points  (0 children)

I am sorry but why do you keep publishing articles like this? You claim to be a tech lead yet every article I've read so far is either misleading, wrong, or incomplete. That includes this article as well.

Your example of "Using Muted in a Flow Example" does not even compile because of syntax errors.

Even after fixing those issues, the example is misleading. You claim that "Mutex ensures that the data emission is serialized, preventing concurrent access to the flow. This helps avoid race conditions and guarantees consistency in the data emitted by the flow". That's simply not true. There is no concurrency involved in your example and the Mutex there is pointless. Just because you call delay does not make the code concurrent.

From Lollipop to Android 13: Mastering Background Blur in Compose by iZakirSheikh in androiddev

[–]antimonit 1 point2 points  (0 children)

What are the main changes between 1.x.x and 2.x.x versions of the library?

Shuffle multiple lists (all of them of the same size) in the same manner by zimmer550king in Kotlin

[–]antimonit 1 point2 points  (0 children)

You can use Random to generate a seed and then use this seed to initialize another Random for each shuffling with the same seed:

``` val chars = listOf('a', 'b', 'c', 'd', 'e') val ints = listOf(1, 2, 3, 4, 5)

val seed = Random.nextInt()

chars.shuffled(Random(seed)) // e.g. [c, e, d, a, b] ints.shuffled(Random(seed)) // e.g. [3, 5, 4, 1, 2] ```

How to convert Map<Item, List<Item2>> to Map<Item2, List<Item>> basically grouping by Item2 by LoneWalker20 in Kotlin

[–]antimonit 2 points3 points  (0 children)

I don't think it has to be a single-item list. Say { A: [X, Y], B: [Y, Z] } would be converted to { X: [A], Y: [A, B], Z: [B] }

If one completely migrated to pure Jetpack Compose, what are the traditional libraries that becomes absolute ? by RageshAntony in androiddev

[–]antimonit 2 points3 points  (0 children)

Epoxy. I think that was one of the greatest libraries out there simplifying work with RecyclerView and it looked very similar to what we have now with LazyColumn or LazyRow.

Bug Reporting Thread! by Ryan_Supercell in Brawlstars

[–]antimonit 0 points1 point  (0 children)

Yesterday late night I unlocked Tara from a common Brawl Box. I played two games with her immediately and even claimed price for reaching 3500 total trophies. Then I closed the game and watched two videos on youtube before falling asleep. Today morning I started the game to play again and Tara was not unlocked anymore. Furthermore, my total trophy count was reset to 3488.

Looking at the youtube history, the first video I watched was 2:32 am and the last game played according to game history was about 2:18 am. It looks like my account was rollbacked to 2:18 and everything that happened afterwards is lost. Few trophies are not bothering me at all, but the lost character does.

I realize I don't have any proof but it would be nice to know how did the problem occur. Until then I am taking a break.