private void reset() {
   mServiceProcessesByName.clear();
   mServiceProcessesByPid.clear();
   mInterestingProcesses.clear();
   mRunningProcesses.clear();
   mProcessItems.clear();
   mAllProcessItems.clear();
 }
 @Override
 public void notifyDataSetInvalidated() {
   mSectionCache.clear();
   mSectionPositionCache.clear();
   mSectionCountCache.clear();
   mCount = -1;
   mSectionCount = -1;
   super.notifyDataSetInvalidated();
 }
 private void loadWidgetsFromDisk() {
   if (!mNoteWidgetData.exists()) {
     return;
   }
   try {
     ObjectInputStream in = null;
     try {
       in = new ObjectInputStream(new FileInputStream(mNoteWidgetData));
       NoteWidget[] noteWidgets = (NoteWidget[]) in.readObject();
       synchronized (mWidgets) {
         mWidgets.clear();
         for (NoteWidget noteWidget : noteWidgets) {
           mWidgets.put(noteWidget.id, noteWidget);
         }
       }
     } finally {
       if (in != null) {
         in.close();
       }
     }
   } catch (ClassNotFoundException e) {
     mNoteWidgetData.delete();
   } catch (IOException e) {
     mNoteWidgetData.delete();
   }
 }
 @Override
 public void setAdapter(Adapter adapter) {
   mAdapter = adapter;
   mChildViews.clear();
   removeAllViewsInLayout();
   requestLayout();
 }
Ejemplo n.º 5
0
 /** 退出批量模式 */
 private void cancelBatchModel() {
   isBatchModel = false;
   mSelectState.clear();
   refreshListView();
   initBottomBar();
   rmTopBarView();
 }
 /** 界面销毁回调函数 */
 @Override
 protected void onDestroy() {
   super.onDestroy();
   BaseApplication.removeActivity(this);
   if (codeToListenerMap != null) {
     final int nCount = codeToListenerMap.size();
     for (int nIndex = 0; nIndex < nCount; ++nIndex) {
       removeCallbackEventListener(codeToListenerMap.keyAt(nIndex));
     }
     codeToListenerMap.clear();
   }
   requestCodeOfCustomerCardRelatedInfoDown = 0;
   requestCodeForOrderScuessToupdateCustomer = 0;
   requestCodeForEditCustomer = 0;
   toastManager = null; // 提示管理器
   mContext = null; // 上下文
   baseAttribute = null; // 基础属性抽象
   clickView = null; // 点击VIEW
   avatarDisplayImageOptions = null; // 圆角头像参数
   defaultDisplayImageOptions = null; // 默认参数
   clickedViewId = 0; // 点击VIEWID
   eventCode = 0; // 事件编码
   // 设置空的布局快速释放内存
   setContentView(R.layout.a_a_null_view);
   // 强制清理此Activity对象资源
   System.gc();
 }
