droid-fu icon indicating copy to clipboard operation
droid-fu copied to clipboard

Eliminate BetterActivity dependency in BetterAsyncTask

Open erizzo opened this issue 13 years ago • 1 comments

Just a humble suggestion... The logic in BetterAsyncTask checks the passed-in Context to determine if it's a BetterActivity. It uses that info for only two purposes, both of which appear to be candidates for elimination:

  1. The progress dialog is only shown if the Context is a BetterActivity, but that seems overly restrictive because it doesn't rely on the BetterActivity interface. It does assume that dialog ID 0 will be available if the activity is a BetterActivity, but I think a sensible default behavior would be to make the default dialog ID be -1 instead of 0. I guess there's some default "fall-through" behavior in the BetterActivity implementations for handling dialog ID 0, but I'm not sure that really is worth it.

  2. It's also used to check the window features of the passed-in activity, but the default implementation of BetterActivity.getWindowFeatures() just calls BetterActivityHelper, which BetterAsyncTask could call directly itself. Furthermore, BetterActivityHelper.getWindowFeatures()'s comments indicate that it's broken anyway.

It seems to me that if these checks for BetterActivity were eliminated, BetterAsyncTask would be more useful for use from non-BetterActivity activities.

erizzo avatar Apr 28 '11 21:04 erizzo

yeah, good points. I haven't reviewed that code for ages to be honest.

mttkay avatar Apr 29 '11 08:04 mttkay