-
Notifications
You must be signed in to change notification settings - Fork 10
/
BaseActivity.kt
61 lines (50 loc) · 1.42 KB
/
BaseActivity.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
58
59
60
61
package kaist.iclab.abclogger.ui.base
import android.os.Bundle
import android.view.LayoutInflater
import androidx.annotation.CallSuper
import androidx.appcompat.app.AppCompatActivity
import androidx.viewbinding.ViewBinding
import kaist.iclab.abclogger.core.Log
abstract class BaseActivity<T : ViewBinding> : AppCompatActivity() {
lateinit var viewBinding: T
protected abstract fun afterViewInflate()
protected abstract fun getViewBinding(inflater: LayoutInflater): T
@CallSuper
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Log.d(javaClass, "onCreate()")
viewBinding = getViewBinding(layoutInflater)
setContentView(viewBinding.root)
afterViewInflate()
}
@CallSuper
override fun onStart() {
super.onStart()
Log.d(javaClass, "onStart()")
}
@CallSuper
override fun onStop() {
super.onStop()
Log.d(javaClass, "onStop()")
}
@CallSuper
override fun onDestroy() {
super.onDestroy()
Log.d(javaClass, "onDestroy()")
}
@CallSuper
override fun onRestart() {
super.onRestart()
Log.d(javaClass, "onRestart()")
}
@CallSuper
override fun onResume() {
super.onResume()
Log.d(javaClass, "onResume()")
}
@CallSuper
override fun onPause() {
super.onPause()
Log.d(javaClass, "onPause()")
}
}