Ejemplo n.º 7
0
    private void loadMostRecentSections(Cursor c) {
      // Clear any history sections that may have been loaded before.
      mMostRecentSections.clear();

      if (c == null || !c.moveToFirst()) {
        return;
      }

      final Date now = new Date();
      now.setHours(0);
      now.setMinutes(0);
      now.setSeconds(0);

      final long today = now.getTime();
      MostRecentSection section = null;

      do {
        final int position = c.getPosition();
        final long time = c.getLong(c.getColumnIndexOrThrow(URLColumns.DATE_LAST_VISITED));
        final MostRecentSection itemSection =
            MostRecentAdapter.getMostRecentSectionForTime(today, time);

        if (section != itemSection) {
          section = itemSection;
          mMostRecentSections.append(position + mMostRecentSections.size(), section);
        }

        // Reached the last section, no need to continue
        if (section == MostRecentSection.OLDER) {
          break;
        }
      } while (c.moveToNext());
    }
 public void clear() {
   mMediaItemMap.clear();
   mSeparatorItemMap.clear();
   mItems.clear();
   mSections.clear();
   notifyDataSetChanged();
 }
  /**
   * Add only the SectionHeaders that have history items within their range to a SparseArray, where
   * the array index is the position of the header in the history-only (no clients) ordering.
   *
   * @param c data Cursor
   * @param sparseArray SparseArray to populate
   */
  private static void populateSectionHeaders(Cursor c, SparseArray<SectionHeader> sparseArray) {
    sparseArray.clear();

    if (c == null || !c.moveToFirst()) {
      return;
    }

    SectionHeader section = null;

    do {
      final int historyPosition = c.getPosition();
      final long visitTime =
          c.getLong(c.getColumnIndexOrThrow(BrowserContract.History.DATE_LAST_VISITED));
      final SectionHeader itemSection = CombinedHistoryPanel.getSectionFromTime(visitTime);

      if (section != itemSection) {
        section = itemSection;
        sparseArray.append(historyPosition + sparseArray.size(), section);
      }

      if (section == SectionHeader.OLDER_THAN_SIX_MONTHS) {
        break;
      }
    } while (c.moveToNext());
  }
Ejemplo n.º 10
0
 private void freeAllLayouts() {
   int size = foldableItemsMap.size();
   for (int i = 0; i < size; i++) {
     FoldableItemLayout layout = foldableItemsMap.valueAt(i);
     layout.getBaseLayout().removeAllViews(); // Clearing old data
     foldableItemsCache.offer(layout);
   }
   foldableItemsMap.clear();
 }
Ejemplo n.º 11
0
 @Override
 public void onClearAllItems() {
   Log.d(TAG, "onClearAllItems");
   if (mListAdapter != null) {
     mSelectState.clear();
     refreshListView();
     mTopBarBuilder.notifyBatchStateChanged();
   }
 }
Ejemplo n.º 12
0
 private void clear() {
   itemIds.clear();
   this.removeAllViews();
   this.clearDisappearingChildren();
   this.destroyDrawingCache();
   mScroller.setFinalY(0);
   parentLayout = false;
   focusIsOut = true;
   currentChildCount = 0;
 }
Ejemplo n.º 13
0
 void clear() {
   final SparseArray<View> scrapHeap = mScrapHeap;
   final int count = scrapHeap.size();
   for (int i = 0; i < count; i++) {
     final View view = scrapHeap.valueAt(i);
     if (view != null) {
       removeDetachedView(view, true);
     }
   }
   scrapHeap.clear();
 }
 public boolean stopServerService() {
   clients.clear();
   clientsArray.clear();
   boolean stopped = context.stopService(intent);
   if (stopped) {
     timer.running = false;
     initalUpdateCalled = false;
   }
   Log.i(C.TAG, "Trying to stop buffer service: " + stopped);
   return stopped;
 }
Ejemplo n.º 15
0
 public void refresh() {
   // Updates favorite list, pager and alt TextView
   mFav = Favorites.getFavoriteList(this.getActivity());
   mComicMap.clear();
   if (mFav.length != 0) {
     if (sFavoriteIndex == mFav.length) {
       sFavoriteIndex--;
     }
     new pagerUpdate().execute();
   }
   // tvAlt.setText(mSharedPreferences.getString(("title" +
   // String.valueOf(sFavorites[sFavoriteIndex])), ""));
 }
 public void updateCache(Context context) {
   UserManager userManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
   if (userManager != null) {
     int currentUserId = ActivityManager.getCurrentUser();
     List<UserInfo> profiles = userManager.getProfiles(currentUserId);
     synchronized (mCurrentProfiles) {
       mCurrentProfiles.clear();
       for (UserInfo user : profiles) {
         mCurrentProfiles.put(user.id, user);
       }
     }
   }
 }
