/** * Sets the sorter for ordering activities based on historical data and an intent. * * @param activitySorter The sorter. * * @see ActivitySorter */ public void setActivitySorter(ActivitySorter activitySorter) { synchronized (mInstanceLock) { if (mActivitySorter == activitySorter) { return; } mActivitySorter = activitySorter; sortActivities(); } }
/** * Sets the sorter for ordering activities based on historical data and an intent. * * @param activitySorter The sorter. * * @see ActivitySorter */ public void setActivitySorter(ActivitySorter activitySorter) { synchronized (mInstanceLock) { if (mActivitySorter == activitySorter) { return; } mActivitySorter = activitySorter; sortActivities(); } }
/** * Loads the activities. */ private void loadActivitiesLocked() { mActivites.clear(); if (mIntent != null) { List<ResolveInfo> resolveInfos = mContext.getPackageManager().queryIntentActivities(mIntent, 0); final int resolveInfoCount = resolveInfos.size(); for (int i = 0; i < resolveInfoCount; i++) { ResolveInfo resolveInfo = resolveInfos.get(i); mActivites.add(new ActivityResolveInfo(resolveInfo)); } sortActivities(); } else { notifyChanged(); } }
/** * Sets the maximal size of the historical data. Defaults to * {@link #DEFAULT_HISTORY_MAX_LENGTH} * <p> * <strong>Note:</strong> Setting this property will immediately * enforce the specified max history size by dropping enough old * historical records to enforce the desired size. Thus, any * records that exceed the history size will be discarded and * irreversibly lost. * </p> * * @param historyMaxSize The max history size. */ public void setHistoryMaxSize(int historyMaxSize) { synchronized (mInstanceLock) { if (mHistoryMaxSize == historyMaxSize) { return; } mHistoryMaxSize = historyMaxSize; pruneExcessiveHistoricalRecordsLocked(); sortActivities(); } }
/** * Sets the maximal size of the historical data. Defaults to * {@link #DEFAULT_HISTORY_MAX_LENGTH} * <p> * <strong>Note:</strong> Setting this property will immediately * enforce the specified max history size by dropping enough old * historical records to enforce the desired size. Thus, any * records that exceed the history size will be discarded and * irreversibly lost. * </p> * * @param historyMaxSize The max history size. */ public void setHistoryMaxSize(int historyMaxSize) { synchronized (mInstanceLock) { if (mHistoryMaxSize == historyMaxSize) { return; } mHistoryMaxSize = historyMaxSize; pruneExcessiveHistoricalRecordsLocked(); sortActivities(); } }
/** * Loads the activities. */ private void loadActivitiesLocked() { mActivites.clear(); if (mIntent != null) { List<ResolveInfo> resolveInfos = mContext.getPackageManager().queryIntentActivities(mIntent, 0); final int resolveInfoCount = resolveInfos.size(); for (int i = 0; i < resolveInfoCount; i++) { ResolveInfo resolveInfo = resolveInfos.get(i); mActivites.add(new ActivityResolveInfo(resolveInfo)); } sortActivities(); } else { notifyChanged(); } }
/** * Adds a historical record. * * @param historicalRecord The record to add. * @return True if the record was added. */ private boolean addHisoricalRecord(HistoricalRecord historicalRecord) { synchronized (mInstanceLock) { final boolean added = mHistoricalRecords.add(historicalRecord); if (added) { mHistoricalRecordsChanged = true; pruneExcessiveHistoricalRecordsLocked(); persistHistoricalData(); sortActivities(); } return added; } }
/** * Adds a historical record. * * @param historicalRecord The record to add. * @return True if the record was added. */ private boolean addHisoricalRecord(HistoricalRecord historicalRecord) { synchronized (mInstanceLock) { final boolean added = mHistoricalRecords.add(historicalRecord); if (added) { mHistoricalRecordsChanged = true; pruneExcessiveHistoricalRecordsLocked(); persistHistoricalData(); sortActivities(); } return added; } }