Created
July 31, 2020 19:45
-
-
Save brh/f95c0411fee3c4c20293082f09eeea42 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
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() | |
} | |
} | |
} |
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
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