Monthly Favourite Songs
May 2020
One of the best anime ever!!! Touch OST
May 2020
One of the best anime ever!!! Touch OST
Tips and tricks of drawsing text
Drawing text can be tricky at times, let’s look at some examples. First, let’s look at some terminologies used here. Some most important keywords are: baseline: the line where the text “sits on” ascent: The recommended distance above the baseline for singled spaced text descent: The recommended distance below the baseline for singled spaced text top: The maximum distance above the baseline for the tallest glyph in the font at a given text size bottom: The maximum distance below the baseline for the lowest glyph in the font at a given text size A picture is worth 1000 words:
PECS explained
You: Master, I heard this PECS in the JAVA world. But I’m deeply puzzled by it. Master: Do you know what it stands for? You: Producer Extends Consumer Super? Master: In order to understand it, you shall stop thinking about what these words mean, it’s not helpful at all. Just follow my questions. You: Yes, Master. Please start. Master: There are plants, then there are fruits, then there are apples and pears.
Curated list of realm learning resources
You know nothing about realm, then watch this video first -> Now you should know the basic basics, then take a look at the official doc. You think you know it all until you try to combine with RxJava. Now you are super puzzled, look at some examples with full source code. Finally you realize that you have to do all this in clean architecture and decided to give up by turning Realm into a NoSQL version SQLite.
Draw Text
In this article we talk about drawing text. Let’s see how to implement a view which simply displays some text. Let’s call it MyTextView. This is how it will look like: <!– Omitted constraintlayout related stuff–> <com.example.MyTextView.MyTextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="10dp" android:background="@color/colorAccent" app:myTextColor="#000000" app:myText="Hello World! My love!" app:myTextSize="24sp" /> Let’s first define the custom attributes of the view, in values/attrs.xml <resources> <declare-styleable name="MyTextView"> <attr format="string" name="myText" /> <attr format="color" name="myTextColor" /> <attr format="dimension" name="myTextSize" /> </declare-styleable> </resources> Then in the MyTextView.