Size: a a a

Kotlin Community

2020 March 16

ZB

Zaigham Baig in Kotlin Community
Mi
You'd better to visit @kotlin_start in this case, basically init block is a primary constructor body
Primary constructor? How
источник

ZB

Zaigham Baig in Kotlin Community
Guys, anyone loves to read source code?
I am reading Telegram source code.
Telegram excessively used FrameLayout
I just read, it is used to block a part of screen
источник

ZB

Zaigham Baig in Kotlin Community
When we delete chats, the pop up bar with timer and action button, like Undo
Used framelayout
источник

ZB

Zaigham Baig in Kotlin Community
FrameLayout, LinearLayout, ImageView TextView and Runnable
источник

ZB

Zaigham Baig in Kotlin Community
They can use Toast with custom views, but deprecated but Snackbar accept custom views
источник

ZB

Zaigham Baig in Kotlin Community
My question is, why did they prefer Extended FrameLayout? Rather Snackbar
источник

VP

Vladimir Petrakovich in Kotlin Community
Zaigham Baig
My question is, why did they prefer Extended FrameLayout? Rather Snackbar
Why are asking this in a Kotlin chat?
источник

ZB

Zaigham Baig in Kotlin Community
Vladimir Petrakovich
Why are asking this in a Kotlin chat?
Why are you ignoring my Kotlin questions? And jumping on Android related questions?
источник

AL

Alexander Levin in Kotlin Community
Zaigham Baig
Why are you ignoring my Kotlin questions? And jumping on Android related questions?
Kotlin-related questions are currently answered in @kotlin_start channel for you. Things about Telegram is very Android related and that's not the topic of the chat. Please stick to the topic :)
источник

ZB

Zaigham Baig in Kotlin Community
Alexander Levin
Kotlin-related questions are currently answered in @kotlin_start channel for you. Things about Telegram is very Android related and that's not the topic of the chat. Please stick to the topic :)
Okay :)
источник

AN

Alexander Nozik in Kotlin Community
Mi
You'd better to visit @kotlin_start in this case, basically init block is a primary constructor body
Actually, it is not. Init is called on class creation without relation to primary constructor.
источник

AL

Alexander Levin in Kotlin Community
Alexander Nozik
Actually, it is not. Init is called on class creation without relation to primary constructor.
there is relation - you can use primary constructor parameters IIRC
источник

ZB

Zaigham Baig in Kotlin Community
Alexander Nozik
Actually, it is not. Init is called on class creation without relation to primary constructor.
Like static block?
источник

AN

Alexander Nozik in Kotlin Community
Alexander Levin
there is relation - you can use primary constructor parameters IIRC
I agree, but I still think it is not correct to call it a primary constructor body
источник

AN

Alexander Nozik in Kotlin Community
Zaigham Baig
Like static block?
No. Static block in java does not have anything to do with the class instance. This is one of the reasons, it was removed in Kotlin.
источник

ZB

Zaigham Baig in Kotlin Community
Alexander Nozik
No. Static block in java does not have anything to do with the class instance. This is one of the reasons, it was removed in Kotlin.
Got it,
источник

ZB

Zaigham Baig in Kotlin Community
I guess, Init is just merely used to initialized properties
источник

AN

Alexander Nozik in Kotlin Community
Zaigham Baig
I guess, Init is just merely used to initialized properties
In kotlin it is discouraged, since you can initialize properties with expressions. Init is mostly used for constructor parameter check.
источник

ZB

Zaigham Baig in Kotlin Community
Alexander Nozik
In kotlin it is discouraged, since you can initialize properties with expressions. Init is mostly used for constructor parameter check.
Shortly it is used to for input validation in constructor
источник

AN

Alexander Nozik in Kotlin Community
Zaigham Baig
Shortly it is used to for input validation in constructor
More or less. You can use it for more complicated initialization logic, but the experience shows that it is better to use factory methods for that.
источник