Search in sources :

Example 1 with SparseIntArray

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;
    }
}
Also used : SparseIntArray(android.util.SparseIntArray)

Example 2 with SparseIntArray

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;
}
Also used : SparseIntArray(android.util.SparseIntArray)

Example 3 with SparseIntArray

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);
}
Also used : SparseIntArray(android.util.SparseIntArray)

Example 4 with SparseIntArray

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;
}
Also used : SparseIntArray(android.util.SparseIntArray)

Example 5 with SparseIntArray

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));
}
Also used : AbsSavedState(android.view.AbsSavedState) SparseIntArray(android.util.SparseIntArray) Parcel(android.os.Parcel)

Aggregations

SparseIntArray (android.util.SparseIntArray)367 RemoteException (android.os.RemoteException)40 Test (org.junit.Test)35 ArrayList (java.util.ArrayList)32 HashMap (java.util.HashMap)22 Context (android.content.Context)19 IAppOpsCallback (com.android.internal.app.IAppOpsCallback)15 SparseArray (android.util.SparseArray)13 IOException (java.io.IOException)13 HistoryItem (android.os.BatteryStats.HistoryItem)12 UsageView (com.android.settings.graph.UsageView)12 Point (android.graphics.Point)11 Map (java.util.Map)11 UserInfo (android.content.pm.UserInfo)10 Paint (android.graphics.Paint)10 ArraySet (android.util.ArraySet)10 HashSet (java.util.HashSet)9 Cursor (android.database.Cursor)8 NetworkStatsHistory (android.net.NetworkStatsHistory)7 SparseBooleanArray (android.util.SparseBooleanArray)7