# android


04/12/2018, 6:16 PM
@jw So the official Kotlin style guide is contradictory against the Android style guide. I know they are 2 separate style guides, but my team has been using them as complementary, as have other projects like ktlint. i.e. Android Kotlin style guide recommends a continuation indent when giving function params their own line, while the kotlin style guide recommends a normal indent. Is this intentional, meaning the guides are meant to be used independently of one another?

Chris Margonis

04/13/2018, 10:26 AM
I have the same question 🤔


04/15/2018, 3:44 PM
@Chris Margonis @spierce7 cc @hhariri This my approach. in kotlin style guide from
they desire to make class layout looks like this.
Copy code
Property declarations and initializer blocks
Secondary constructors
Method declarations
Companion object
in other hand google also have they own style guide. here
in google style guide, they are not mention about class layout. this weird but, that the truth. so, i came along to find what
did in they project structure. so, i found this.
^ this sample from
google sample architecture component
by yigit boyar and team. This quite difference. but, i think structure from yigit much better. as we have difference for this structure. we came over with this structure.
Copy code
class LifeIncrementScreen @JvmOverloads constructor(context: Context,
                                                    attributeSet: AttributeSet? = null,
                                                    defStyle: Int = 0,
                                                    val componentType: String? = null) :
        LifeBaseScreen<LifeIncrementScreenPresenter.View, LifeIncrementScreenPresenter>(context, attributeSet, defStyle),
        LifeOptionInfoActionListener {

    init {
        LayoutInflater.from(context).inflate(R.layout.component_incremental, this, true)

    private var isAttached = false
    private var hasSelectedItem = false

    private var title by Delegates.notNull<String>()

    private var increment: List<LifeIncrementItem>? = null

    private lateinit var listener: MandatoryListener
    private lateinit var adapter: LifeAdapter<LifeIncrementItem, LifeIncrementViewHolder>

    override fun onAttachedToWindow() {}

    override fun onDetachedFromWindow() {}

    override fun setupInjection() {}

    override fun setupEvent() {}

    override fun setupView() {}

    override fun setupData() {}

    override fun onLoadIncrement(title: String, increment: List<LifeIncrementItem>) {}

    override fun onProductSelectedFromInfo(position: Int) {}

    fun lifeScreenStateEvent(event: BusStateMachine.LifeScreenState) {}

    private fun setupInfoDialog(position: Int, imageUrl: String?, name: String?, price: String?,
                                description: String?) {}

    private fun setOnClickListener(adapter: LifeAdapter<LifeIncrementItem,LifeIncrementViewHolder>, holder: LifeIncrementViewHolder) {}

    private fun precondition() {}
Also I encourage using clean code approach by uncle bob. How to organize structure