@Override
  protected void finalize() throws Throwable {
    super.finalize();

    /** Mozilla: Not needed for the application. */
    mPackageMonitor.unregister();
  }
 @Override
 public void unregisterDataSetObserver(DataSetObserver observer) {
   mDataSetObservable.unregisterObserver(observer);
   if (mAdapter != null) {
     mAdapter.unregisterDataSetObserver(observer);
   }
 }
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (resultCode == Activity.RESULT_OK) {
     synchronized (cells) {
       cells.remove(formCell);
       cells.add(formCell);
     }
     observable.notifyChanged();
   }
 }
 public void registerObserver(DataSetObserver paramDataSetObserver) {
   super.registerObserver(paramDataSetObserver);
   mUpdateLists.add(this);
   if (mUpdateLists.size() > 3) {
     LogUtils.w(
         "Gmail",
         "global RLC update set size=%d",
         new Object[] {Integer.valueOf(mUpdateLists.size())});
   }
 }
 public boolean removeHeader(View v) {
   for (int i = 0; i < mHeaderViewInfos.size(); i++) {
     FixedViewInfo info = mHeaderViewInfos.get(i);
     if (info.view == v) {
       mHeaderViewInfos.remove(i);
       mAreAllFixedViewsSelectable = areAllListInfosSelectable(mHeaderViewInfos);
       mDataSetObservable.notifyChanged();
       return true;
     }
   }
   return false;
 }
  @Override
  public void onUpdate(SortedSet<Post> posts) {
    synchronized (cells) {
      boolean formCellAdded = false;
      long beforeFormCellId = Long.MAX_VALUE;
      if (!cells.get(cells.size() - 1).equals(formCell)) {
        final int currentPos = cells.indexOf(formCell);
        beforeFormCellId = cells.get(currentPos - 1).getItemId();
      }

      cells.clear();
      Date prevDate = null;
      Date lastSeparatorDate = null;
      ListCell prevCell = null;
      for (Post post : posts) {
        Date currentDate = Post.virtualTimestampToDate(post.getVirtualTimestamp());
        if (prevDate == null || !isSameDate(prevDate, currentDate)) {
          lastSeparatorDate = currentDate;
          prevCell = new DateSeparatorCell(currentDate);
          cells.add(prevCell);
          if (!formCellAdded && prevCell.getItemId() == beforeFormCellId) {
            cells.add(formCell);
            formCellAdded = true;
          }
        }
        prevDate = currentDate;

        prevCell = new PostCell(post);
        cells.add(prevCell);
        if (!formCellAdded && prevCell.getItemId() == beforeFormCellId) {
          cells.add(formCell);
          formCellAdded = true;
        }
      }

      if (lastSeparatorDate == null || !isSameDate(lastSeparatorDate, new Date())) {
        cells.add(new DateSeparatorCell(new Date()));
      }

      if (!formCellAdded) {
        cells.add(formCell);
      }
      observable.notifyChanged();
    }
  }
  /** Closes all the source results and unregisters all observers. */
  private void close() {
    if (DBG) Log.d(TAG, "close() [" + hashCode() + "]");
    if (mClosed) {
      throw new IllegalStateException("Double close()");
    }
    mClosed = true;
    mDataSetObservable.unregisterAll();
    if (mShortcuts != null) {
      mShortcuts.close();
      mShortcuts = null;
    }

    for (CorpusResult result : mCorpusResults) {
      if (result != null) {
        result.close();
      }
    }
    Arrays.fill(mCorpusResults, null);
  }
    @Override
    public void notifyChanged() {
      // 数据改变 若已翻至末端 则立即调用addNewItems
      Log.i(VIEW_LOG_TAG, "收到数据改变通知");

      if (adapter.getCount() <= itemIds.size()) {
        // 删减刷新
        clear();
        Message msg = handler.obtainMessage();
        msg.what = ACTION_INIT_ITEMS;
        handler.sendMessageDelayed(msg, DELAY);

      } else {
        // 添加刷新
        if ((colCount - selectCol) < screenMaxColumns) {
          Message msg = handler.obtainMessage();
          msg.what = ACTION_ADD_ITEMS;
          handler.sendMessageDelayed(msg, DELAY);
        }
      }

      super.notifyChanged();
    }
 public void notifyDataSetChanged() {
   mDataSetObservable.notifyChanged();
 }
Exemple #10
0
 @Override
 public void notifyChanged() {
   super.notifyChanged();
   mGlobalObservable.notifyChanged();
 }
 @Override
 public void notifyInvalidated() {
   super.notifyInvalidated();
 }
 @Override
 public void unregisterDataSetObserver(DataSetObserver observer) {
   observable.unregisterObserver(observer);
 }
Exemple #13
0
 /** Calls {@link DataSetObserver#onChanged()} on all observers. */
 protected void notifyDataSetChanged() {
   if (DBG) Log.d(TAG, "notifyDataSetChanged()");
   mDataSetObservable.notifyChanged();
 }
Exemple #14
0
 /**
  * Registers an observer that will be notified when the reported results or the done status
  * changes.
  */
 public void registerDataSetObserver(DataSetObserver observer) {
   if (mClosed) {
     throw new IllegalStateException("registerDataSetObserver() when closed");
   }
   mDataSetObservable.registerObserver(observer);
 }
 public void unregisterObserver(DataSetObserver paramDataSetObserver) {
   super.unregisterObserver(paramDataSetObserver);
   if (mObservers.isEmpty()) {
     mUpdateLists.remove(this);
   }
 }
 public void unregisterAll() {
   super.unregisterAll();
   mUpdateLists.remove(this);
 }