Java Code Examples for android.widget.ListView.INVALID_POSITION

The following are Jave code examples for showing how to use INVALID_POSITION of the android.widget.ListView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Trackr   File: PermissionManagerActivity.java   View Source Code Vote up 6 votes
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    int pos = listView_friend_list.getPositionForView(buttonView);
    if(pos != ListView.INVALID_POSITION) {
        FriendList friendListBackup = friendLists.get(pos);
        Log.d("STATUS CHANGED", String.valueOf(friendListBackup.getPermissionStatus()));
        if(friendListBackup.getPermissionStatus() == 1) {
            friendListBackup.setPermissionStatus(1);
            Log.d("STATUS CHANGED", String.valueOf(friendListBackup.getPermissionStatus()) + " " + friendListBackup.getName());

        } else {
            friendListBackup.setPermissionStatus(0);
            Log.d("STATUS CHANGED", String.valueOf(friendListBackup.getPermissionStatus()) + " " + friendListBackup.getName());

        }
    }
}
 
Example 2
Project: CSipSimple   File: IcsAdapterView.java   View Source Code Vote up 6 votes
void selectionChanged() {
    if (mOnItemSelectedListener != null) {
        if (mInLayout || mBlockLayoutRequests) {
            // If we are in a layout traversal, defer notification
            // by posting. This ensures that the view tree is
            // in a consistent state and is able to accomodate
            // new layout or invalidate requests.
            if (mSelectionNotifier == null) {
                mSelectionNotifier = new SelectionNotifier();
            }
            post(mSelectionNotifier);
        } else {
            fireOnSelected();
        }
    }

    // we fire selection events here not in View
    if (mSelectedPosition != ListView.INVALID_POSITION && isShown() && !isInTouchMode()) {
        sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
    }
}
 
Example 3
Project: q-mail   File: MessageListFragment.java   View Source Code Vote up 5 votes
private void onToggleFlag(Flag flag, int flagColumn) {
    int adapterPosition = getAdapterPositionForSelectedMessage();
    if (adapterPosition == ListView.INVALID_POSITION) {
        return;
    }

    Cursor cursor = (Cursor) adapter.getItem(adapterPosition);
    boolean flagState = (cursor.getInt(flagColumn) == 1);
    setFlag(adapterPosition, flag, !flagState);
}
 
Example 4
Project: iosched-reader   File: SimpleSectionedListAdapter.java   View Source Code Vote up 5 votes
public int sectionedPositionToPosition(int sectionedPosition) {
    if (isSectionHeaderPosition(sectionedPosition)) {
        return ListView.INVALID_POSITION;
    }

    int offset = 0;
    for (int i = 0; i < mSections.size(); i++) {
        if (mSections.valueAt(i).sectionedPosition > sectionedPosition) {
            break;
        }
        --offset;
    }
    return sectionedPosition + offset;
}
 
Example 5
Project: youkes_browser   File: SwipeListViewTouchListener.java   View Source Code Vote up 5 votes
private void resetCell() {
    if (downPosition != ListView.INVALID_POSITION) {
        if (swipeCurrentAction == SwipeListView.SWIPE_ACTION_CHOICE) {
            backView.setVisibility(View.VISIBLE);
        }
        frontView.setClickable(opened.get(downPosition));
        frontView.setLongClickable(opened.get(downPosition));
        frontView = null;
        backView = null;
        downPosition = ListView.INVALID_POSITION;
    }
}
 
Example 6
Project: TPlayer   File: ResolverActivity.java   View Source Code Vote up 5 votes
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    if (mAlwaysUseOption) {
        final int checkedPos = mListView.getCheckedItemPosition();
        final boolean enabled = checkedPos != ListView.INVALID_POSITION;
        mLastSelected = checkedPos;
        mAlwaysButton.setEnabled(enabled);
        mOnceButton.setEnabled(enabled);
        if (enabled) {
            mListView.setSelection(checkedPos);
        }
    }
}
 
Example 7
Project: aos-Video   File: BrowserCategory.java   View Source Code Vote up 5 votes
public void clearCheckedItem() {
    ListView lv = getListView();
    int checkPosition = lv.getCheckedItemPosition();
    if (checkPosition != ListView.INVALID_POSITION) {
        lv.setItemChecked(checkPosition,false);
    }
    mSelectedItemId = 0;
}
 
Example 8
Project: GitHub   File: SwipeListView.java   View Source Code Vote up 4 votes
/**
 * Notifies onClickFrontView
 *
 * @param position item clicked
 */
protected void onClickFrontView(int position) {
    if (swipeListViewListener != null && position != ListView.INVALID_POSITION) {
        swipeListViewListener.onClickFrontView(position);
    }
}
 
Example 9
Project: GitHub   File: SwipeListView.java   View Source Code Vote up 4 votes
/**
 * Notifies onClickBackView
 *
 * @param position back item clicked
 */
protected void onClickBackView(int position) {
    if (swipeListViewListener != null && position != ListView.INVALID_POSITION) {
        swipeListViewListener.onClickBackView(position);
    }
}
 
Example 10
Project: youkes_browser   File: SwipeListView.java   View Source Code Vote up 4 votes
protected int changeSwipeMode(int position) {
    if (swipeListViewListener != null && position != ListView.INVALID_POSITION) {
        return swipeListViewListener.onChangeSwipeMode(position);
    }
    return SWIPE_MODE_DEFAULT;
}
 
