Mar 18 | 8:25 AM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Mar 18 | 8:45 AM |
Grigore C. | has entered the room |
Mark M. |
hello, Grigore!
|
Mark M. |
how can I help you today?
|
Grigore C. |
Hello, Mark!
|
Mar 18 | 8:50 AM |
Grigore C. |
I'm having a hard time with navigation and FragmentContainerView
|
Mark M. |
OK, I have used that a bit -- what specifically is not working?
|
Grigore C. |
the response is quite slow.. I press the button and after a delay the fragment is shown
|
Grigore C. |
so I guess it's somehow laggy but I don't really understand why
|
Grigore C. |
layouts are ok from my point of view, no recycler views or anything complicated
|
Mark M. |
I have not encountered this behavior
|
Mark M. |
a handful of examples from *Elements of Android Jetpack* use navigation and FragmentContainerView
|
Mark M. |
as does the app being built in *Exploring Android*, if I recall correctly
|
Grigore C. |
nice, I'll check them out
|
Mark M. |
you might try running those projects and see if you experience similar problems
|
Mark M. |
if you do not, then the issues are more likely tied to the specifics of the fragments that you are using, and you will need to look into more general performance analysis
|
Grigore C. |
I'm also using databinding and hilt
|
Grigore C. |
do you think hilt can be the reason of this? I've used navigation and databinding before and it was ok
|
Mark M. |
I have not used Hilt yet -- I am waiting for a stable release before fussing with it
|
Mark M. |
I would be surprised if Hilt had really bad performance, but it *is* a pre-release version, so there may be bugs
|
Mar 18 | 8:55 AM |
Grigore C. |
the problem is that I don't really know how to inspect and find the reason for this
|
Grigore C. |
I will check out your examples
|
Mark M. |
I am "old school", so I would be littering my code with Log.d() calls and trying to see where in my operations the time is going
|
Grigore C. |
same here :D
|
Grigore C. |
I got another question if you don't mind
|
Mark M. |
go right ahead!
|
Grigore C. |
It's related to a SO question I saw, but I guess there could be a better solution
|
Grigore C. | |
Grigore C. |
this is it
|
Grigore C. |
I want to achieve kind of the same design - an edittext with a clickable right side text
|
Mar 18 | 9:00 AM |
Grigore C. |
I think that the nested elements and a screen with a few input fields could be quite expensive
|
Mark M. |
AFAIK, TextInputEditText does not really support that directly, just for an image
|
Mark M. |
I wouldn't be worried about the performance so much, but figuring out how to prevent the text entry from going behind your clickable text may be tricky
|
Mark M. |
particularly when you take things like font scaling into account
|
Mark M. |
this is one of the things that I am looking forward to with Jetpack Compose: it will be easier to fork existing implementations to handle adjacent scenarios like this
|
Grigore C. |
I ve created a edit text, text view and view as the bottom line
|
Mark M. |
yeah, I did something like that once a few years ago
|
Grigore C. |
and include this multiple times in my screen
|
Grigore C. |
yes, jetpack compose might be our lord and saviour
|
Mark M. |
I wouldn't go *that* far, but it has its beneifts
|
Mark M. |
er, benefits
|
Grigore C. |
I've always disliked the XML layout stuff
|
Grigore C. |
maybe I don't know how to make use of it as I should
|
Mark M. |
your EditText + TextView + View solution could (should?) be wrapped up in a custom View
|
Mark M. |
these are aggravating to create
|
Mark M. |
the biggest benefit of Compose is that creating these things is just part of normal development
|
Mar 18 | 9:05 AM |
Grigore C. |
well, unfortunately I gotta go, but thank you for your help, I'll check out your examples and might come back with a post on the forum if things go wrong
|
Grigore C. |
have a nice day!
|
Mark M. |
sounds good! good luck!
|
Grigore C. |
thank you
|
Mar 18 | 9:10 AM |
trocchietto_Ivano | has entered the room |
Mar 18 | 9:15 AM |
Mark M. |
hello, Ivano!
|
Mark M. |
how can I help you today?
|
trocchietto_Ivano |
Hello Mark!
|
Grigore C. |
Managed to solve it, Mark. I had really big .png files and loaded them as background.
|
trocchietto_Ivano |
I would like to know about your code in the from rxjava to Coroutine some choice you made to better understand programming
|
Mark M. |
Grigore: yeah, that can be slow -- glad you identified the problem!
|
trocchietto_Ivano |
View paste
|
trocchietto_Ivano |
why you use an object inside a sealed class I do not get
|
Mark M. |
I do not need multiple instances of Loading
|
Mark M. |
a single Loading object is sufficient
|
trocchietto_Ivano |
thanks
|
Mark M. |
in some of my examples, you will see that I have Error also as an object -- the only one that consistently is a class is Content, because that almost always has data that changes
|
trocchietto_Ivano |
ah
|
trocchietto_Ivano |
is something like val and var
|
trocchietto_Ivano |
so you try to have more object that is a kind of val
|
trocchietto_Ivano |
because functional programming wants immutability
|
trocchietto_Ivano |
and so is your unidirectional flow
|
Mark M. |
yes
|
trocchietto_Ivano |
ok
|
Mar 18 | 9:20 AM |
trocchietto_Ivano |
I do not get why you use MutableLiveData, are not the same of flows?
|
trocchietto_Ivano |
or BehaviorSubjects
|
Mark M. |
well, the specific tutorial is moving away from RxJava, so I would not want to use a Subject
|
trocchietto_Ivano |
as you are implementing flow do you use LiveData because you insure a good lifecycle
|
Mark M. |
I could switch that to StateFlow -- I wrote those tutorials long before StateFlow existed
|
trocchietto_Ivano |
ah I got it
|
Mark M. |
I will look to move them to StateFlow in some future book update
|
trocchietto_Ivano |
but I do not get if LiveData should be considered deprecated or is a good practice to use to insure a smooth lifecycle
|
Mar 18 | 9:25 AM |
Mark M. |
there is nothing wrong with LiveData, and if you have a mixed Java/Kotlin project it is probably better to use LiveData
|
Mark M. |
conversely, if your long-term objective is to use Kotlin/Multiplatform, you might want to remove LiveData, as it is very Android-centric
|
trocchietto_Ivano |
I always say to my senior to use as an Holder with viewModels and Lifecycle
|
trocchietto_Ivano |
and kotlin multiplatform is going to use only Flow and Coroutines
|
trocchietto_Ivano |
?
|
Mark M. |
Kotlin/Multiplatform will steer you more towards things that are pure Kotlin and have fewer Android hooks
|
Mark M. |
it will be simpler, I expect, to use flows instead of LiveData in a Kotlin/Mutiplatform project
|
Mark M. |
and it may give you more opportunities for sharing code between platforms, as LiveData is Android-only
|
trocchietto_Ivano |
Mark these bullet points replies are invaluable for my growth thanks, if you do not mind expect more in the future
|
Mark M. |
that's what these chats are for! :-)
|
trocchietto_Ivano |
thank you
|
trocchietto_Ivano |
I will squeeze you as a lemon
|
trocchietto_Ivano |
I go to a meeting
|
trocchietto_Ivano |
thank you again
|
Mark M. |
you're welcome!
|
trocchietto_Ivano |
bye Grigore
|
Kai H. | has entered the room |
Mark M. |
hello, Kai!
|
Mark M. |
you have about 60 seconds -- got a really quick question? :-)
|
Mar 18 | 9:30 AM |
Grigore C. | has left the room |
Kai H. |
lol. Not for that time X)
|
Kai H. |
Thought it would start now.
|
Kai H. |
Ah well. Cu soon.
|
Mark M. |
sorry -- perhaps next time!
|
Mark M. |
note: I am on Eastern Daylight Time for the next six months (UTC−04:00)
|
Mark M. |
the next chat is Saturday at 4pm EDT
|
Mark M. |
have a pleasant day!
|
trocchietto_Ivano | has left the room |
Kai H. | has left the room |
Mark M. | turned off guest access |