List of usage examples for android.widget AbsListView setMultiChoiceModeListener
public void setMultiChoiceModeListener(MultiChoiceModeListener listener)
From source file:it.gulch.linuxday.android.widgets.BookmarksMultiChoiceModeListener.java
public static void register(AbsListView listView, BookmarkManager bookmarkManager) { listView.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE_MODAL); BookmarksMultiChoiceModeListener listener = new BookmarksMultiChoiceModeListener(listView, bookmarkManager); listView.setMultiChoiceModeListener(listener); }
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 a 2 s . 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.gigathinking.simpleapplock.AppListFragment.java
@Override public void onStart() { super.onStart(); if (!noAds) { final AdView adView = (AdView) getActivity().findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().addTestDevice("YOUR DEVICE 1") .addTestDevice("YOUR DEVICE 2").build(); adView.loadAd(adRequest);//from w w w .j av a 2 s. c om adView.setAdListener(new AdListener() { @Override public void onAdLoaded() { LinearLayout ll = (LinearLayout) getActivity().findViewById(R.id.id_ll_app_list); ll.findViewById(R.id.adView).setVisibility(View.VISIBLE); } }); } else { (getActivity().findViewById(R.id.adView)).setVisibility(View.GONE); } interstitial = new InterstitialAd(getActivity()); interstitial.setAdUnitId("YOUR AD UNIT ID"); interstitial.setAdListener(new AdListener() { @Override public void onAdClosed() { super.onAdClosed(); mPrefs.edit().putInt("ad_count", (mPrefs.getInt("ad_count", 0) + 1)).commit(); } }); // Create ad request. AdRequest adRequestInterestial = new AdRequest.Builder().addTestDevice("YOUR DEVICE 1") .addTestDevice("YOUR DEVICE 2").build(); // Begin loading your interstitial. if (!noAds) { interstitial.loadAd(adRequestInterestial); } if (!mList.isEmpty()) { showInitialStart(false); } else { showInitialStart(true); } AbsListView listView = (AbsListView) getActivity().findViewById(R.id.lv_app_list); listView.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE_MODAL); listView.setMultiChoiceModeListener(this); mAdapter = new AppListAdapter(getActivity(), R.layout.layout_applist_item, mList); listView.setAdapter(mAdapter); listView.setOnItemClickListener(this); receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (isAdded()) { startActivityForResult(new Intent(context, AppPicker.class), 22); } } }; LocalBroadcastManager.getInstance(getActivity()).registerReceiver(receiver, new IntentFilter(AppLockApplication.LAUNCH_PICKER)); //Limit 5 interstitial ads per day. int today = Integer.parseInt(DateFormat.format("d", Calendar.getInstance()).toString()); if (mPrefs.getInt("today", 0) != today) { mPrefs.edit().putInt("ad_count", 0).commit(); mPrefs.edit().putInt("today", today).commit(); } }