Ejemplo n.º 17
0
  public void setSections(final Section[] sections) {
    mSections.clear();

    Arrays.sort(
        sections,
        new Comparator<Section>() {
          @Override
          public int compare(final Section o, final Section o1) {
            return o.firstPosition == o1.firstPosition
                ? 0
                : o.firstPosition < o1.firstPosition ? -1 : 1;
          }
        });

    int offset = 0; // offset positions for the headers we're adding
    for (int i = 0; i < sections.length; i++) {
      final Section section = sections[i];
      Section sectionAdd;

      for (int j = 0; j < mNumColumns - 1; j++) {
        sectionAdd = new Section(section.firstPosition, section.title);
        sectionAdd.type = TYPE_HEADER_FILLER;
        sectionAdd.sectionedPosition = sectionAdd.firstPosition + offset;
        mSections.append(sectionAdd.sectionedPosition, sectionAdd);
        ++offset;
      }

      sectionAdd = new Section(section.firstPosition, section.title);
      sectionAdd.type = TYPE_HEADER;
      sectionAdd.sectionedPosition = sectionAdd.firstPosition + offset;
      mSections.append(sectionAdd.sectionedPosition, sectionAdd);
      ++offset;

      if (i + 1 < sections.length) {
        final int nextPos = sections[i + 1].firstPosition;
        final int itemsCount = nextPos - section.firstPosition;
        final int dummyCount = mNumColumns - itemsCount % mNumColumns;
        if (mNumColumns != dummyCount) {
          for (int j = 0; j < dummyCount; j++) {
            sectionAdd = new Section(section.firstPosition, section.title);
            sectionAdd.type = TYPE_FILLER;
            sectionAdd.sectionedPosition = nextPos + offset;
            mSections.append(sectionAdd.sectionedPosition, sectionAdd);
            ++offset;
          }
        }
      }
    }

    notifyDataSetChanged();
  }
Ejemplo n.º 18
0
  private void clearAllChannels() {
    Log.v(TAG, "clearAllChannels...");

    if (null != mChannelService) {
      // Telling ChannelService to close all the channels
      mChannelService.clearAllChannels();

      mChannelDisplayList.clear();
      mIdChannelListIndexMap.clear();
      mChannelListAdapter.notifyDataSetChanged();
    }

    Log.v(TAG, "...clearAllChannels");
  }
Ejemplo n.º 19
0
  public void refresh(boolean reflow) {
    mReflow = reflow;

    mScale = 1.0f;
    mXScroll = mYScroll = 0;

    int numChildren = mChildViews.size();
    for (int i = 0; i < numChildren; i++) {
      View v = mChildViews.valueAt(i);
      onNotInUse(v);
      removeViewInLayout(v);
    }
    mChildViews.clear();
    mViewCache.clear();

    requestLayout();
  }
Ejemplo n.º 20
0
 @Override
 public void onSelectAllItems() {
   Log.d(TAG, "onSelectAllItems");
   if (mListData != null) {
     mSelectState.clear();
     int size = mListData.size();
     if (size == 0) {
       return;
     }
     for (int i = 0; i < size; i++) {
       int _id = (int) mListData.get(i).getId();
       mSelectState.put(_id, true);
     }
     refreshListView();
     mTopBarBuilder.notifyBatchStateChanged();
   }
 }
  public void resetToTop() {
    if (mColumnCount > 0) {

      if (mColumnTops == null) {
        mColumnTops = new int[mColumnCount];
      }
      if (mColumnBottoms == null) {
        mColumnBottoms = new int[mColumnCount];
      }
      initColumnTopsAndBottoms();

      mPositionData.clear();
      mNeedSync = false;
      mDistanceToTop = 0;
      setSelection(0);
    }
  }
  @Override
  protected void onPause() {

    // XXX experimentally, we're gonna disable contacts sync so it doesn't
    // interfere with our evil root plans - and here we restore it
    // Account a = new Account(account, ACCOUNT_TYPE);
    // ContentResolver.setSyncAutomatically(a, CONTACTS_AUTHORITY,
    // contactsSyncAuto);
    // ContentResolver.setSyncAutomatically(a, CONTACT_PHOTO_AUTHORITY,
    // contactPhotoSyncAuto);

    thumbMemCache.clear();
    if (contactsLoader != null) contactsLoader.cancel(false);
    for (AsyncTask<?, ?, ?> lt : asyncTasks) lt.cancel(false);
    asyncTasks.clear();
    super.onPause();
  }
Ejemplo n.º 23
0
  private void replayUpdates(PackageInstallInfo newInfo) {
    if (DEBUG) Log.d(TAG, "updates resumed");
    if (!mResumed || !mBound) {
      // Not yet ready
      return;
    }
    if ((mPendingReplays.size() == 0) && (newInfo == null)) {
      // Nothing to update
      return;
    }

    LauncherAppState app = LauncherAppState.getInstanceNoCreate();
    if (app == null) {
      // Try again later
      if (DEBUG) Log.d(TAG, "app is null, delaying send");
      return;
    }

    ArrayList<PackageInstallInfo> updates = new ArrayList<PackageInstallInfo>();
    if ((newInfo != null) && (newInfo.state != STATUS_INSTALLED)) {
      updates.add(newInfo);
    }
    for (int i = mPendingReplays.size() - 1; i >= 0; i--) {
      SessionInfo session = mPendingReplays.valueAt(i);
      if (session.getAppPackageName() != null) {
        updates.add(
            new PackageInstallInfo(
                session.getAppPackageName(),
                STATUS_INSTALLING,
                (int) (session.getProgress() * 100)));
      }
    }
    mPendingReplays.clear();
    if (!updates.isEmpty()) {
      app.setPackageState(updates);
    }

    if (!mPendingBadgeUpdates.isEmpty()) {
      for (String pkg : mPendingBadgeUpdates) {
        app.updatePackageBadge(pkg);
      }
      mPendingBadgeUpdates.clear();
    }
  }
Ejemplo n.º 24
0
    private void repopulateUsers() {
      visibleUserList.clear();
      visibleUserNames.clear();
      for (int i = 0; i < users.size(); i++) {
        int key = users.keyAt(i);
        User user = users.get(key);
        if (user.getChannel().id == visibleChannel) {
          addVisibleUser(user);
        }
      }

      Collections.sort(visibleUserList, userComparator);

      if (visibleUsersChangedCallback != null) {
        visibleUsersChangedCallback.run();
      }

      super.notifyDataSetChanged();
    }
  /** Hides the keyguard view */
  public synchronized void hide() {
    if (DEBUG) Log.d(TAG, "hide() mKeyguardView=" + mKeyguardView);

    if (mKeyguardHost != null) {
      mKeyguardHost.setVisibility(View.GONE);

      /// M: reset the simpin show next view flag
      mShowNextViewAfterSimLock = false;

      // We really only want to preserve keyguard state for configuration changes. Hence
      // we should clear state of widgets (e.g. Music) when we hide keyguard so it can
      // start with a fresh state when we return.
      mStateContainer.clear();

      // Don't do this right away, so we can let the view continue to animate
      // as it goes away.
      if (mKeyguardView != null) {
        final KeyguardViewBase lastView = mKeyguardView;
        mKeyguardView = null;
        mKeyguardHost.postDelayed(
            new Runnable() {
              @Override
              public void run() {
                synchronized (KeyguardViewManager.this) {
                  if (DEBUG) Log.d(TAG, "hide() runnable lastView=" + lastView);
                  lastView.cleanUp();
                  // Let go of any large bitmaps.
                  mKeyguardHost.setCustomBackground(null);
                  updateShowWallpaper(true);
                  mKeyguardHost.removeView(lastView);
                  mViewMediatorCallback.keyguardGone();
                }
              }
            },
            HIDE_KEYGUARD_DELAY);
      }
    }
  }
  public void setSections(Section[] sections) {
    mSections.clear();

    Arrays.sort(
        sections,
        new Comparator<Section>() {
          @Override
          public int compare(Section o, Section o1) {
            return (o.firstPosition == o1.firstPosition)
                ? 0
                : ((o.firstPosition < o1.firstPosition) ? -1 : 1);
          }
        });

    int offset = 0; // offset positions for the headers we're adding
    for (Section section : sections) {
      section.sectionedPosition = section.firstPosition + offset;
      mSections.append(section.sectionedPosition, section);
      ++offset;
    }

    notifyDataSetChanged();
  }
