Created
June 27, 2018 07:29
-
-
Save nikhilbansal97/19a08ee63feeb95826d0fdeefc15592f to your computer and use it in GitHub Desktop.
The MainActivity for the view layer of the SampleMVP project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.nikhil.samplemvp.view | |
import android.support.v7.app.AppCompatActivity | |
import android.os.Bundle | |
import com.example.nikhil.samplemvp.presenter.MainActivityPresenter | |
import com.example.nikhil.samplemvp.R | |
import com.example.nikhil.samplemvp.contract.ContractInterface.* | |
import kotlinx.android.synthetic.main.activity_main.* | |
class MainActivity : AppCompatActivity(), View { | |
private var presenter: MainActivityPresenter? = null | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
presenter = MainActivityPresenter(this) | |
} | |
override fun initView() { | |
counterTextView.text = presenter?.getCounter() | |
clickButton.setOnClickListener { presenter?.incrementValue() } | |
} | |
override fun updateViewData() { | |
counterTextView.text = presenter?.getCounter() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment