preface
I haven’t seen you for a long time. It’s not because I’m lazy, but because the company is really in a hurry, so I’m busy with the company’s affairs every day.
Wrote an article on MVVM in late May: MVVM? Messing around? . At that time, I was really in a panic, afraid that I could not write well and thus mislead everyone, but after writing, I got more understanding of MVVM from the answers of several colleagues.
For example, THE VM of MVVM is ViewModel, but it is not just the ViewModel library in JetPack, but generally refers to the binding of view and data and so on. Therefore, these two days I have a little time to continue to improve the previous VERSION of MVVM to play Android in the evening and weekend. Without further ado, Let’s take a look at the implementation first.
Play Android MVVM version screenshot
First, let’s take a look at the final result:
Let’s take a look at some of the general styles that have been implemented before (Github address at the end of the article) :
The initial style
Looking at the style is ok, but before just a simple under, to achieve the most basic functions, switch to the landscape after the basic can not see, not to mention the split screen, night mode, local cache, no network weak network, no data and so on, next look at the new adaptation page.
Night mode
Landscape adaptation
There is no network and no data adaptation
experience
If you see here and want to download it, you can directly click the link to download it, or scan the qr code below to download it.
www.pgyer.com/llj2
The implementation process
The project uses many technologies, which are basically the latest standard configuration of android APP, such as MVVM, JetPack (LiveData, Room, ViewModel), Retrofit, coroutine, Glide, etc.
In fact, when I optimized the Demo, I felt that I had done a lot of things, but IT really made me feel a little confused when I wrote. Because there were many things to use, I could write an article alone by picking one out.
For example, in the optimization of APK size, I finally optimized the APK to only 3.3MB, now any APK should be dozens of MB. There are a lot of apK optimizations, such as code obturation, resource file obturation, unnecessary language deletion, image transfer to WebP, etc. If you want to learn more about APK compression, you can read this article I wrote before: Playing Android must master apK extreme compression performance optimization.
For example, Room is used in the new browsing history function. When there is no Room, it is basically realized by using native or using LitePal and GreenDAO. Although LitePal and GreenDAO are database operations implemented by ORM, they are still not as good as Room in general. Room to write a good implementation of the DAO interface file, when you compile will directly generate the corresponding implementation class, really very fragrant.
There are many similar to the above, you can go to Github to download the code to have a look, the code can not write well, but certainly can not say bad, if the code which is not good or there is an optimization of the place welcome to tell me or give me the issues.
All right, let’s see if you want to know about the technology in this app, you can leave it in the comments section, and I’ll do a more technical post next week. Finally, put the project’s Github address: github.com/zhujiang521…
If you are helpful, don’t forget to point Star, thank you 🙏