List of usage examples for android.widget AbsListView CHOICE_MODE_SINGLE
int CHOICE_MODE_SINGLE
To view the source code for android.widget AbsListView CHOICE_MODE_SINGLE.
Click Source Link
From source file:org.thaliproject.nativetest.app.fragments.PeerListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_peers, container, false); mModel = PeerAndConnectionModel.getInstance(); mContext = view.getContext();/* w w w.j ava 2 s . c o m*/ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { mIncomingConnectionIconNotConnected = getResources().getDrawable(R.drawable.ic_arrow_downward_gray_24dp, mContext.getTheme()); mIncomingConnectionIconConnected = getResources().getDrawable(R.drawable.ic_arrow_downward_blue_24dp, mContext.getTheme()); mIncomingConnectionIconDataFlowing = getResources().getDrawable(R.drawable.ic_arrow_downward_green_24dp, mContext.getTheme()); mOutgoingConnectionIconNotConnected = getResources().getDrawable(R.drawable.ic_arrow_upward_gray_24dp, mContext.getTheme()); mOutgoingConnectionIconConnected = getResources().getDrawable(R.drawable.ic_arrow_upward_blue_24dp, mContext.getTheme()); mOutgoingConnectionIconDataFlowing = getResources().getDrawable(R.drawable.ic_arrow_upward_green_24dp, mContext.getTheme()); } else { mIncomingConnectionIconNotConnected = ContextCompat.getDrawable(mContext, R.drawable.ic_arrow_downward_gray_24dp); mIncomingConnectionIconConnected = ContextCompat.getDrawable(mContext, R.drawable.ic_arrow_downward_blue_24dp); mIncomingConnectionIconDataFlowing = ContextCompat.getDrawable(mContext, R.drawable.ic_arrow_downward_green_24dp); mOutgoingConnectionIconNotConnected = ContextCompat.getDrawable(mContext, R.drawable.ic_arrow_upward_gray_24dp); mOutgoingConnectionIconConnected = ContextCompat.getDrawable(mContext, R.drawable.ic_arrow_upward_blue_24dp); mOutgoingConnectionIconDataFlowing = ContextCompat.getDrawable(mContext, R.drawable.ic_arrow_upward_green_24dp); } mainThreadHandler = new Handler(mContext.getMainLooper()); peersTopInfoLayout = (LinearLayout) view.findViewById(R.id.peersTopInfoLayout); peersTopInfo0 = (TextView) view.findViewById(R.id.peersTopInfo0); peersTopInfo1 = (TextView) view.findViewById(R.id.peersTopInfo1); mPeerListAdapter = new PeersListAdapter(mContext); mListView = (ListView) view.findViewById(R.id.listView); mListView.setAdapter(mPeerListAdapter); mListView.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE); registerForContextMenu(mListView); setListener(mListener); mModel.setListener(this); showTopMessagInfo(); return view; }
From source file:com.nbossard.packlist.gui.TripListFragment.java
/** * Populate list with data in {@link ISavingModule}. *//*from w ww . j a v a2s. c o m*/ @SuppressWarnings("WeakerAccess") public final void populateList() { mTripListView = (ListView) mRootView.findViewById(R.id.main__trip_list); List<Trip> tripList; tripList = mSavingModule.loadSavedTrips(); TripAdapter tripAdapter = new TripAdapter(tripList, this.getActivity()); mTripListView.setEmptyView(mRootView.findViewById(R.id.main__trip_list_empty)); mTripListView.setAdapter(tripAdapter); mTripListView.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE); mTripListView.setOnItemClickListener(mClickListener); mTripListView.setOnItemLongClickListener(mLongClickListener); mTripListView.invalidate(); }
From source file:us.rader.tapset.ItemListFragment.java
/** * @param activateOnItemClick//w w w . j a v a 2 s. c o m * value indicating whether or not an item should be activated * automatically when it is clicked Turns on activate-on-click * mode. When this mode is on, list items will be given the * 'activated' state when touched. */ public void setActivateOnItemClick(boolean activateOnItemClick) { // When setting CHOICE_MODE_SINGLE, ListView will automatically // give items the 'activated' state when touched. getListView() .setChoiceMode(activateOnItemClick ? AbsListView.CHOICE_MODE_SINGLE : AbsListView.CHOICE_MODE_NONE); }
From source file:com.h6ah4i.android.example.openslmediaplayer.app.NavigationDrawerFragment.java
private void setupModeSelectListView() { mModeSelectListView = (ListView) mContainerGroupLayout.findViewById(R.id.list_mode_selection); ModeSelectListAdapter.ListItem[] listItems; final int curPlayerImplType = getAppController().getPlayerStateStore().getPlayerImplType(); final int selectedIndex = playerImplTypeToModeListIndex(curPlayerImplType); listItems = new ModeSelectListAdapter.ListItem[] { makeModeSelectListItem(R.string.mediaplayer_impl_standard), makeModeSelectListItem(R.string.mediaplayer_impl_opensl), makeModeSelectListItem(R.string.mediaplayer_impl_hybrid), }; mModeSelectAdapter = new ModeSelectListAdapter(getActionBar().getThemedContext(), listItems); mModeSelectListView.setAdapter(mModeSelectAdapter); mModeSelectListView.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE); mModeSelectListView.setItemChecked(selectedIndex, true); mModeSelectListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override/*from w ww .j a va2 s . c o m*/ public void onItemClick(AdapterView<?> parent, View view, int position, long id) { onModeSelectLiteItemClick(position); } }); }
From source file:net.lp.actionbarpoirot.helpers.FragmentHelperHoneycomb.java
protected void configureViewGroupContextMenu(AbsListView viewGroup, boolean multiChoiceMode) { mAdapter = viewGroup;/*from w w w . j a v a2s. c o m*/ viewGroup.setOnItemLongClickListener(this); if (multiChoiceMode) { ensureMultiChoiceModeUser(); viewGroup.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE_MODAL); viewGroup.setMultiChoiceModeListener(this); } else { viewGroup.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE); } }
From source file:com.rsegismont.androlife.programlist.FragmentListProgrammes.java
public void onViewCreated(View paramView, Bundle paramBundle) { super.onViewCreated(paramView, paramBundle); getListView().setOnItemClickListener(this); if (SdkUtils.isTabletLandscape(getActivity())) { getListView().setChoiceMode(AbsListView.CHOICE_MODE_SINGLE); } else {/*from w w w . ja v a 2s. co m*/ getListView().setChoiceMode(AbsListView.CHOICE_MODE_NONE); } getListView().setDividerHeight(0); getListView().setOnScrollListener(new OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { if (scrollState == SCROLL_STATE_FLING) getAndrolifeActivity().getImageDownloader().setPauseWork(true); else { getAndrolifeActivity().getImageDownloader().setPauseWork(false); } } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { } }); getListView().setCacheColorHint(getResources().getColor(R.color.background)); }
From source file:ua.com.spacetv.mycookbook.dialogs.FragDialog.java
private void initAllViewsInDialog() { adb = new AlertDialog.Builder(getActivity()); input = new EditText(getActivity()); listView = new ListView(getActivity()); textView = new TextView(getActivity()); int paddingH = (int) getResources().getDimension(R.dimen.dialog_padding_left_right); int paddingV = (int) getResources().getDimension(R.dimen.dialog_padding_up_down); int textColor; if (Build.VERSION.SDK_INT >= 21) { //Getting color from current theme TypedValue typedValue = new TypedValue(); mContext.getTheme().resolveAttribute(android.R.attr.colorPrimary, typedValue, true); int barColor = typedValue.data; textView.setBackgroundColor(barColor); textColor = ContextCompat.getColor(mContext, R.color.colorWhite); } else {// w ww. j ava2 s. com textColor = ContextCompat.getColor(mContext, R.color.colorBlack); } if (Build.VERSION.SDK_INT < 23) { textView.setTextAppearance(mContext, android.R.style.TextAppearance_Large); } else { textView.setTextAppearance(android.R.style.TextAppearance_Large); } textView.setTextColor(textColor); textView.setGravity(Gravity.CENTER_HORIZONTAL); textView.setPadding(paddingH, paddingV, paddingH, paddingV); input.setPadding(paddingH, paddingV, paddingH, paddingV); listView.setSelected(true); listView.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE); listView.setSelector(R.drawable.list_color_selector); listView.setOnItemClickListener(this); listView.requestFocus(); }
From source file:de.geeksfactory.opacclient.frontend.StarredFragment.java
/** * Turns on activate-on-click mode. When this mode is on, list items will be given the * 'activated' state when touched.//w ww.j av a 2 s . c om */ private void setActivateOnItemClick(boolean activateOnItemClick) { // When setting CHOICE_MODE_SINGLE, ListView will automatically // give items the 'activated' state when touched. listView.setChoiceMode(activateOnItemClick ? AbsListView.CHOICE_MODE_SINGLE : AbsListView.CHOICE_MODE_NONE); }
From source file:com.nbossard.packlist.gui.TripDetailFragment.java
/** * Populate list with data in {@link ISavingModule}. *//* w w w. j a v a2s .c o m*/ private void populateList() { mItemListView = (ListView) mRootView.findViewById(R.id.trip_detail__list); mItemListView.setEmptyView(mRootView.findViewById(R.id.trip_detail__list_empty)); ItemAdapter itemAdapter = new ItemAdapter(mRetrievedTrip.getListItem(), this.getActivity()); mItemListView.setAdapter(itemAdapter); mItemListView.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE); mItemListView.setOnItemClickListener(mItemClickListener); mItemListView.setOnItemLongClickListener(mLongClickListener); mItemListView.invalidate(); }
From source file:com.hangulo.powercontact.ContactsListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // Set up ListView, assign adapter and set some listeners. The adapter was previously // created in onCreate(). setListAdapter(mAdapter);// w ww . jav a 2s . c om getListView().setOnItemClickListener(this); getListView().setChoiceMode(AbsListView.CHOICE_MODE_SINGLE); }