Created
November 4, 2018 17:19
-
-
Save myeonginwoo/b0ca29ae7d2d26a38900c650b2f22a34 to your computer and use it in GitHub Desktop.
This file contains 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
class MainActivity : AppCompatActivity(), MainView { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
val mainViewModel = MainViewModel(this, DataStore()) | |
bt_a.setOnClickListener { | |
mainViewModel.requestItemInfo(ItemType.ITEM_A) | |
} | |
bt_b.setOnClickListener { | |
mainViewModel.requestItemInfo(ItemType.ITEM_B) | |
} | |
bt_c.setOnClickListener { | |
mainViewModel.requestItemInfo(ItemType.ITEM_C) | |
} | |
} | |
override fun onUpdatedItem(oldItem: Item, newItem: Item) { | |
tv_item.text = "${oldItem.title} -> ${newItem.title}" | |
iv_item.setBackgroundColor(Color.parseColor(newItem.color)) | |
} | |
override fun showProgress() { | |
pb_item.show() | |
} | |
override fun hideProgress() { | |
pb_item.hide() | |
} | |
override fun onError(throwable: Throwable?) { | |
TODO("not implemented") //To change body of created functions use File | Settings | File Templates. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment