Skip to content

Instantly share code, notes, and snippets.

@chelseatroy
Created May 31, 2020 04:49
Show Gist options
  • Save chelseatroy/635a4d436336a1e8579e5197b7e69a93 to your computer and use it in GitHub Desktop.
Save chelseatroy/635a4d436336a1e8579e5197b7e69a93 to your computer and use it in GitHub Desktop.
Showing and Hiding the ProgressBar
package com.chelseatroy.canary
class LoginActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
...
signInButton.setOnClickListener { view ->
if (isNetworkConnected()) {
//HERE'S WHERE WE SHOW THE PROGRESS BAR
progressBar.visibility = View.VISIBLE
authenticate()
} else {
...
}
}
}
fun authenticate() {
...
session = MockyAPIImplementation().authenticate()
//HERE'S WHERE WE HIDE THE PROGRESS BAR
progressBar.visibility = View.GONE
...
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment