Skip to content

Instantly share code, notes, and snippets.

@brh
Created July 31, 2020 19:45
Show Gist options
  • Save brh/f95c0411fee3c4c20293082f09eeea42 to your computer and use it in GitHub Desktop.
Save brh/f95c0411fee3c4c20293082f09eeea42 to your computer and use it in GitHub Desktop.
private fun setupRecyclerView(steps: List<StepData>) {
binding.recyclerView.apply {
binding.progress.visibility = View.GONE
adapter = StepDataAdapter(steps)
layoutManager = LinearLayoutManager(requireContext())
if (steps.isEmpty())
Snackbar.make(this, R.string.nosteps, Snackbar.LENGTH_INDEFINITE).apply {
this.setAction(R.string.refresh){
viewModel.fetchData()
dismiss()
}
show()
}
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
//can't use ActivityResultCallback in Fit until the api is updated
if (requestCode == FIT_PERMISSION_REQUEST && resultCode == Activity.RESULT_OK) {
viewModel.fetchData()
} else
Toast.makeText(requireContext(), "Well", Toast.LENGTH_LONG).show()
super.onActivityResult(requestCode, resultCode, data)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment