Closed Bug 780276 Opened 12 years ago Closed 10 years ago

Make GeckoAsyncTask's dependency on Activity optional

Categories

(Firefox for Android Graveyard :: General, defect, P3)

ARM
Android
defect

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: cpeterson, Assigned: sriram)

References

Details

In bug 778468 comment 21, Sriram suggests:


Untangling a bit more..

 mActivity.runOnUiThread(new Runnable() { ... }); in GeckoAsyncTask

Ideally GeckoAsyncTask doesn't need to know about the activity, if its used only for a small background task. So, this can have a null check for mActivity, there by, I can do a small background task with the GeckoAsyncTask.

This will be helpful in Tab.java (and others). So,

updateBookmark() {
  ...
  (new GeckoAsyncTask(null, ...) {
     doInBackground() {
       ...
     }
   }).execute();
}


If it really wants a notification after completion, then GeckoAsyncTask will be like..

GeckoAsyncTask(args-list) {
  setUIHandler() {
    mUIHandler = GeckoAsyncTask.UIHandler;
  }

  doInBackground() { ... }

  run() {
    if (mUIHandler) { mUIHandler.notifyProcessDone(); }
}

and GeckoAsyncTask.UIHandler is just an interface.


This will help anything -- that's not an activity -- to make use of GeckoAsyncTask. Say, a BrowserToolbar wants to use GeckoAsyncTask,

  (new GeckoAsyncTask(args) {
    doInBackground() { ... }
  }).setUIHandler(new GeckoAsyncTask.UIHandler() {
     notifyProcessDone() { .. browser-toolbar's-ui-tasks }
  }).execute();

... aaahh.. that's finally Javascript! :(
Assignee: nobody → sriram
UiAsyncTask no longer has any dependency on Activity, so closing.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.