Is there a simple way to disable a user interacting with an activity. To be done when there is an action running (and a spinning progress bar in the title bar)
EDIT:
The code of Uriel Frankel (accepted response), works good, but in my case works after my request it's done :(. I want to block before it happend. Some one knows what is wrong in my code (I'm beginning in this..)
(this is a fragment)
login_login_btn.setOnClickListener {
if (validateInputs()){
showSpinner()
thread {
doLogin()
}
} else {
validationError("Validation Error","Checkout your inputs. Common errors: \npassword (at least 8 characters)")
}
}
}
fun showSpinner(){
activity?.window?.setFlags(
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE)
spinner.visibility = View.VISIBLE
}
Thank you (Y)