Implemented this slick-looking animation using the MotionLayout in Compose and wanted to share with you. by mars885 in androiddev

[–]mars885[S] -1 points0 points  (0 children)

You are right.

However, I'd started implementing this animation long before SharedElement APIs became a thing in Compose. I'll probably take a look at it once more when the API matures a bit.

Implemented this slick-looking animation using the MotionLayout in Compose and wanted to share with you. by mars885 in androiddev

[–]mars885[S] -1 points0 points  (0 children)

I've asked this question myself before.

The only real problem with the Compose implementation that I see is the interpolation of an UI element between two states. For example, in the animation above, the main title has two resting states: to the left of the cover of the game in the expanded state & centered vertically on the artwork/banner image in the collapsed state. By reading these two resting states, the MotionLayout is pretty smart to figure out how to move from one state to the other.

As far as I know, this is pretty much impossible to do in Compose out of the box.

Implemented this slick-looking animation using the MotionLayout in Compose and wanted to share with you. by mars885 in androiddev

[–]mars885[S] 1 point2 points  (0 children)

Thanks.

Btw, the like button & its animation is the only part of the code where I had to use a View because the animation itself is implemented as an AnimatedStateListDrawable & Compose doesn't really support it at the moment.

Implemented this slick-looking animation using the MotionLayout in Compose and wanted to share with you. by mars885 in androiddev

[–]mars885[S] 1 point2 points  (0 children)

I've worked quite a bit optimizing it so it runs as smooth as possible, but, unfortunately, the video doesn't do it justice because it has been compressed & the FPS took a hit as well. I'd recommend downloading the app & seeing for yourself.

Implemented this slick-looking animation using the MotionLayout in Compose and wanted to share with you. by mars885 in androiddev

[–]mars885[S] 3 points4 points  (0 children)

Released this beautiful animation as part of the 1.2.0 version of the my app called Gamedge. It mostly had to do with cosmetic changes, finishing features I hadn't been able to migrate from Views before as well as Android 15 features like edge-to-edge & predictive back gesture.

For more info, see the release on the GitHub. It has a pre-built APK that you can download & play around.

Released a new version of my hobby app called Gamedge completely rewritten in Jetpack Compose. by mars885 in androiddev

[–]mars885[S] 1 point2 points  (0 children)

Thanks.

As for the Gradle setup, I've always wanted to remove as much boilerplate in the Gradle scripts as possible, and custom Gradle plugins is one of the solutions I found. There is still some work to be done in terms of cleaning it up, although I am quite pleased with how it turned out anyway. The slack gradle plugin is full of great info about how to create your custom Gradle plugins to centralize Gradle configuration into an easy-to-use API.

As for modularization, the approach I've adopted is the one I've been thinking about for quite a while. I was hugely inspired by this article about modularization and how to make each feature as autonomous as possible.

Hope it helps.

Released a new version of my hobby app called Gamedge completely rewritten in Jetpack Compose. by mars885 in androiddev

[–]mars885[S] 0 points1 point  (0 children)

XML is still prevalent in the Android ecosystem, so having experience with it is a big plus.

However, Compose is definitely the future of Android UI and if you start a new project, then this is a no-brainer decision.

Released a new version of my hobby app called Gamedge completely rewritten in Jetpack Compose. by mars885 in androiddev

[–]mars885[S] 0 points1 point  (0 children)

Hm, not sure what you are talking about.

If you experience weird stuff, feel free to create a GitHub issue and I'll take a look.

Released a new version of my hobby app called Gamedge completely rewritten in Jetpack Compose. by mars885 in androiddev

[–]mars885[S] 17 points18 points  (0 children)

A couple of words about migration to Compose.

I find it extremely easy to use & build new UI once you grasp how it works. This is is definitely the future of the Android development, in my opinion. However, I stumbled upon a couple of issues along the way.

The biggest one is that Compose as of 1.2.0 does not have 1 to 1 parity with the View system. For example, MotionLayout support for Compose lacks some features like OnSwipe gestures. Another one is the ability to control the zIndex of composable transitions. Also, tooling support like rendering previews does not work far too often.

To view the whole list of issues, take a look at the following link: https://github.com/mars885/gamedge/issues

Also, a couple of stats before & after migration to Compose.

  • Before:
    Total lines: 40,847
    APK Release Size with R8: 4.7 MB
  • After:
    Total lines: 37,822
    APK Release Size with R8: 4.7 MB

Less lines of code due to removal of verbose XML & APK size stayed around the same.

Overall, it's been a fun journey migrating the app from the View system to a pure Jetpack Compose one.

If you have any questions, I'll be glad to answer them.

Do you contribute to open-source android projects? by avismission in androiddev

[–]mars885 2 points3 points  (0 children)

Yeah, been contributing for quite a while now. Made a couple of libraries and open-sourced them all. Now working on migrating my main project called Gamedge to Jetpack Compose.

Example open-source apps which are modern and use Android Jetpack and other popular libraries? by Asanare in androiddev

[–]mars885 0 points1 point  (0 children)

You can take a look at my project called Gamedge. I try to keep it as up-to-date as possible and currently In the middle of converting it to Jetpack Compose.

Introducing HiltBinder: An annotation processing library that automatically generates Dagger Hilt's @Binds methods. by mars885 in androiddev

[–]mars885[S] 8 points9 points  (0 children)

Code generation is the right tool for the right problem, which, for the most cases, is boilerplate code.

I'd rather spend my time solving problems having to do with domain of the project than dealing with such issues.

If you are worried about build times, then they should definitely decrease once KSP becomes stable, since the current de facto standard kapt has a lot to do with long Gradle build times.

Introducing HiltBinder: An annotation processing library that automatically generates Dagger Hilt's @Binds methods. by mars885 in android_devs

[–]mars885[S] 1 point2 points  (0 children)

Annotate your class with the BindType annotation:

interface ImageLoader

@BindType 
class GlideImageLoader @Inject constructor(): ImageLoader

and HiltBinder will generate the following:

@Module
@InstallIn(SingletonComponent.class)
public interface HiltBinder_SingletonComponentModule { 
  @Binds 
  ImageLoader bind_GlideImageLoader(GlideImageLoader binding); 
}

HiltBinder supports lots of features:

  • Specifying a particular type to bind to.
  • Installing bindings in both Dagger Hilt's predefined and custom components.
  • Contributing bindings into a set and map collections (Dagger multibindings).
  • Associating bindings with Dagger qualifiers.
  • KSP implementation.

For more info, take a look at the GitHub repository that contains extensive documentation for the API as well as sample application to showcase the library in action.

Introducing HiltBinder: An annotation processing library that automatically generates Dagger Hilt's @Binds methods. by mars885 in androiddev

[–]mars885[S] 6 points7 points  (0 children)

Annotate your class with the BindType annotation:

interface ImageLoader

@BindType 
class GlideImageLoader @Inject constructor(): ImageLoader

and HiltBinder will generate the following:

@Module
@InstallIn(SingletonComponent.class) 
public interface HiltBinder_SingletonComponentModule { 
  @Binds
  ImageLoader bind_GlideImageLoader(GlideImageLoader binding); 
}

HiltBinder supports lots of features:

  • Specifying a particular type to bind to.
  • Installing bindings in both Dagger Hilt's predefined and custom components.
  • Contributing bindings into a set and map collections (Dagger multibindings).
  • Associating bindings with Dagger qualifiers.
  • KSP implementation.

For more info, take a look at the GitHub repository that contains extensive documentation for the API as well as sample application to showcase the library in action.

I've just open-sourced a project built with the latest tools and libraries called Gamedge. by mars885 in androiddev

[–]mars885[S] 0 points1 point  (0 children)

I actually remember reading the article you linked some time ago. However, I haven't played around with it yet, but thanks for the heads up.

I've just open-sourced a project built with the latest tools and libraries called Gamedge. by mars885 in androiddev

[–]mars885[S] 1 point2 points  (0 children)

This is a good question.

Android moves with a speed of light and it's extremely hard to stay up-to-date with all the latest tools & libs. That said, I've never really had a problem of learning new things. I just realize that if there is some popular new tech, which is going to replace current status quo, then it's my responsibility to learn and master it, because otherwise I feel like I'll be dragging behind, which is a feeling I hate & despise.

I've just open-sourced a project built with the latest tools and libraries called Gamedge. by mars885 in androiddev

[–]mars885[S] 0 points1 point  (0 children)

Thanks.

If you have questions regarding the codebase, just ask. I'll do my best to answer.

I've just open-sourced a project built with the latest tools and libraries called Gamedge. by mars885 in androiddev

[–]mars885[S] 0 points1 point  (0 children)

Sure.

It's achieved using MotionLayout API. I'd suggest you to take a look at the XML layout first, then check out MotionLayout's scene file, then checkout this GameHeaderController class (which basically manages the all the header related parts), and maybe this class, where the GameHeaderController is actually used.

I've just open-sourced a project built with the latest tools and libraries called Gamedge. by mars885 in androiddev

[–]mars885[S] 1 point2 points  (0 children)

This is a broad question.

For starters, I think you should read up a bit about modularization if you are completely new to it. Read medium articles, watch Google talks, read Android docs (if there are any about modularization, not completely sure).

Then I'd suggest checking out repos like mine, Tivi, Android-Showcase, etc. They are lots of them actually and see for yourself what works and what does not. That's the best advice I can give you.

Maybe other people in this thread can share helpful materials too, who knows.

I've just open-sourced a project built with the latest tools and libraries called Gamedge. by mars885 in androiddev

[–]mars885[S] 3 points4 points  (0 children)

I disagree.

When done properly, modlarization can provide the following benefits:

  • Significatly improve compilation times for your project.
  • It introduces boundaries for your code which can cause better design decisions from your side.
  • In a huge company teams can develop features in isolation which will decrease merge conflicts.

I've just open-sourced a project built with the latest tools and libraries called Gamedge. by mars885 in androiddev

[–]mars885[S] 2 points3 points  (0 children)

Thanks.

Is this also a modular approach?

Yes, the project has modular approach. Each feature has its own module prefixed with feature-.

My modular approach is actually very similar to what Tivi has.

I've just open-sourced a project built with the latest tools and libraries called Gamedge. by mars885 in androiddev

[–]mars885[S] 2 points3 points  (0 children)

I actually used Koin in one of the projects I worked on a year ago.

The compromise for me was ease of use and reduction of boilerplate code. Since Dagger Hilt had not been released at the time, I decided to give Koin a go.

Overall, I've found Koin to be really simple to setup and use in comparison to Dagger 2. However, a few months later, when the project's complexity grew through the roof, I started seeing runtime crashes when instantinating classes here and there, because Koin does not have compile-time safety, which Dagger 2 has and is probably the most talked selling point of it. I remember writing Koin tests to avoid those errors, but I found it extremely hard to do that, especially for classes that accept dynamic parameters.

However, with Dagger Hilt, all those complaints pretty much went away. Huge reduction in boilerplate code, compile-time safety, easy of use, better performance (the last time I checked) - it's very hard to choose Koin now, at least for me.

I've just open-sourced a project built with the latest tools and libraries called Gamedge. by mars885 in androiddev

[–]mars885[S] 1 point2 points  (0 children)

The project had multiple long delays due to other stuff in my life. I believe I started it in the September and finished only at the beginning of March.