Example 11
Project: CSipSimple   File: SearchView.java   View Source Code Vote up 4 votes
public boolean onKey(View v, int keyCode, KeyEvent event) {
    // guard against possible race conditions
    if (mSearchable == null) {
        return false;
    }

    if (DBG) {
        Log.d(LOG_TAG, "mTextListener.onKey(" + keyCode + "," + event + "), selection: "
                + mQueryTextView.getListSelection());
    }

    // If a suggestion is selected, handle enter, search key, and action keys
    // as presses on the selected suggestion
    if (mQueryTextView.isPopupShowing()
            && mQueryTextView.getListSelection() != ListView.INVALID_POSITION) {
        return onSuggestionsKey(v, keyCode, event);
    }

    // If there is text in the query box, handle enter, and action keys
    // The search key is handled by the dialog's onKeyDown().
    if (!mQueryTextView.isEmpty() && KeyEventCompat.hasNoModifiers(event)) {
        if (event.getAction() == KeyEvent.ACTION_UP) {
            if (keyCode == KeyEvent.KEYCODE_ENTER) {
                v.cancelLongPress();

                // Launch as a regular search.
                launchQuerySearch(KeyEvent.KEYCODE_UNKNOWN, null, mQueryTextView.getText()
                        .toString());
                return true;
            }
        }
        if (event.getAction() == KeyEvent.ACTION_DOWN) {
            // TODO SearchableInfo.ActionKeyInfo actionKey = mSearchable.findActionKey(keyCode);
            // TODO if ((actionKey != null) && (actionKey.getQueryActionMsg() != null)) {
            // TODO     launchQuerySearch(keyCode, actionKey.getQueryActionMsg(), mQueryTextView
            // TODO             .getText().toString());
            // TODO     return true;
            // TODO }
        }
    }
    return false;
}
 
Example 12
Project: youkes_browser   File: SwipeListView.java   View Source Code Vote up 2 votes
/**
 * Notifies onOpened
 *
 * @param position Item opened
 * @param toRight If should be opened toward the right
 */
protected void onOpened(int position, boolean toRight) {
    if (swipeListViewListener != null && position != ListView.INVALID_POSITION) {
        swipeListViewListener.onOpened(position, toRight);
    }
}
 
Example 13
Project: GitHub   File: SwipeListView.java   View Source Code Vote up 2 votes
/**
 * Start open item
 *
 * @param position list item
 * @param action   current action
 * @param right    to right
 */
protected void onStartOpen(int position, int action, boolean right) {
    if (swipeListViewListener != null && position != ListView.INVALID_POSITION) {
        swipeListViewListener.onStartOpen(position, action, right);
    }
}
 
Example 14
Project: GitHub   File: SwipeListView.java   View Source Code Vote up 2 votes
/**
 * Start close item
 *
 * @param position list item
 * @param right    na
 */
protected void onStartClose(int position, boolean right) {
    if (swipeListViewListener != null && position != ListView.INVALID_POSITION) {
        swipeListViewListener.onStartClose(position, right);
    }
}
 
Example 15
Project: GitHub   File: SwipeListView.java   View Source Code Vote up 2 votes
/**
 * Notifies onOpened
 *
 * @param position Item opened
 * @param toRight  If should be opened toward the right
 */
protected void onOpened(int position, boolean toRight) {
    if (swipeListViewListener != null && position != ListView.INVALID_POSITION) {
        swipeListViewListener.onOpened(position, toRight);
    }
}
 
Example 16
Project: browser   File: SwipeListView.java   View Source Code Vote up 2 votes
/**
 * Notifies onOpened
 *
 * @param position Item opened
 * @param toRight If should be opened toward the right
 */
protected void onOpened(int position, boolean toRight) {
    if (swipeListViewListener != null && position != ListView.INVALID_POSITION) {
        swipeListViewListener.onOpened(position, toRight);
    }
}
 
Example 17
Project: youkes_browser   File: SwipeListView.java   View Source Code Vote up 2 votes
/**
 * Notifies onChoiceChanged
 *
 * @param position position that choice
 * @param selected if item is selected or not
 */
protected void onChoiceChanged(int position, boolean selected) {
    if (swipeListViewListener != null && position != ListView.INVALID_POSITION) {
        swipeListViewListener.onChoiceChanged(position, selected);
    }
}
 
Example 18
Project: youkes_browser   File: SwipeListView.java   View Source Code Vote up 2 votes
/**
 * Start close item
 *
 * @param position list item
 * @param right
 */
protected void onStartClose(int position, boolean right) {
    if (swipeListViewListener != null && position != ListView.INVALID_POSITION) {
        swipeListViewListener.onStartClose(position, right);
    }
}
 
Example 19
Project: browser   File: SwipeListView.java   View Source Code Vote up 2 votes
/**
 * Notifies onMove
 *
 * @param position Item moving
 * @param x Current position
 */
protected void onMove(int position, float x) {
    if (swipeListViewListener != null && position != ListView.INVALID_POSITION) {
        swipeListViewListener.onMove(position, x);
    }
}
 
Example 20
Project: browser   File: SwipeListView.java   View Source Code Vote up 2 votes
/**
 * Start close item
 *
 * @param position list item
 * @param right
 */
protected void onStartClose(int position, boolean right) {
    if (swipeListViewListener != null && position != ListView.INVALID_POSITION) {
        swipeListViewListener.onStartClose(position, right);
    }
}