示例#1
0
    protected void onPostExecute(Pair<GroupList, List<ChildrenList>> result) {
      mCursorAdapter =
          new HistoryListAdapter(
              mContext,
              result.first,
              R.layout.awesomebar_header_row,
              new String[] {URLColumns.TITLE},
              new int[] {R.id.title},
              result.second);

      if (mContentObserver == null) {
        // Register an observer to update the history tab contents if they change.
        mContentObserver =
            new ContentObserver(GeckoAppShell.getHandler()) {
              public void onChange(boolean selfChange) {
                mQueryTask = new HistoryQueryTask();
                mQueryTask.execute();
              }
            };
        BrowserDB.registerHistoryObserver(getContentResolver(), mContentObserver);
      }

      final ExpandableListView historyList = (ExpandableListView) getView();

      // Hack: force this to the main thread, even though it should already be on it
      GeckoApp.mAppContext.mMainHandler.post(
          new Runnable() {
            public void run() {
              historyList.setAdapter(mCursorAdapter);
              expandAllGroups(historyList);
            }
          });

      mQueryTask = null;
    }