-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathView.kt
57 lines (44 loc) · 1.32 KB
/
View.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package rx.kotlin.training.rxkotlintraining
import android.annotation.SuppressLint
import android.app.ProgressDialog
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*
import javax.inject.Inject
@SuppressLint("Registered")
/**
* Created by davidmartin on 20/9/17.
*/
class View: AppCompatActivity(), IView {
@Inject
lateinit var presenter: Presenter
var progressDialog: ProgressDialog? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
Application.graph.inject(this)
presenter.onViewCreated(this)
button.setOnClickListener {
presenter.sendMessage()
}
}
override fun onDestroy() {
super.onDestroy()
presenter.onViewDestroyed()
}
override fun showMessage(message: String) {
input.text.clear()
output.text = message
}
override fun getMessage(): String? {
return input.text.toString()
}
override fun showLoading() {
progressDialog = ProgressDialog(this)
progressDialog!!.setMessage("Loading, please wait..")
progressDialog!!.show()
}
override fun hideLoading() {
progressDialog!!.dismiss()
}
}