Created
May 31, 2020 04:49
-
-
Save chelseatroy/635a4d436336a1e8579e5197b7e69a93 to your computer and use it in GitHub Desktop.
Showing and Hiding the ProgressBar
This file contains hidden or 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
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