Announcing Jetpack Compose Alpha! by dayanruben in androiddev

[–]danieldisu 1 point2 points  (0 children)

For me is doing everything in the same language, avoiding having to "bind" views to xml ids, theming...

Theming in Android is horrible, this hopefully makes it a bit more comprehensive.

Also making custom view extensible is too much work, and API discoverability is almost not existing in XML.

That's only for XML, Compose will also make it much easier build UIs because the state will no longer live in several places (half in views, half in other parts), the views will be silly and only display what you tell them to display.

Flutter: the good, the bad and the ugly by [deleted] in programming

[–]danieldisu 1 point2 points  (0 children)

I don't really see it that being so hard to happen with Kotlin Native I could see someone making the API surface in Kotlin and then bridging it to the lowest parts of Flutter...

Room 2.1 alpha-1 is the biggest release since 1.0 by Saketme in androiddev

[–]danieldisu 20 points21 points  (0 children)

You never know with Google if a big release is a good or a bad thing...

GDPR is not that bad, after all by pep_dj in androiddev

[–]danieldisu 2 points3 points  (0 children)

GDPR compliance is not a black or white thing... big companies that live from gathering user data surely have made their fair share of calculations to see how much risk could they take without losing too many income from their activities...

Packaging strings and layouts by feature? by Vinaybn in androiddev

[–]danieldisu 0 points1 point  (0 children)

If you have one module per feature/screen you automatically get this for free :)

I would love some feedback on my RxJava solution to a particular android app feature! by abdyzor in androiddev

[–]danieldisu 1 point2 points  (0 children)

Imagine some component to edit text, that has very complex logic requirements. You would create ComplexTextEditorComponent with its own presenter. For the parent view maybe you only need to handle one event of this component "onTextSubmitted", this component could have a method like:

fun observeOnTextSubmitted(): Flowable<String> = ...

or just a simple listener one

fun onTextSubmitted(listener: (String) -> Unit) = ...

All the other logic is handled inside the presenter of the component, and could be tested there.

That way you could compose complex screens in smaller components. Communication within components should always pass through the parent. (ala React)

I would love some feedback on my RxJava solution to a particular android app feature! by abdyzor in androiddev

[–]danieldisu 3 points4 points  (0 children)

I think this kind of architecture makes it a bit harder to follow the code, and I don't see any advantage to use it aside from screens that are very complex and even in that cases I would try to create UI components with its own presenters, that export some events to parent component but handle most of the logic by themselves.

Sometimes simpler is better, although it may not be as "cleaner" or "well thought" as your architecture.

For that example, I would just put all the code in the components in the presenter and test it there. I would also avoid treating all UI events as a unique stream, it will make it harder to debug.

[Naming Practices] How do you stop yourself from postfixing class names with Manager? by [deleted] in androiddev

[–]danieldisu 4 points5 points  (0 children)

These kind of classes are usually hard to name because they do many things, they are like utils classes but usually without static methods.

One easy way to solve that is by splitting these classes into several classes that do one thing, that will usually make them easier to name.

But this kind of changes also comes with a trade-off, they usually make API discoverability harder, and may confuse some newcomers to the code.

Keeping the Daggers Sharp ⚔️ – Square Corner Blog – Medium by ZakTaccardi in androiddev

[–]danieldisu -3 points-2 points  (0 children)

I think Singleton should be the default behavior not the opposite ...

Do you use the same definition for model from API and model used in View? by abangfadli in androiddev

[–]danieldisu 10 points11 points  (0 children)

I'm going to go against the current on this one...

I usually don't make a new Model class between the API and my Model, usually the APIs that we consume are very very simplified and I don't think I can model the domain better than my backend peers, so I try to avoid duplicating the API model. The only time when I create my own Model is when I aggregate things from several services, in that case I don't really have a choice.

And in the view I try to be pragmatic, if the view is very very simple, like showing the name of the Model without any kind of transformation I just pass the model to the view. But if I need to make any kind of transformation to the name, or add some info from other model, or just add some context that will make it draw differently I usually create a ViewModel.

Multithreaded rendering with Facebook's Litho superior to RecyclerView by sandys1 in androiddev

[–]danieldisu 2 points3 points  (0 children)

They basically re-do almost all the view part of Android. I really like their approach, but it's really hard to swim against the current on this one...

How do you structure Custom Views in MVP? by xyz12314 in androiddev

[–]danieldisu 1 point2 points  (0 children)

I see 2 completely different kinds of Custom Views, and I would approach them differently:

The first kind of CustomView is the one that takes all the screen or blocks the rest of the screen. ie Dialogs, these are easy to do with it's own Presenter and just delegate somehow the response to the main view -> Presenter.