Ejemplo n.º 27
0
  public static void init() {
    users.clear();
    fullInfoQuery.clear();

    self = addUser(TL.newObject("userEmpty", 0));
    contacts_hash = "";

    // update typing
    updater =
        new Updater(
            3 * 1000,
            new Runnable() {
              @Override
              public void run() {
                int time = Common.getUnixTime();
                for (int i = 0; i < User.users.size(); i++) {
                  User user = User.users.get(User.users.keyAt(i));
                  if (user.typing && user.typing_time < time)
                    user.setTyping(user.typing_chat_id, false);
                }
              }
            });
    updater.startUpdates();
  }
Ejemplo n.º 28
0
 /*
  * 加载答题卡数据(异步线程中被调用)
  * @see com.examw.test.ui.PaperActivity.PaperDataDelegate#loadAnswerCardData(java.util.List, android.util.SparseArray)
  */
 @Override
 public void loadAnswerCardData(
     List<AnswerCardSectionModel> cardSections,
     SparseArray<AnswerCardItemModel[]> cardSectionItems)
     throws Exception {
   Log.d(TAG, "加载答题卡数据[" + this.option + "]...");
   if (this.cardSections != null && this.cardItemsMap != null) {
     // 答题卡分组
     if (cardSections != null) {
       cardSections.clear();
       cardSections.addAll(this.cardSections);
     }
     // 分组试题数据
     if (cardSectionItems != null) {
       cardSectionItems.clear();
       // 循环
       for (int i = 0; i < this.cardItemsMap.size(); i++) {
         int key = this.cardItemsMap.keyAt(i);
         AnswerCardItemModel[] models = this.cardItemsMap.get(key);
         if (models != null && models.length > 0 && this.items != null) {
           for (int k = 0; k < models.length; k++) {
             if (this.items.size() > models[k].getOrder()) {
               PaperItemModel itemModel = this.items.get(models[k].getOrder());
               if (itemModel == null || StringUtils.isBlank(itemModel.getPaperRecordId())) {
                 continue;
               }
               models[k].status =
                   this.getDao().exitRecord(itemModel.getPaperRecordId(), itemModel);
             }
           }
         }
         cardSectionItems.put(key, models);
       }
     }
   }
 }
