Java Code Examples for android.widget.listview#INVALID_POSITION

The following examples show how to use android.widget.listview#INVALID_POSITION . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From android-discourse with Apache License 2.0 6 votes vote down vote up
protected void siteChanged(RadioGroup group, int checkedId) {
    if (checkedId == -1) {
        return;
    }
    RadioButton button = (RadioButton) group.findViewById(checkedId);
    Site site = (Site) button.getTag();
    if (site != null) {
        App.setSiteUrl(site.getUrl());
    }
    if (site == null) {
        group.clearCheck();
        openSettingsActivity();
    } else if (!site.getUrl().equals(mCurrentSiteUrl)) { // TODO 第一次启动 加载上次查看的url。
        mDrawerPosition = ListView.INVALID_POSITION;
        mCurrentSite = site;
        mCurrentSiteUrl = site.getUrl();
        PrefsUtils.setCurrentSiteUrl(mCurrentSiteUrl);
        App.setLogin(false);
        clearDatabase();
        // 登陆完成后,再加载其他信息
        loadUserInfo(site, false);
    } else {
        setupUserInfo(mUser);
    }
    getActionBar().setSubtitle(mCurrentSiteUrl);
}
 
Example 2
Source File: MainActivityFragment.java    From BuildmLearn-Toolkit-Android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
    infoListAdapter.swapCursor(cursor);
    if (mPosition != ListView.INVALID_POSITION) {
        listView.smoothScrollToPosition(mPosition);
    }
    try {
        TextView info = (TextView) rootView.findViewById(R.id.empty);
        if (infoListAdapter.getCount() == 0) {
            info.setText(R.string.list_empty_info);
            info.setVisibility(View.VISIBLE);
        } else {
            info.setVisibility(View.GONE);
        }
    } catch (Exception ignored) {
    }
}
 
Example 3
Source File: AnimationListFragment.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public void onSaveInstanceState(Bundle outState) {
	super.onSaveInstanceState(outState);
	if (mActivatedPosition != ListView.INVALID_POSITION) {
		// Serialize and persist the activated item position.
		outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
	}
}
 
Example 4
Source File: BrowserWeiboMsgCommentAndRepostAdapter.java    From iBeebo with GNU General Public License v3.0 5 votes vote down vote up
private ViewHolder getViewHolderByView(View view) {
    try {
        final int position = listView.getPositionForView(view);
        if (position == ListView.INVALID_POSITION) {
            return null;
        }
        return getViewHolderByView(position);
    } catch (NullPointerException e) {

    }
    return null;
}
 
Example 5
Source File: MainActivityFragment.java    From BuildmLearn-Toolkit-Android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onSaveInstanceState(Bundle outState) {
    outState.putParcelableArrayList("infoList", infoList);
    if (mPosition != ListView.INVALID_POSITION) {
        outState.putInt(SELECTED_KEY, mPosition);
    }
    super.onSaveInstanceState(outState);
}
 
Example 6
Source File: AnimationListFragment.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
private void setActivatedPosition(int position) {
	if (position == ListView.INVALID_POSITION) {
		getListView().setItemChecked(mActivatedPosition, false);
	} else {
		getListView().setItemChecked(position, true);
	}

	mActivatedPosition = position;
}
 
Example 7
Source File: ViewListFragment.java    From pixate-freestyle-android with Apache License 2.0 5 votes vote down vote up
private void setActivatedPosition(int position) {
    if (position == ListView.INVALID_POSITION) {
        getListView().setItemChecked(mActivatedPosition, false);
    } else {
        getListView().setItemChecked(position, true);
    }

    mActivatedPosition = position;
}
 
Example 8
Source File: MainFragment.java    From restcomm-android-sdk with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void onSaveInstanceState(Bundle outState)
{
   super.onSaveInstanceState(outState);
   if (mActivatedPosition != ListView.INVALID_POSITION) {
      // Serialize and persist the activated item position.
      outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
   }
}
 