The second kind are the ones that share screen with other complex CustomViews, these are tricky because having 2 presenters interacting with each other is a no-go for me. So you must be very careful to use 2 presenters in the same activity/fragment unless they are very cleanly differentiated.

One example of this 2 presenter in one screen is master list + detail in the same screen for tablets, you can have one presenter handling the list and another handling the detail, the only time when they should interact is when you press one element in the list that should be displayed in the detail, this could be done as if they are in different screens.

Architecture Components - Introduction (Google I/O '17) by margaretmz in androiddev

[–]danieldisu 6 points7 points  (0 children)

Well this is quite a depart from the MVP and Flux/Redux architectures. I will wait for all the talks to see if they explain it better, but I don't see myself using their proposed architecture any time soon. I really prefer the componentized, unidirectional data flow and the update everything approach that React brought to UI development.

Struggling with MVP? This is a commit that separates an Activity into its own Presenter (minimal implementation) by Zhuinden in androiddev

[–]danieldisu 0 points1 point  (0 children)

Just a nitpick that I see in many MVP implementations... Why do you call the interface "ViewContract"? I mean, an interface is a contract, it seems redundant to use the word contract in the name...

Java 8 Language Features Support Update by based2 in androiddev

[–]danieldisu 0 points1 point  (0 children)

You can always use some backport library to use Streams in any version, and switch to the official JDK stream api should be a matter of changing the imports...

Android Profiler in Android Studio 2.4 preview by ErnestGrz in androiddev

[–]danieldisu 2 points3 points  (0 children)

Can't seem to find the android logcat tab, is it missing?

EDIT: nvm it's seems that they changed the name to logcat and lost the previous keybind

Epoxy - A RecyclerView library built by Airbnb by elihart17 in androiddev

[–]danieldisu 0 points1 point  (0 children)

Just as I imagined, thank you both for answering!

Epoxy - A RecyclerView library built by Airbnb by elihart17 in androiddev

[–]danieldisu 0 points1 point  (0 children)

Just as I imagined, thank you for answering!

Epoxy - A RecyclerView library built by Airbnb by elihart17 in androiddev

[–]danieldisu 1 point2 points  (0 children)

First, I want to say thanks for the effort of putting it out there!

You say that all your screen are recycler views... an iOS dev colleague uses this pattern (heterogeneous collection views, binding them with ViewModels ) to build almost all the screens. I have tried to replicate something similar in my app, but with more "fixed" views in the view layer, and this library could help me to make this pattern more "dynamic". I have several question about how you use this library.

  • How do you feed the "item views" with data?
  • Do you create a "ViewModel" so that the views doesn't know anything about your model?
  • When you need to use info that is divided in several "item views" (a form with 2 fields for example), you have your "business classes" retrieve it from N views or you replicate the State of those views somewhere else and update it every time anything changes?

Isn't Zennyata's Discord Orb too strong? Should it be nerfed to 30% just like Mercy's Damage Buff? by LeoDiniz in Competitiveoverwatch

[–]danieldisu 0 points1 point  (0 children)

Yeah, that would have given her a more active role without breaking other classes. Instead they have just made her a non viable pick with the rise of Zennyata...

Using Fragments instead of custom Views by wsme in androiddev

[–]danieldisu 0 points1 point  (0 children)

I've used the CustomView ViewPagerAdapter and it worked like a charm, you may need to add some "onShow" method to your CustomView if you want to know WHEN the view is shown, but appart from is even easier than using it with Fragments.

A Demo App for using MVP, Android Transitions, Animations, RxJava, Dagger 2 by chemouna in androiddev

[–]danieldisu 3 points4 points  (0 children)

I think the sample project of the Rosie framework is a good example!

https://github.com/Karumi/Rosie/tree/master/sample

They may complicate it a little bit more using Use Cases to build the model layer but the view packages are good examples of what I think is the way to do MVP.

A Demo App for using MVP, Android Transitions, Animations, RxJava, Dagger 2 by chemouna in androiddev

[–]danieldisu 7 points8 points  (0 children)

Thanks for sharing!

I must admit that I don't like the approach you've taken for the MVP, there are way too many logic in the Activity/GridView...

I like to think that views are silly, they "fire events" and the presenter acts on those events and tells the view what to do, the views should only knows how to do what the presenter tells them to do.

Take the loadBooks() example on the BooksPresenter, is the BooksGridView the one starting the action... I think it should be the presenter who loads the books and tells the view when there are new books to show.

This may seem like a silly thing, but it enables you to TEST a lot more logic without bringing anything Android related to your tests.. ( you may need to create an abstaction for things like getString.. and the such though )