use of android.util.SparseIntArray in project FastAdapter by mikepenz.
the class FastAdapter method getExpanded.
//-------------------------
//-------------------------
//Expandable stuff
//-------------------------
//-------------------------
/**
* returns the expanded items this contains position and the count of items
* which are expanded by this position
*
* @return the expanded items
*/
public SparseIntArray getExpanded() {
if (mPositionBasedStateManagement) {
return mExpanded;
} else {
SparseIntArray expandedItems = new SparseIntArray();
Item item;
for (int i = 0, size = getItemCount(); i < size; i++) {
item = getItem(i);
if (item instanceof IExpandable && ((IExpandable) item).isExpanded()) {
expandedItems.put(i, ((IExpandable) item).getSubItems().size());
}
}
return expandedItems;
}
}
use of android.util.SparseIntArray in project qksms by moezbhatti.
the class ExifInterface method getTagDefinitionForTag.
protected int getTagDefinitionForTag(short tagId, short type, int count, int ifd) {
int[] defs = getTagDefinitionsForTagId(tagId);
if (defs == null) {
return TAG_NULL;
}
SparseIntArray infos = getTagInfo();
int ret = TAG_NULL;
for (int i : defs) {
int info = infos.get(i);
short def_type = getTypeFromInfo(info);
int def_count = getComponentCountFromInfo(info);
int[] def_ifds = getAllowedIfdsFromInfo(info);
boolean valid_ifd = false;
for (int j : def_ifds) {
if (j == ifd) {
valid_ifd = true;
break;
}
}
if (valid_ifd && type == def_type && (count == def_count || def_count == ExifTag.SIZE_UNDEFINED)) {
ret = i;
break;
}
}
return ret;
}
use of android.util.SparseIntArray in project qksms by moezbhatti.
the class ExifInterface method getTagDefinitionsForTagId.
protected int[] getTagDefinitionsForTagId(short tagId) {
int[] ifds = IfdData.getIfds();
int[] defs = new int[ifds.length];
int counter = 0;
SparseIntArray infos = getTagInfo();
for (int i : ifds) {
int def = defineTag(i, tagId);
if (infos.get(def) != DEFINITION_NULL) {
defs[counter++] = def;
}
}
if (counter == 0) {
return null;
}
return Arrays.copyOfRange(defs, 0, counter);
}
use of android.util.SparseIntArray in project qksms by moezbhatti.
the class ExifInterface method getTagInfo.
protected SparseIntArray getTagInfo() {
if (mTagInfo == null) {
mTagInfo = new SparseIntArray();
initTagInfo();
}
return mTagInfo;
}
use of android.util.SparseIntArray in project Android-ObservableScrollView by ksoichiro.
the class SavedStateTest method testListViewSavedState.
public void testListViewSavedState() throws Throwable {
Parcel parcel = Parcel.obtain();
ObservableListView.SavedState state1 = new ObservableListView.SavedState(AbsSavedState.EMPTY_STATE);
state1.prevFirstVisiblePosition = 1;
state1.prevFirstVisibleChildHeight = 2;
state1.prevScrolledChildrenHeight = 3;
state1.prevScrollY = 4;
state1.scrollY = 5;
state1.childrenHeights = new SparseIntArray();
state1.childrenHeights.put(0, 10);
state1.childrenHeights.put(1, 20);
state1.childrenHeights.put(2, 30);
state1.writeToParcel(parcel, 0);
parcel.setDataPosition(0);
ObservableListView.SavedState state2 = ObservableListView.SavedState.CREATOR.createFromParcel(parcel);
assertNotNull(state2);
assertEquals(state1.prevFirstVisiblePosition, state2.prevFirstVisiblePosition);
assertEquals(state1.prevFirstVisibleChildHeight, state2.prevFirstVisibleChildHeight);
assertEquals(state1.prevScrolledChildrenHeight, state2.prevScrolledChildrenHeight);
assertEquals(state1.prevScrollY, state2.prevScrollY);
assertEquals(state1.scrollY, state2.scrollY);
assertNotNull(state1.childrenHeights);
assertEquals(3, state1.childrenHeights.size());
assertEquals(10, state1.childrenHeights.get(0));
assertEquals(20, state1.childrenHeights.get(1));
assertEquals(30, state1.childrenHeights.get(2));
}
Aggregations