Handle the love triangle of ProgressDialog, AsyncTask, and Activity.

Should fix crashes when an AsyncTask thinks a ProgressDialog is still
shown. Such as:
https://ticket.wikimedia.org/otrs/index.pl?Action=AgentTicketZoom&TicketID=7615172

Change-Id: I55196bc7c9c679f4a14e4558b0c0865a67ccbc6b