Ejemplo n.º 29
0
    public void recomputeBoundsLocked() {
      mWindowManager.getDefaultDisplay().getRealSize(mTempPoint);
      final int screenWidth = mTempPoint.x;
      final int screenHeight = mTempPoint.y;

      Region magnifiedBounds = mMagnifiedBounds;
      magnifiedBounds.set(0, 0, 0, 0);

      Region availableBounds = mTempRegion1;
      availableBounds.set(0, 0, screenWidth, screenHeight);

      Region nonMagnifiedBounds = mTempRegion4;
      nonMagnifiedBounds.set(0, 0, 0, 0);

      SparseArray<WindowStateInfo> visibleWindows = mTempWindowStateInfos;
      visibleWindows.clear();
      getWindowsOnScreenLocked(visibleWindows);

      final int visibleWindowCount = visibleWindows.size();
      for (int i = visibleWindowCount - 1; i >= 0; i--) {
        WindowStateInfo info = visibleWindows.valueAt(i);
        if (info.mWindowState.mAttrs.type
            == WindowManager.LayoutParams.TYPE_MAGNIFICATION_OVERLAY) {
          continue;
        }

        Region windowBounds = mTempRegion2;
        Matrix matrix = mTempMatrix;
        populateTransformationMatrix(info.mWindowState, matrix);
        RectF windowFrame = mTempRectF;

        if (mWindowManagerService.mPolicy.canMagnifyWindow(info.mWindowState.mAttrs.type)) {
          windowFrame.set(info.mWindowState.mFrame);
          windowFrame.offset(-windowFrame.left, -windowFrame.top);
          matrix.mapRect(windowFrame);
          windowBounds.set(
              (int) windowFrame.left,
              (int) windowFrame.top,
              (int) windowFrame.right,
              (int) windowFrame.bottom);
          magnifiedBounds.op(windowBounds, Region.Op.UNION);
          magnifiedBounds.op(availableBounds, Region.Op.INTERSECT);
        } else {
          windowFrame.set(info.mTouchableRegion);
          windowFrame.offset(-info.mWindowState.mFrame.left, -info.mWindowState.mFrame.top);
          matrix.mapRect(windowFrame);
          windowBounds.set(
              (int) windowFrame.left,
              (int) windowFrame.top,
              (int) windowFrame.right,
              (int) windowFrame.bottom);
          nonMagnifiedBounds.op(windowBounds, Region.Op.UNION);
          windowBounds.op(magnifiedBounds, Region.Op.DIFFERENCE);
          availableBounds.op(windowBounds, Region.Op.DIFFERENCE);
        }

        Region accountedBounds = mTempRegion2;
        accountedBounds.set(magnifiedBounds);
        accountedBounds.op(nonMagnifiedBounds, Region.Op.UNION);
        accountedBounds.op(0, 0, screenWidth, screenHeight, Region.Op.INTERSECT);

        if (accountedBounds.isRect()) {
          Rect accountedFrame = mTempRect1;
          accountedBounds.getBounds(accountedFrame);
          if (accountedFrame.width() == screenWidth && accountedFrame.height() == screenHeight) {
            break;
          }
        }
      }

      for (int i = visibleWindowCount - 1; i >= 0; i--) {
        WindowStateInfo info = visibleWindows.valueAt(i);
        info.recycle();
        visibleWindows.removeAt(i);
      }

      magnifiedBounds.op(
          mHalfBorderWidth,
          mHalfBorderWidth,
          screenWidth - mHalfBorderWidth,
          screenHeight - mHalfBorderWidth,
          Region.Op.INTERSECT);

      if (!mOldMagnifiedBounds.equals(magnifiedBounds)) {
        Region bounds = Region.obtain();
        bounds.set(magnifiedBounds);
        mHandler
            .obtainMessage(MyHandler.MESSAGE_NOTIFY_MAGNIFIED_BOUNDS_CHANGED, bounds)
            .sendToTarget();

        mWindow.setBounds(magnifiedBounds);
        Rect dirtyRect = mTempRect1;
        if (mFullRedrawNeeded) {
          mFullRedrawNeeded = false;
          dirtyRect.set(
              mHalfBorderWidth,
              mHalfBorderWidth,
              screenWidth - mHalfBorderWidth,
              screenHeight - mHalfBorderWidth);
          mWindow.invalidate(dirtyRect);
        } else {
          Region dirtyRegion = mTempRegion3;
          dirtyRegion.set(magnifiedBounds);
          dirtyRegion.op(mOldMagnifiedBounds, Region.Op.UNION);
          dirtyRegion.op(nonMagnifiedBounds, Region.Op.INTERSECT);
          dirtyRegion.getBounds(dirtyRect);
          mWindow.invalidate(dirtyRect);
        }

        mOldMagnifiedBounds.set(magnifiedBounds);
      }
    }
Ejemplo n.º 30
0
 @VisibleForTesting
 static void purgeAllEntriesForTesting(Context context) {
   SharedPreferences sharedPreferences = context.getSharedPreferences(PREFERENCES_NAME, 0);
   sharedPreferences.edit().clear().apply();
   if (sUidToThrottler != null) sUidToThrottler.clear();
 }