Example 9
Source File: GuiaRestaurantes.java    From android with GNU General Public License v2.0 5 votes vote down vote up
public void onItemClick(AdapterView<?> arg0, View view, int posicion, long id) {

        if (posicion == ListView.INVALID_POSITION)
            return;

        Restaurante restaurante = listaRestaurantes.get(posicion);

        Intent i = new Intent(this, Mapa.class);
        i.putExtra("latitud", restaurante.getLatitud());
        i.putExtra("longitud", restaurante.getLongitud());
        i.putExtra("nombre", restaurante.getNombre());
        startActivity(i);

    }
 
Example 10
Source File: ClimbSessionListFragment.java    From climb-tracker with Apache License 2.0 5 votes vote down vote up
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (mActivatedPosition != ListView.INVALID_POSITION) {
        // Serialize and persist the activated item position.
        outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
    }
}
 
Example 11
Source File: WebsiteListFragment.java    From Gazetti_Newspaper_Reader with MIT License 5 votes vote down vote up
private void setActivatedPosition(int position) {
    // //Log.d(TAG, "ListFragment  SETACTIVATED");
    if (position == ListView.INVALID_POSITION) {
        mListView.setItemChecked(mActivatedPosition, false);
    } else {
        mListView.setItemChecked(position, true);
    }
    mActivatedPosition = position;
}
 
Example 12
Source File: ResolverActivity.java    From container with GNU General Public License v3.0 5 votes vote down vote up
@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 13
Source File: ArticleInfoListFragment.java    From travelguide with Apache License 2.0 5 votes vote down vote up
@Override
public void onSaveInstanceState(Bundle outState)
{
  super.onSaveInstanceState(outState);
  if (mActivatedPosition != ListView.INVALID_POSITION)
    outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
}
 
Example 14
Source File: ListadoRestaurantes.java    From android with GNU General Public License v2.0 5 votes vote down vote up
public void onItemClick(AdapterView<?> arg0, View view, int posicion, long id) {
	
	if (posicion == ListView.INVALID_POSITION)
		return;
	
	Restaurante restaurante = listaRestaurantes.get(posicion);
	
	Intent i = new Intent(this, Mapa.class);
	i.putExtra("latitud", restaurante.getLatitud());
	i.putExtra("longitud", restaurante.getLongitud());
	i.putExtra("nombre", restaurante.getNombre());
	startActivity(i);
	
}
 
Example 15
Source File: SnippetListFragment.java    From Android-REST-API-Explorer with MIT License 5 votes vote down vote up
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (mActivatedPosition != ListView.INVALID_POSITION) {
        // Serialize and persist the activated item position.
        outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
    }
}
 
Example 16
Source File: SwipeDismissList.java    From endpoints-codelab-android with GNU General Public License v3.0 5 votes vote down vote up
private void resetSwipeState() {
	if (mVelocityTracker != null) {
		mVelocityTracker.recycle();
	}
	mVelocityTracker = null;
	mDownX = 0;
	mDownY = 0;
	mDownView = null;
	mDownPosition = ListView.INVALID_POSITION;
	mSwiping = false;
}
 
Example 17
Source File: SnippetListFragment.java    From Android-REST-API-Explorer with MIT License 5 votes vote down vote up
private void setActivatedPosition(int position) {
    if (position == ListView.INVALID_POSITION) {
        getListView().setItemChecked(mActivatedPosition, false);
    } else {
        getListView().setItemChecked(position, true);
    }

    mActivatedPosition = position;
}
 
Example 18
Source File: SwipeListView.java    From UltimateRecyclerView with Apache License 2.0 4 votes vote down vote up
protected int changeSwipeMode(int position) {
    if (swipeListViewListener != null && position != ListView.INVALID_POSITION) {
        return swipeListViewListener.onChangeSwipeMode(position);
    }
    return SWIPE_MODE_DEFAULT;
}
 
Example 19
Source File: SwipeListView.java    From UltimateRecyclerView with Apache License 2.0 4 votes vote down vote up
/**
 * Notifies onClickBackView
 *
 * @param position back item clicked
 */
protected void onClickBackView(int position) {
    if (swipeListViewListener != null && position != ListView.INVALID_POSITION) {
        swipeListViewListener.onClickBackView(position);
    }
}
 
Example 20
Source File: SwipeListView.java    From UltimateRecyclerView with Apache License 2.0 2 votes vote down vote up
/**
 * 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);
    }
}