Gabor Varadi Profile Banner
Gabor Varadi Profile
Gabor Varadi

@Zhuinden

17,388
Followers
351
Following
988
Media
10,692
Statuses

Android dev ~10+ yrs. EpicPandaForce @ SO. An organizer of Android Budapest. Mod in /r/android_devs. DM interesting questions.

Joined March 2013
Don't wanna be here? Send us removal request.
Pinned Tweet
@Zhuinden
Gabor Varadi
3 years
My talk called "Simplified Android Development using Simple-Stack" about single-activity applications at @androidww_ is now finally available! ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰ You can watch it on YouTube using the following link:
@Zhuinden
Gabor Varadi
3 years
Thank you so much @androidww_ for having me, I hope the talk on Simple-Stack (and other navigation approaches) was informative as intended :) The slides are available here:
0
6
30
6
21
180
@Zhuinden
Gabor Varadi
2 years
I'm excited to see the END of backing properties in Kotlin with Kotlin 1.7.0 once and for all. Never liked backing properties and the _prefix. Always went out of my way to avoid the _. Finally, a new language feature will eliminate any/all need for them. Good news for Kotlin.
Tweet media one
@GakisStylianos
Stylianos Gakis
2 years
`Support having a "public" and a "private" type for the same property` marked as "fixed" here ๐Ÿ‘€ Excited to be able to use this soon
Tweet media one
0
11
113
20
163
770
@Zhuinden
Gabor Varadi
2 years
"Screaming architecture" is when you look at the package structure of a project, and it makes you want to scream, right? ๐Ÿ˜ฑ๐Ÿค”
Tweet media one
58
88
674
@Zhuinden
Gabor Varadi
2 years
The time has come, onBackPressed is deprecated #androiddev
Tweet media one
39
82
515
@Zhuinden
Gabor Varadi
2 years
Tweet media one
14
62
443
@Zhuinden
Gabor Varadi
2 years
(!!!) People who use Navigation-Compose in Jetpack Compose should be aware of this: If you use Navigation-Compose, you need to pass NavHostController to your composable, instead of creating it as default argument. If you use it as default argument, state restoration won't work.
Tweet media one
19
48
332
@Zhuinden
Gabor Varadi
2 years
What people call "clean architecture" on Android is merely a fashion trend. There's a new one every 3 years.
Tweet media one
23
52
309
@Zhuinden
Gabor Varadi
4 months
Make sure you get that Flow from a UseCase that talks to a Repository that talks to a Service that talks to a Datasource that talks to a Dao that talks to a Database that talks to a mental health professional This is TDD (Therapy-Driven Development) #tdd #cleanarch #mandroiddev
27
51
314
@Zhuinden
Gabor Varadi
2 years
the main difference between MVVM and MVI explained #androiddev
Tweet media one
9
28
312
@Zhuinden
Gabor Varadi
2 years
Concepts you need to know and understand in order to work effectively with Jetpack Compose - launched/disposable/side effects - composition/recomposition - key {}, remember(key), rememberSaveable - modifiers (Draw/Layout/ParentDataModifier) - CompositionLocal - stable/immutable
11
48
302
@Zhuinden
Gabor Varadi
9 months
My experience with updating to Jetpack Compose 1.5.0 stable release - AGP 7.4.2 is not supported, you need AGP 8.1 - AGP 8.1 is not supported by Flamingo, use AS Giraffe - Compose 1.5.0 needs compileSdk 34 Then you use Kotlin 1.9.0 + Compose Compiler 1.5.1, now it seems to work
32
36
296
@Zhuinden
Gabor Varadi
1 year
Google Associate Android Developers are now officially deprecated ๐Ÿ˜…
Tweet media one
15
39
230
@Zhuinden
Gabor Varadi
2 months
When you create DataSource Dao Repository UseCase Helper to "ensure consistency across all data access and implement clean architecture", just to write a string in shared pref
@eloffd
Eloff
2 months
Thatโ€™s how it feels to write boilerplate code
8
11
63
14
41
229
@Zhuinden
Gabor Varadi
1 year
Did you know? Square/Retrofit, the popular REST API client you use in #androiddev today, used to have a Shake Detector.
Tweet media one
19
21
229
@Zhuinden
Gabor Varadi
2 years
#SOLID principles in a nutshell ๐Ÿ˜…
Tweet media one
7
41
222
@Zhuinden
Gabor Varadi
4 years
Those who use Fragments along with either Jetpack Navigation or Simple-Stack will understand. #AndroidDev
Tweet media one
8
23
211
@Zhuinden
Gabor Varadi
2 years
Not sure who still needs to hear this, but the following Github link is the latest edition of the official Android Clean Architecture repository, as described by the Android Clean Architecture article series Check it for reference on Clean Architecture
Tweet media one
9
43
208
@Zhuinden
Gabor Varadi
4 years
I am happy to see that there is a new Google Codelabs that shows how to simulate process death (low memory condition) in your application ๐Ÿคฉ
6
40
202
@Zhuinden
Gabor Varadi
2 years
Some Android devs: "multi-activity apps work perfectly well, there is no reason to ever use single-activity" Multi-activity apps:
24
15
195
@Zhuinden
Gabor Varadi
3 years
I've published an article on some tips that can make Kotlin code easier to read/understand, and minimize the usage of some potentially cryptic and/or unnecessary and/or less trustworthy constructs (e.g avoiding `?.let {} ?: run {}` as general control flow)
5
35
198
@Zhuinden
Gabor Varadi
2 years
The walls of the "MVI maze" represent - unexpected race conditions - non-cancellable obsolete in-flight requests - state restoration bugs due to saving data and transient state along with the actual state - modelling synchronous function calls with classes - "reducer" complexity
Tweet media one
8
17
196
@Zhuinden
Gabor Varadi
2 years
clean architecture
20
24
192
@Zhuinden
Gabor Varadi
2 years
I don't know why, but this code-snippet is just fascinating to me I feel like it's an accurate representation of Android development in a nutshell
Tweet media one
15
7
175
@Zhuinden
Gabor Varadi
2 years
@davefarley77 This bug only happens sometimes
1
1
175
@Zhuinden
Gabor Varadi
2 years
- Our code needs separation of concerns + We've got separation of concerns at home Separation of concerns at home:
Tweet media one
26
26
174
@Zhuinden
Gabor Varadi
4 years
If you use LiveData +Kotlin, then it's time to STOP writing `, Observer {})`. Use trailing lambdas. Add this import from lifecycle-ktx and you should be good: `import androidx.lifecycle.observe` .observe(viewLifecycleOwner) { adapter.submitList(it) }
14
24
173
@Zhuinden
Gabor Varadi
4 months
Android development is mostly frontend, so with the advent of Compose + "MVI" + Hilt + AndroidX-Navigation i feel this is true #androiddev #mandroiddev
Tweet media one
11
17
175
@Zhuinden
Gabor Varadi
3 years
I've released a new article on Medium! "Structural and navigation anti-patterns in multi-module and modularized applications: the case against โ€œAndroid Clean Architectureโ€ and the โ€œdomainโ€ module". TL;DR: "Android Clean Architecture" is an anti-pattern.
11
27
172
@Zhuinden
Gabor Varadi
10 months
Tweet media one
15
14
163
@Zhuinden
Gabor Varadi
2 years
Compose development experience
Tweet media one
15
8
158
@Zhuinden
Gabor Varadi
3 years
If anyone is curious, I wrote a long post on Reddit on why I don't like MVP or MVI (and why MVVM is generally preferable in pretty much all cases)
7
23
159
@Zhuinden
Gabor Varadi
1 year
Jetpack Compose layout that can measure the size of its children From:
Tweet media one
5
18
160
@Zhuinden
Gabor Varadi
1 year
Article by @IceRockDev on how to avoid unnecessary recompositions and laggy UI when using Jetpack Compose #androiddev Examples: 1.) remember {{ }} lambdas 2.) avoiding ConstraintLayout (it's slower than Row/Column, same as XML) 3.) Argument type stability
3
41
157
@Zhuinden
Gabor Varadi
2 years
This is a question to #androiddev s๐Ÿ˜‰ โ—๏ธ Assuming I were to write a book about Android dev, what is it that you'd feel excited to read about? I'm thinking view-based UI development, lifecycle management, state management, fragments/child fragments, etc. but what about you? ๐Ÿค”
75
7
157
@Zhuinden
Gabor Varadi
2 years
I must say I'm a bit rusty when it comes to writing articles, but it's finally out "Reclaim the reactivity of your state management, say no to imperative MVI" Will this be the final blow to `_state.value = _state.value.copy()`? Only time will tell ๐Ÿ˜…
11
22
157
@Zhuinden
Gabor Varadi
2 years
Today's Android development fact - If you don't know about DisposableEffect(key) {} and key(key) {} in Jetpack Compose (despite using Jetpack Compose) Then you should probably learn a bit more about Jetpack Compose first, as you won't be able to write code that works correctly
5
17
151
@Zhuinden
Gabor Varadi
2 years
basically Dagger, Hilt, Koin and Kodein fighting while most apps are using static singletons
@aschmelyun
Andrew Schmelyun
2 years
The JS ecosystem
Tweet media one
117
2K
11K
2
8
154
@Zhuinden
Gabor Varadi
3 years
My favorite error message is Execution failed for task ':project:kaptDebugKotlin'. > A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution > java.lang.reflect.InvocationTargetException (no error message)
14
6
148
@Zhuinden
Gabor Varadi
2 years
@LouMorda @t3dotgg I like the idea of replacing "git push" and "git pull", with "git yeet" and "git yoink" respectively
4
19
140
@Zhuinden
Gabor Varadi
4 years
I've published 'Dagger Magic Tricks: leveraging AssistedInjection to inject ViewModels with SavedStateHandle, and Map-Multibinding to inject Workers in WorkManager using WorkerFactory'. Get it while it's hot! And when it's cold. Should be nice either way.
4
23
149
@Zhuinden
Gabor Varadi
3 years
After Android 12+ in the root, onDestroy() will never be called, as finish() will never be called. This also means that Activity-scoped ViewModels will never get onCleared() callback The only reliable callbacks for managing state is onStart/onStop (oddly just like LiveData does)
@TatoKutalia
Merab Tato Kutalia ๐Ÿ‡ฌ๐Ÿ‡ช - Glory to Ukraine ๐Ÿ‡บ๐Ÿ‡ฆ
3 years
Did you know Android 12 changed that ROOT LAUNCHER activities are no longer finished on the Back press? #AndroidDev #Android12
Tweet media one
Tweet media two
2
70
215
11
37
147
@Zhuinden
Gabor Varadi
6 months
Big news #androiddev ! The team working on Hilt has added support for passing custom CreationExtras to a ViewModel using Assisted Injection. I wasn't really keeping my hopes up, so I'm really happy with this addition to Hilt, now that it is supported.
7
16
140
@Zhuinden
Gabor Varadi
2 years
I didn't know you can do this ๐Ÿค”
@qwert2603
Alexander Zhdanov
2 years
Here is how extension function with 2 receivers may be created in #Kotlin 1.6.0 while Context receivers are being prototyped.
Tweet media one
5
39
255
5
12
141
@Zhuinden
Gabor Varadi
1 year
I'm happy to report that I can finally stop complaining about the way SavedStateHandle is used in Now-In-Android. Previously, SavedStateHandle was only used to pass arguments to the ViewModel. 2 weeks ago, a new "Search" feature was added, which uses
2
11
138
@Zhuinden
Gabor Varadi
2 years
Developers: "don't add comments to code that do nothing but do the exact same thing as the function is doing" Also developers:
Tweet media one
13
15
127
@Zhuinden
Gabor Varadi
1 year
To be honest, I found this funny about Dagger/Hilt (and KAPT-based DI frameworks in general) ๐Ÿ˜…
Tweet media one
8
8
138
@Zhuinden
Gabor Varadi
2 years
Android 13 introduces a new runtime permission for posting notifications called POST_NOTIFICATIONS.
12
25
131
@Zhuinden
Gabor Varadi
3 years
It appears @VasiliyZukanov was right about `for` loops in Kotlin. Not even Google is exempt from mixing up `..` with `until` ๐Ÿ˜‚
Tweet media one
8
14
136
@Zhuinden
Gabor Varadi
2 years
it's happening ๐Ÿฅณ
Tweet media one
7
6
133
@Zhuinden
Gabor Varadi
1 year
Time for the 2023 "Good things about Android development" challenge this Monday #androiddev ๐Ÿ˜‰ I really like: how easy it is to position Views in XML layouts with minimal effort using FrameLayout layout_gravity, LinearLayout weight, previews, and being able to define margins. ๐Ÿ‘
Tweet media one
Tweet media two
@mitch_tabian
Mitch Tabian
1 year
@Zhuinden your 2023 challenge: Say something positive about android development once a week.
21
4
118
15
9
130
@Zhuinden
Gabor Varadi
1 year
Apparently, the release of Jetpack Compose has brought us multiple new navigation frameworks to replace Navigation-Compose. Bumble-Tech wrote Appyx, while Slack wrote Circuit. It seems there will be a talk here on YouTube in a few moments about Circuit.
5
9
133
@Zhuinden
Gabor Varadi
2 years
Android 13 docs on the new Photo Picker API using startActivityForResult/onActivityResult instead of implementing custom ActivityResultContract I guess the docs author of realized that ResultContracts are much trickier than the "deprecated" system APIs ๐Ÿ˜‚
9
5
130
@Zhuinden
Gabor Varadi
20 days
Adding @ Inject annotation on every single class constructor
@KevinNaughtonJr
Kevin Naughton Jr.
21 days
software engineers adding JavaScript to everything
141
2K
21K
4
14
133
@Zhuinden
Gabor Varadi
4 years
Insightful comment by @jakewharton : `Nullable APIs lead to people doing foo?.bar and wonder why the app silently gets into weird states. It's because they probably wanted foo!!.bar but someone shamed them for !! and requireFoo() was "too much boilerplate"`
7
19
131
@Zhuinden
Gabor Varadi
3 years
What an interesting article on how using StateFlows from ViewModels can actually result in trickier code with more edge-cases than using LiveData (even including the liveData { coroutine builder)๐Ÿค”
11
38
128
@Zhuinden
Gabor Varadi
2 years
I made a promise that I'll make an article on Reactive MVI (which is better than the MVI you're used to Most likely not tomorrow, but likely the day after that ๐Ÿ˜
7
3
128
@Zhuinden
Gabor Varadi
3 years
Pro-tip: Don't name packages "activities" and "fragments" and "viewmodels".
Tweet media one
12
17
128
@Zhuinden
Gabor Varadi
2 years
I'm still hearing people claim that "just put your state into a ViewModel, and it will survive the Android lifecycle" but in reality that doesn't handle process death unless you also use SavedStateHandle I had a talk on this April 6th 2021 still relevant
6
15
126
@Zhuinden
Gabor Varadi
2 years
Sometimes I wonder why we need 8+ classes to do what web developers can do with a single line of code ๐Ÿค” $.get("URL").then((result) -> {}).catch((err) -> {}) The equivalent on Android would be as simple as viewModelScope.launch { api.getUrl().fold(onSuccess={}, onError={}) }
Tweet media one
14
14
125
@Zhuinden
Gabor Varadi
3 years
Stuck with Dagger-Android? Fret not, I've written an article on how Dagger-Android works, what it solves, and how to structure Dagger Modules for better scalability. TL;DR: do not have an ActivityBuildersModule, FragmentBuildersModule or ViewModelModule.
1
20
124
@Zhuinden
Gabor Varadi
2 years
@donnfelker 8 updates later & 7 hours later: app finally compiles but crashes on launch
3
1
121
@Zhuinden
Gabor Varadi
3 years
@VasiliyZukanov I don't think this is true, ViewBinding is pragmatically a safer alternative to findViewById. Jake Wharton created ViewBinding while he worked at Google to save us from Databinding and KAPT - giving us type-safety and null-safety at IDE time (instead of compilation time). ๐Ÿ™
8
4
123
@Zhuinden
Gabor Varadi
2 years
Why I don't like the typical data-domain-presentation split, having "both repositories and usecases", clean architecture (as it is generally done on Android) and mvi TL;DR clean architecture is a code fashion trend where people copy code and hope for the best, nothing more. \/
Tweet media one
13
21
121
@Zhuinden
Gabor Varadi
1 year
Google says they created Compose/Jetpack samples that are meant to show "best practices", But then where is `savedStateHandle.saveable { mutableStateOf() }`?
Tweet media one
9
7
120
@Zhuinden
Gabor Varadi
2 years
According to this post on Reddit, using Jetpack Compose, it is extremely likely that if you are using the `val (value, setValue) = remember { mutableStateOf(..) }` way to declare a mutable state, then you are also introducing bugs that are hard to debug.
Tweet media one
6
12
117
@Zhuinden
Gabor Varadi
3 months
I feel like this Compose trick should be out of the box ๐Ÿค” #jetpackcompose #androiddev
Tweet media one
4
12
120
@Zhuinden
Gabor Varadi
2 years
I hope this will finally solve my Jetpack Compose recomposition problems ๐Ÿค”
Tweet media one
13
13
115
@Zhuinden
Gabor Varadi
4 years
So I found this guide (on creating custom views using onDraw, and even how to define custom states for views that can be used from inside drawable selector). This is something that's been missing for a very long time.
1
22
115
@Zhuinden
Gabor Varadi
2 years
thanks android studio
Tweet media one
9
1
112
@Zhuinden
Gabor Varadi
3 years
I'm so happy to see the Kotlin 1.4.30 release! Not only does it come with sealed interfaces, but it also fixes some performance problems you could run into with type inference. I expect this to greatly increase IDE responsivity! Update your IDE plugin ๐Ÿ”ฅ
5
17
113
@Zhuinden
Gabor Varadi
4 years
MFW: getting a YouTube ad, selling a course that promises to teach idiomatic Kotlin, and they show you the code (yes, the code is from the ad)
Tweet media one
7
7
109
@Zhuinden
Gabor Varadi
2 years
Google adds that passing the ViewModel to the RecyclerView is not good practice because it's tight couling between the adapter and the ViewModel But then why do they pass a ViewModel to a Composable? ๐Ÿค”
Tweet media one
14
12
110
@Zhuinden
Gabor Varadi
2 years
"CommonsWare published a series of books on Android application development. All are available now under the Creative Commons BY-SA 4.0 License. All are available for free download as PDF, EPUB, or MOBI/Kindle editions, and some are available to read right from your Web browser."
@commonsware
CommonsWare
2 years
New CommonsBlog post: "Final Books, Free for Everyone"
18
65
209
4
25
111
@Zhuinden
Gabor Varadi
2 years
Android UI development goalpost-moving in a nutshell: - "Android UI dev is slow" + "Just use Compose bro" - "I'm already using Compose, still slow" + "Just git gud bro" - "That won't help 3-minute preview rendering" + "Just buy a MacBook Pro M1 bro" - "Actually it doesn't help"
Tweet media one
18
13
109
@Zhuinden
Gabor Varadi
2 years
implementation "androidx.compose.ui:ui-util:$compose_version" You should be using `fastForEach` on your Lists (and `fastMap`, `fastAll`, `fastAny`, `fastForEachIndexed`, `fastSumBy`, etc) inside Composable functions
9
15
110
@Zhuinden
Gabor Varadi
2 years
I sure do scream each time I see 1.) top-level "domain" module 2.) UseCases that do nothing but delegate to a "Repository" that does nothing but call 1 suspend fun and that's it 3.) "Repository" interfaces in the "domain" module (if you have them, it's the public API of "data")
Tweet media one
13
26
110
@Zhuinden
Gabor Varadi
11 months
Google Maps Compose Integration development is inactive since March 30th 2023, while there are plenty critical bugs and crash issues opened. Priorities on issues are no longer set, all issues after April are marked "triage me". Is Google support dropped?
10
15
110
@Zhuinden
Gabor Varadi
4 years
Hey all, good news! I can finally post and comment on /r/androiddev again. ๐Ÿฅฐ
11
1
110
@Zhuinden
Gabor Varadi
1 year
Must watch talk from Hadi Hariri and Kevlin Henney on: - overengineering for the sake of adding complexity and not because it's needed ("clean arch") - copypasting "solutions" that solve no real problems - making software development seem more difficult
Tweet media one
Tweet media two
2
14
105
@Zhuinden
Gabor Varadi
3 months
"Why do so many large tech companies have awful apps, and many indie apps are great?" #androiddev
18
16
110
@Zhuinden
Gabor Varadi
1 year
I can't believe I forgot about the "shotgun surgery" code smell, when I was talking about the "Android clean arch" that makes you put 1 responsibility in 5 classes and 3 "layers" in 3 modules, And each time you need to make an edit, you have to edit every single one of them ๐Ÿ˜…
Tweet media one
6
9
109
@Zhuinden
Gabor Varadi
4 years
Interesting news, apparently now you can contribute to Room and WorkManager through Github, rather than only through the AOSP. In fact, there seems to be a whole new Github mirror to AndroidX Jetpack. Now you can browse the Jetpack source code on Github.
2
14
109
@Zhuinden
Gabor Varadi
2 years
Thanks to Android Studio Electric Eel, it's possible to find out that by following everyday samples, Jetpack Compose will end up in "recomposition hell" & poor performance. To optimize for runtime performance, either pass function references, or remembering callbacks is needed.
Tweet media one
Tweet media two
7
11
108
@Zhuinden
Gabor Varadi
2 years
I feel like we should appreciate `associateBy`, which allows you to easily transform an iterable (list, set, etc) into a Map, using a given property as a key to map against another prop One of the nicest features of Kotlin really is the built-in collection extension functions ๐Ÿ‘€
Tweet media one
5
10
107
@Zhuinden
Gabor Varadi
1 year
don't create "modules per layer" #androiddev
Tweet media one
9
13
104
@Zhuinden
Gabor Varadi
11 months
You should be able to pass a ViewModel to another ViewModel as a constructor argument. #androiddev
33
6
104
@Zhuinden
Gabor Varadi
2 years
Compose compiler metrics allow you to determine how many composable functions are restartable or skippable, depending on how many of its arguments are marked stable or immutable
2
19
103
@Zhuinden
Gabor Varadi
4 years
Here's a good comment by Jake Wharton on why you should beware Mockito taking up too much responsibility, and accidentally hardcoding implementation details in unit tests. Or quoting his words, "Mockito is test cancer. Avoid."
7
32
101
@Zhuinden
Gabor Varadi
4 years
Tweet media one
7
9
100
@Zhuinden
Gabor Varadi
3 years
I've been hearing complaints such as "LiveData is bound to the UI thread, so you should never use it in a Repository, because your mapping is always on the UI thread". To counter this myth, here is today's extension function. (Snippet with @carbon_app )
Tweet media one
11
9
101
@Zhuinden
Gabor Varadi
2 years
Compose
Tweet media one
@github_skydoves
Jaewoong Eum
2 years
The 2022 Android Developer Roadmap supports 11 different world languages in README! ๐ŸŒ English, Korean, Arabic, German, Spanish, Turkish, Bahasa Indonesia, French, Portuguese, Khmer, and Vietnamese. Anyone can contribute to support your languages.
0
31
112
3
20
99
@Zhuinden
Gabor Varadi
2 years
If you're planning to create a fully Compose app, consider looking at Appyx instead of Navigation-Compose. I hear it already supports complex screen transitions, not just hard-coded Crossfade ๐Ÿ˜
@SamuelPSarm
Samuel Perez
2 years
Take a look to this amazing article about Appyx that my college @andreyk_nn wrote for @BumbleEng
1
14
45
8
11
99
@Zhuinden
Gabor Varadi
1 year
Jetpack Compose source code that demonstrates how to manage TextFieldValue in case you need to customize TextField selections.
Tweet media one
2
12
99
@Zhuinden
Gabor Varadi
1 year
Who's excited for the new Simple-Stack 2.7.0 update? ๐Ÿ˜ #androiddev After a few days of coding, predictive back support (Android 14, targetSdk 34, android:enableBackInvokedCallback) is finally coming ๐Ÿ˜‰ Migration path is provided from onBackPressed/HandlesBack, of course.
Tweet media one
5
11
99
@Zhuinden
Gabor Varadi
2 years
Using the new `bundle.getParcelable` released in Android T that takes a "Class" parameter is actually bugged, and you should NOT use it, as it crashes at runtime. The fix will not be available in Android 13, therefore this will always remain a trap.
Tweet media one
10
14
98
@Zhuinden
Gabor Varadi
2 years
I updated my Fragment + Compose sample to align with recomposition best practices for optimal performance: - screen layout composable is a top-level composable function, instead of a function of Fragment instance - all input arguments are passed as State
4
11
97
@Zhuinden
Gabor Varadi
3 years
you are welcome ๐Ÿ˜‰
Tweet media one
5
3
98