use of android.util.SparseIntArray in project Android-ObservableScrollView by ksoichiro.
the class ObservableGridView method init.
private void init() {
mChildrenHeights = new SparseIntArray();
mHeaderViewInfos = new ArrayList<>();
mFooterViewInfos = new ArrayList<>();
super.setClipChildren(false);
super.setOnScrollListener(mScrollListener);
}
use of android.util.SparseIntArray in project Android-ObservableScrollView by ksoichiro.
the class ObservableRecyclerView method init.
private void init() {
mChildrenHeights = new SparseIntArray();
checkLibraryVersion();
}
use of android.util.SparseIntArray in project android_frameworks_base by ParanoidAndroid.
the class ContentService method dump.
@Override
protected synchronized void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
mContext.enforceCallingOrSelfPermission(Manifest.permission.DUMP, "caller doesn't have the DUMP permission");
// This makes it so that future permission checks will be in the context of this
// process rather than the caller's process. We will restore this before returning.
long identityToken = clearCallingIdentity();
try {
if (mSyncManager == null) {
pw.println("No SyncManager created! (Disk full?)");
} else {
mSyncManager.dump(fd, pw);
}
pw.println();
pw.println("Observer tree:");
synchronized (mRootNode) {
int[] counts = new int[2];
final SparseIntArray pidCounts = new SparseIntArray();
mRootNode.dumpLocked(fd, pw, args, "", " ", counts, pidCounts);
pw.println();
ArrayList<Integer> sorted = new ArrayList<Integer>();
for (int i = 0; i < pidCounts.size(); i++) {
sorted.add(pidCounts.keyAt(i));
}
Collections.sort(sorted, new Comparator<Integer>() {
@Override
public int compare(Integer lhs, Integer rhs) {
int lc = pidCounts.get(lhs);
int rc = pidCounts.get(rhs);
if (lc < rc) {
return 1;
} else if (lc > rc) {
return -1;
}
return 0;
}
});
for (int i = 0; i < sorted.size(); i++) {
int pid = sorted.get(i);
pw.print(" pid ");
pw.print(pid);
pw.print(": ");
pw.print(pidCounts.get(pid));
pw.println(" observers");
}
pw.println();
pw.print(" Total number of nodes: ");
pw.println(counts[0]);
pw.print(" Total number of observers: ");
pw.println(counts[1]);
}
} finally {
restoreCallingIdentity(identityToken);
}
}
use of android.util.SparseIntArray in project android_frameworks_base by ParanoidAndroid.
the class WindowAnimator method setAppLayoutChanges.
void setAppLayoutChanges(final AppWindowAnimator appAnimator, final int changes, String s) {
// Used to track which displays layout changes have been done.
SparseIntArray displays = new SparseIntArray();
WindowList windows = appAnimator.mAppToken.allAppWindows;
for (int i = windows.size() - 1; i >= 0; i--) {
final int displayId = windows.get(i).getDisplayId();
if (displays.indexOfKey(displayId) < 0) {
setPendingLayoutChanges(displayId, changes);
if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
mService.debugLayoutRepeats(s, getPendingLayoutChanges(displayId));
}
// Keep from processing this display again.
displays.put(displayId, changes);
}
}
}
use of android.util.SparseIntArray in project android_frameworks_base by ParanoidAndroid.
the class GsmAlphabet method countGsmSeptetsUsingTables.
/**
* Returns the count of 7-bit GSM alphabet characters needed
* to represent this string, using the specified 7-bit language table
* and extension table (0 for GSM default tables).
* @param s the Unicode string that will be encoded
* @param use7bitOnly allow using space in place of unencodable character if true,
* otherwise, return -1 if any characters are unencodable
* @param languageTable the 7 bit language table, or 0 for the default GSM alphabet
* @param languageShiftTable the 7 bit single shift language table, or 0 for the default
* GSM extension table
* @return the septet count for s using the specified language tables, or -1 if any
* characters are unencodable and use7bitOnly is false
*/
public static int countGsmSeptetsUsingTables(CharSequence s, boolean use7bitOnly, int languageTable, int languageShiftTable) {
int count = 0;
int sz = s.length();
SparseIntArray charToLanguageTable = sCharsToGsmTables[languageTable];
SparseIntArray charToShiftTable = sCharsToShiftTables[languageShiftTable];
for (int i = 0; i < sz; i++) {
char c = s.charAt(i);
if (c == GSM_EXTENDED_ESCAPE) {
Rlog.w(TAG, "countGsmSeptets() string contains Escape character, skipping.");
continue;
}
if (charToLanguageTable.get(c, -1) != -1) {
count++;
} else if (charToShiftTable.get(c, -1) != -1) {
// escape + shift table index
count += 2;
} else if (use7bitOnly) {
// encode as space
count++;
} else {
// caller must check for this case
return -1;
}
}
return count;
}
Aggregations