Summary of knowledge learned in November 2019
Custom the response of retrofit before it parse from json to object.
There are two ways:
- Self dk code
- Customize yourself
Use interceptors, but be careful and easy to make mistakes. You can look at the article Retrofit and Ok Http in Android – Maybe you already know?
2. Emoji library
You can see it at: https://github.com/vanniktech/Emoji .
Android has provided lib for this part, you can see at: https://developer.android.com/guide/topics/ui/look-and-feel/emoji-compat
3. Integrating payments into the app
Momo provides payment solutions for services on many different platforms: Desktop Website, Mobile Website, Mobile Application, POS, Pay In Bill, Web In App MoMo
You can see instructions, details at home page: https://developers.momo.vn/#/
Demo code: https://github.com/momo-wallet/payment
4. toString () in the View class
When log 1 view up it out like this ConstraintLayout {6f5453 VE …… …… I. 0.0-0.0 # 7F0A0226 app: id / toolbar} what is each value?
See the toString () function of the View class to understand what those numbers are. It … adds up
The toString () function in the View class For example
7b14550
– hash code that identifies I
– view is invisible
F
– view is focusable
E
– view is enabled
C
– view is clickable
0,0-1440,315
mLeft, mTop, mRight and mBottom parameters. You can see as in the picture below
The parameters are based on the parent view that contains it
5. Making bottomdialog like Tiki
Bottom dialog of Tiki
In the code we call it “Bottom sheet”.
You search Bottom sheet on Google and you will see there are many examples.
6. Error when upgrading Android Studio to v3.5.2
- Package exists but build keeps seeing error
How to fix: rebuild + restart several times + init cache and restart
- Error without suggest code
This I do not know how to fix. Who knows, please help me, tks ?
7. When the screen has many lists, how to handle ??
Many lists like the Tiki app
C1: Lots of recycler view + nested scroll view: the problem might be performance, problem when swiping views
C2: A recycler view parent, inside the item is the child recycler view: use getItemViewType. As shown in the picture, the book is a type, the catalog is a different type, for example.
This method is simple, it helps to create many recycler views, adapters, .. but if many types have to create many
==> Quite laborious
C3: Use sealed class – only in Kotllin . I have never used it, but I heard it would be great, so share it with you guys to try ^. ^. Whoever used it, please comment!
Sealed class, note this is in Kotlin: 3
8. Using android 9, some applications like Zing mp3 or Nhaccuatui are running that turn off the screen for a few minutes and it stops always.
Interrupting like this
Fix: zing mp3 it has instructions to fix here
9. Instructions when first entering the app
This kind
You search the keyword “Spotlight Android” is out okay ? I see there are 2 lib right on the top of Google search, you can see
10. Tooltip
It’s the blue popup as shown below
Making
Use: Popupwindow (available in Android)
Or you can use lib
Also you can Search more on Google offline nhé
11. Animation effects of things
Do you want to make the magic effect as below? Do not ignore the lottie
Magic thanks to lottie
A little introduction to lottie:
Lottie is a library for Android, IOS, Web and Window that analyzes effects created by Adobe After Effects – in json format, using Bodymovin – a plugin in Adobe After Effects to create and render them on platforms.
There is a very nice sentence that on the lottie homepage it says: “They say a picture is worth 1,000 words so here are 13,000” (They say a picture is worth 1,000 words but here is 13,000). Actually I find the effects of lottie very … quality, genuine ò
Code guide for Android you can see here: http://airbnb.io/lottie/#/android .
There is also code for iOS, the Web, etc.
Heart effects, like genuine like facebook:
https://github.com/jd-alexander/LikeButton
12. For those who like to dabble with code and decode
- Jadx: https://github.com/skylot/jadx – is out of date
- Virtuous Ten Studio – for every window – or – convenience – lots of support:
Conclusion
That is the end. Please leave your comments
The article is also posted on a personal blog, take a look to learn more things