Java Code Examples for android.widget.ListView#setItemsCanFocus()
The following examples show how to use
android.widget.ListView#setItemsCanFocus() .
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: ConversationsListFragment.java From CSipSimple with GNU General Public License v3.0 | 6 votes |
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); // View management mDualPane = getResources().getBoolean(R.bool.use_dual_panes); // Modify list view ListView lv = getListView(); lv.setVerticalFadingEdgeEnabled(true); // lv.setCacheColorHint(android.R.color.transparent); if (mDualPane) { lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE); lv.setItemsCanFocus(false); } else { lv.setChoiceMode(ListView.CHOICE_MODE_NONE); lv.setItemsCanFocus(true); } }
Example 2
Source File: FavListFragment.java From CSipSimple with GNU General Public License v3.0 | 6 votes |
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); // View management mDualPane = getResources().getBoolean(R.bool.use_dual_panes); // Modify list view ListView lv = getListView(); lv.setVerticalFadingEdgeEnabled(true); // lv.setCacheColorHint(android.R.color.transparent); if (mDualPane) { lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE); lv.setItemsCanFocus(false); } else { lv.setChoiceMode(ListView.CHOICE_MODE_NONE); lv.setItemsCanFocus(true); } }
Example 3
Source File: MultiSelectQuizView.java From android-topeka with Apache License 2.0 | 6 votes |
@Override protected View createQuizContentView() { mListView = new ListView(getContext()); mListView.setAdapter( new OptionsQuizAdapter(getQuiz().getOptions(), android.R.layout.simple_list_item_multiple_choice)); mListView.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE); mListView.setItemsCanFocus(false); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { allowAnswer(); } }); return mListView; }
Example 4
Source File: RMBTMapFilterFragment.java From open-rmbt with Apache License 2.0 | 6 votes |
protected void populateList(List<ServerOption> optionList, boolean isRoot) { this.isRoot = isRoot; this.currentOptionList = optionList; final RMBTMainActivity activity = getRMBTMainActivity(); final SectionListAdapter sectionListAdapter = new SectionListAdapter(activity, R.layout.preferences_category, !isRoot); // add filter options if (optionList != null && optionList.size() > 0) { for (final ServerOption option : optionList) { if (option.isEnabled()) { if (option.getOptionList() != null && option.getOptionList().size() > 0 && !options.isAnyChildSelected(option)) { options.select(option.getOptionList().get(0)); } sectionListAdapter.addSection(option.getTitle(), new MapListSectionAdapter(activity, option, isRoot)); } } } final ListView listView = (ListView) view.findViewById(R.id.valueList); listView.setAdapter(sectionListAdapter); listView.setItemsCanFocus(true); listView.setOnItemClickListener(this); }
Example 5
Source File: PermissionsActivity.java From APDE with GNU General Public License v2.0 | 6 votes |
@Override public void onResume() { super.onResume(); final ListView permsList = (ListView) findViewById(R.id.permissions_list); permsList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); permsList.setItemsCanFocus(false); checked = new boolean[Manifest.permissions.size()]; for (int i = 0; i < checked.length; i ++) { checked[i] = false; } if (isPreviewSetttings) { loadDataPreviewSettings(); } else { loadData(); } adapter = new PermissionAdapter(); permsList.setAdapter(adapter); }
Example 6
Source File: InternalApisFragment.java From line-sdk-android with Apache License 2.0 | 5 votes |
private void selectReceivers(NextAction<List<String>> nextAction) { if (receivers.isEmpty()) { Toast.makeText(getContext(), "run GetGroups or GetFriends first", Toast.LENGTH_LONG).show(); return; } final AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setTitle("Select Friend/Group to send message"); final ListView listView = new ListView(getContext()); listView.setItemsCanFocus(false); listView.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE); final ArrayAdapter<Receiver> adapter = new ArrayAdapter<>(getContext(), layout.select_dialog_multichoice); adapter.addAll(receivers.getAll()); listView.setAdapter(adapter); builder.setNegativeButton(string.cancel, (dialog, which) -> dialog.dismiss()); builder.setPositiveButton( string.ok, (dialog, which) -> { final List<String> receiverIDs = getSelectedReceiverIDs(listView); if (receiverIDs.isEmpty()) { Toast.makeText(getContext(), "No Friend/Group selected", Toast.LENGTH_LONG).show(); } else { nextAction.run(receiverIDs); } } ); builder.setView(listView); builder.show(); }
Example 7
Source File: CallLogListFragment.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); // View management mDualPane = getResources().getBoolean(R.bool.use_dual_panes); // Modify list view ListView lv = getListView(); lv.setVerticalFadingEdgeEnabled(true); // lv.setCacheColorHint(android.R.color.transparent); if (mDualPane) { lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE); lv.setItemsCanFocus(false); } else { lv.setChoiceMode(ListView.CHOICE_MODE_NONE); lv.setItemsCanFocus(true); } // Map long press lv.setLongClickable(true); lv.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> ad, View v, int pos, long id) { turnOnActionMode(); getListView().setItemChecked(pos, true); mMode.invalidate(); return true; } }); }
Example 8
Source File: FaBoServiceListActivity.java From DeviceConnect-Android with MIT License | 5 votes |
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { setHasOptionsMenu(true); View root = inflater.inflate(R.layout.fragment_service_list_viewer, container, false); mListAdapter = new ServiceListAdapter(getActivity(), getProvider(), false); ListView listView = root.findViewById(R.id.activity_fabo_service_list_view); listView.setAdapter(mListAdapter); listView.setItemsCanFocus(true); listView.setClickable(true); listView.setOnItemClickListener((parent, view, position, id) -> { Object service = mListAdapter.getItem(position); if (service instanceof VirtualService) { openVirtualServiceActivity((VirtualService) service); } }); Button newServiceButton = root.findViewById(R.id.activity_fabo_service_add_btn); newServiceButton.setOnClickListener((v) -> { openVirtualServiceActivity(null); }); return root; }
Example 9
Source File: IRKitVirtualProfileListFragment.java From DeviceConnect-Android with MIT License | 5 votes |
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { mDBHelper = new IRKitDBHelper(getActivity()); mVirtualProfileAdapter = new VirtualProfileAdapter(getActivity(), createDeviceContainers()); View rootView = inflater.inflate(R.layout.fragment_profilelist, container, false); mListView = (ListView) rootView.findViewById(R.id.listview_devicelist); mListView.setItemsCanFocus(true); mListView.setAdapter(mVirtualProfileAdapter); return rootView; }
Example 10
Source File: ClearBrowsingDataPreferences.java From 365browser with Apache License 2.0 | 5 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // Now that the dialog's view has been created, update the button state. updateButtonState(); // Remove the dividers between checkboxes, and make sure the individual widgets can be // focused. ListView view = (ListView) getView().findViewById(android.R.id.list); view.setDivider(null); view.setItemsCanFocus(true); }
Example 11
Source File: SettingListDialog.java From Passbook with Apache License 2.0 | 5 votes |
@Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if(Application.getInstance() == null || Application.getInstance().getAccountManager() == null) { return null; } View rootView = inflater.inflate(R.layout.dialog_setting_list, container, false); ListView listView = rootView.findViewById(R.id.list); listView.setAdapter(mAdapter = new OptionAdapter()); ((TextView)rootView.findViewById(R.id.title)).setText(mTitle); listView.setOnItemClickListener(this); listView.setItemsCanFocus(true); return rootView; }
Example 12
Source File: List10.java From codeexamples-android with Eclipse Public License 1.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_single_choice, GENRES)); final ListView listView = getListView(); listView.setItemsCanFocus(false); listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); }
Example 13
Source File: List11.java From codeexamples-android with Eclipse Public License 1.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_multiple_choice, GENRES)); final ListView listView = getListView(); listView.setItemsCanFocus(false); listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); }
Example 14
Source File: SyncActivityTooManyDeletes.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle extras = getIntent().getExtras(); if (extras == null) { finish(); return; } mNumDeletes = extras.getLong("numDeletes"); mAccount = (Account) extras.getParcelable("account"); mAuthority = extras.getString("authority"); mProvider = extras.getString("provider"); // the order of these must match up with the constants for position used in onItemClick CharSequence[] options = new CharSequence[]{ getResources().getText(R.string.sync_really_delete), getResources().getText(R.string.sync_undo_deletes), getResources().getText(R.string.sync_do_nothing) }; ListAdapter adapter = new ArrayAdapter<CharSequence>(this, android.R.layout.simple_list_item_1, android.R.id.text1, options); ListView listView = new ListView(this); listView.setAdapter(adapter); listView.setItemsCanFocus(true); listView.setOnItemClickListener(this); TextView textView = new TextView(this); CharSequence tooManyDeletesDescFormat = getResources().getText(R.string.sync_too_many_deletes_desc); textView.setText(String.format(tooManyDeletesDescFormat.toString(), mNumDeletes, mProvider, mAccount.name)); final LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); final LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0); ll.addView(textView, lp); ll.addView(listView, lp); // TODO: consider displaying the icon of the account type // AuthenticatorDescription[] descs = AccountManager.get(this).getAuthenticatorTypes(); // for (AuthenticatorDescription desc : descs) { // if (desc.type.equals(mAccount.type)) { // try { // final Context authContext = createPackageContext(desc.packageName, 0); // ImageView imageView = new ImageView(this); // imageView.setImageDrawable(authContext.getDrawable(desc.iconId)); // ll.addView(imageView, lp); // } catch (PackageManager.NameNotFoundException e) { // } // break; // } // } setContentView(ll); }
Example 15
Source File: FaBoServiceListActivity.java From DeviceConnect-Android with MIT License | 4 votes |
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_service_list_remover, container, false); mListAdapter = new ServiceListAdapter(getActivity(), getProvider(), true); mListAdapter.setOnStatusChangeListener(this); ListView listView = root.findViewById(R.id.activity_fabo_service_list_view); listView.setAdapter(mListAdapter); listView.setItemsCanFocus(true); listView.setClickable(true); listView.setOnItemClickListener((parent, view, position, id) -> { Object service = mListAdapter.getItem(position); if (service instanceof VirtualService) { VirtualService vs = (VirtualService) service; if (vs.isOnline()) { showOnlineDialog(); } else { mListAdapter.toggleCheckBox((DConnectService) service); CheckBox checkBox = view.findViewById(R.id.activity_fabo_service_removal_checkbox); if (checkBox != null) { checkBox.toggle(); } } } else { showImmortalDialog(); } }); Button cancelButton = root.findViewById(R.id.activity_fabo_service_cancel_btn); cancelButton.setOnClickListener((v) -> { showViewerFragment(); }); mRemoveBtn = (Button) root.findViewById(R.id.activity_fabo_service_remove_btn); mRemoveBtn.setOnClickListener((v) -> { showRemovalConfirmation(); }); mRemoveBtn.setEnabled(false); return root; }