本文整理汇总了Java中android.widget.ListView.INVALID_POSITION属性的典型用法代码示例。如果您正苦于以下问题:Java ListView.INVALID_POSITION属性的具体用法?Java ListView.INVALID_POSITION怎么用?Java ListView.INVALID_POSITION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.widget.ListView
的用法示例。
在下文中一共展示了ListView.INVALID_POSITION属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCheckedChanged
@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());
}
}
}
示例2: selectionChanged
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);
}
}
示例3: onToggleFlag
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);
}
示例4: sectionedPositionToPosition
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;
}
示例5: resetCell
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;
}
}
示例6: onRestoreInstanceState
@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);
}
}
}
示例7: clearCheckedItem
public void clearCheckedItem() {
ListView lv = getListView();
int checkPosition = lv.getCheckedItemPosition();
if (checkPosition != ListView.INVALID_POSITION) {
lv.setItemChecked(checkPosition,false);
}
mSelectedItemId = 0;
}
示例8: onClickFrontView
/**
* Notifies onClickFrontView
*
* @param position item clicked
*/
protected void onClickFrontView(int position) {
if (swipeListViewListener != null && position != ListView.INVALID_POSITION) {
swipeListViewListener.onClickFrontView(position);
}
}
示例9: onClickBackView
/**
* Notifies onClickBackView
*
* @param position back item clicked
*/
protected void onClickBackView(int position) {
if (swipeListViewListener != null && position != ListView.INVALID_POSITION) {
swipeListViewListener.onClickBackView(position);
}
}
示例10: changeSwipeMode
protected int changeSwipeMode(int position) {
if (swipeListViewListener != null && position != ListView.INVALID_POSITION) {
return swipeListViewListener.onChangeSwipeMode(position);
}
return SWIPE_MODE_DEFAULT;
}
示例11: onKey
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;
}
示例12: onOpened
/**
* 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);
}
}
示例13: onStartOpen
/**
* 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);
}
}
示例14: onStartClose
/**
* 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);
}
}
示例15: onOpened
/**
* 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);
}
}