@@ -24,7 +24,6 @@ import kotlinx.android.synthetic.main.activity_main.*
2424import kotlinx.android.synthetic.main.content_main.*
2525import javax.inject.Inject
2626
27-
2827class MainActivity : BaseDrawerActivity () {
2928
3029 private lateinit var recordList: List <Record >
@@ -51,16 +50,14 @@ class MainActivity : BaseDrawerActivity() {
5150 private lateinit var tvDefaultAccountSum: TextView
5251 private lateinit var tvCurrency: TextView
5352
54- override fun getContentViewId (): Int {
55- return R .layout.activity_main
56- }
53+ override fun getContentViewId (): Int = R .layout.activity_main
5754
5855 override fun initData (): Boolean {
5956 super .initData()
60- appComponent.inject(this @MainActivity )
57+ appComponent.inject(this )
6158
6259 preferenceController.addLaunchCount()
63- summaryPresenter = ShortSummaryPresenter (this @MainActivity )
60+ summaryPresenter = ShortSummaryPresenter (this )
6461
6562 return super .initData()
6663 }
@@ -115,7 +112,7 @@ class MainActivity : BaseDrawerActivity() {
115112
116113 private fun showReport () {
117114 AnswersProxy .get().logButton(" Show Report" )
118- val intent = Intent (this @MainActivity , ReportActivity ::class .java)
115+ val intent = Intent (this , ReportActivity ::class .java)
119116 intent.putExtra(ReportActivity .KEY_PERIOD , period)
120117 startActivity(intent)
121118 }
@@ -125,10 +122,7 @@ class MainActivity : BaseDrawerActivity() {
125122
126123 if (resultCode == AppCompatActivity .RESULT_OK ) {
127124 when (requestCode) {
128- REQUEST_ACTION_RECORD -> {
129- appComponent.inject(this @MainActivity)
130- update()
131- }
125+ REQUEST_ACTION_RECORD -> update()
132126
133127 REQUEST_BACKUP -> {
134128 appComponent.inject(this @MainActivity)
@@ -142,11 +136,10 @@ class MainActivity : BaseDrawerActivity() {
142136 }
143137
144138 override fun update () {
145- println (" Hello update" )
146139 recordList = recordController.getRecordsForPeriod(period)
147140 recordList = recordList.reversed()
148141
149- listView.adapter = RecordAdapter (this @MainActivity , recordList)
142+ listView.adapter = RecordAdapter (this , recordList)
150143
151144 val currency = currencyController.readDefaultCurrency()
152145
@@ -159,13 +152,13 @@ class MainActivity : BaseDrawerActivity() {
159152
160153 private fun showAppRateDialog () {
161154 AnswersProxy .get().logEvent(" Show App Rate Dialog" )
162- val dialog = AppRateDialog (this @MainActivity )
155+ val dialog = AppRateDialog (this )
163156 dialog.setCanceledOnTouchOutside(false )
164157 dialog.show()
165158 }
166159
167160 private fun startAddRecordActivity (record : Record ? , mode : AddRecordActivity .Mode , type : Int ) {
168- val intent = Intent (this @MainActivity , AddRecordActivity ::class .java)
161+ val intent = Intent (this , AddRecordActivity ::class .java)
169162 intent.putExtra(AddRecordActivity .KEY_RECORD , record)
170163 intent.putExtra(AddRecordActivity .KEY_MODE , mode)
171164 intent.putExtra(AddRecordActivity .KEY_TYPE , type)
0 commit comments