Last active
June 6, 2019 08:03
-
-
Save Nimrodda/5bd6b96879eff47119a0cfcb9590b96a 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 GamesListActivity : AppCompatActivity() { | |
private val viewModel by lazy { | |
ViewModelProviders.of(this).get(GamesListViewModel::class.java) | |
} | |
private val gamesListController = GamesListController() | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
val binding = DataBindingUtil.setContentView<ActivityGamesListBinding>(this, R.layout.activity_games_list) | |
binding.list.layoutManager = LinearLayoutManager(this) | |
binding.list.adapter = gamesListController.adapter | |
viewModel.gamesLiveData.observe(this, Observer { container -> | |
gamesListController.setData(container) | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment