Example usage for android.widget ListView setItemsCanFocus

List of usage examples for android.widget ListView setItemsCanFocus

Introduction

In this page you can find the example usage for android.widget ListView setItemsCanFocus.

Prototype

public void setItemsCanFocus(boolean itemsCanFocus) 

Source Link

Document

Indicates that the views created by the ListAdapter can contain focusable items.

Usage

From source file:com.z299studio.pb.SettingListDialog.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (Application.getInstance() == null || Application.getInstance().getAccountManager() == null) {
        return null;
    }//from w  w w .  j ava  2 s  .c om
    View rootView = inflater.inflate(R.layout.dialog_setting_list, container, false);
    ListView 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;
}

From source file:at.alladin.rmbt.android.map.RMBTMapFilterFragment.java

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));
                }/*from w  w  w  . jav  a 2  s  .  c  o m*/
                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);
}

From source file:br.com.PartoHumanizado.fragment.base.ResStringArrayListFragment.java

private void updateListView() {
    ListView listView = getListView();
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(listView.getContext(), R.layout.item_plano_de_parto,
            android.R.id.text1, stringArray);
    listView.setAdapter(adapter);/*  www . ja v  a 2 s  . c o  m*/
    listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    listView.setItemsCanFocus(false);
}

From source file:com.psu.capstonew17.pdxaslapp.CreateEditDeckActivity.java

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_create_edit_deck);
    Button subButton = (Button) findViewById(R.id.bttn_submit);
    subButton.setOnClickListener(this);
    textBox = (EditText) findViewById(R.id.deckNameField);
    deckManager = ExternalDeckManager.getInstance(this);
    allCards = deckManager.getDefaultDeck().getCards();
    cardStructs = new ArrayList<>();

    if (allCards.size() > 0)
        findViewById(R.id.noCardsText).setVisibility(View.GONE);

    //if there's a bundle to grab, then the user is editing a deck
    if (getIntent().hasExtra(CreateEditDeleteDeckActivity.CHECKED_DECK)) {
        Bundle bundle = getIntent().getExtras();
        if (bundle != null) {
            //get the selected deck to edit
            deck = deckManager.getDecks(bundle.getString(CreateEditDeleteDeckActivity.CHECKED_DECK)).get(0);
            //get all the card in the deck the user is editing
            cardsInDeck = deck.getCards();
            //this will affect what happens when the user hits submit or create
            //in this case the deck will be updated and commited
            editMode = true;//from   w w w.ja  v  a 2s.  co m
            //button should say "submit" if the user is editing
            subButton.setText(R.string.button_submit);
            //set the edit text box to the name of the deck
            textBox.append(deck.getName());
        }
        //if not, then they're creating a deck
    } else {
        //this is a new deck, so there aren't any card currently
        cardsInDeck = new ArrayList<>();
        //since this is being set to false a new deck will be created when the user hits create/submit
        editMode = false;
        //the user is creating, so the button should say "create"
        subButton.setText(R.string.button_create);
    }

    //create the CardStructs and set them to selected if the specific card
    //already exists in the deck. fi this is a new deck then they will all be set to false
    for (Card curr : allCards) {
        Boolean contains = cardsInDeck.contains(curr);
        ListRow cardStruct = new ListRow(curr.getAnswer(), contains);
        cardStructs.add(cardStruct);
    }

    //set list view option, set adapter
    ListView cardListView = (ListView) findViewById(R.id.list_items);
    cardListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    CustomArrayListAdapter adapter = new CustomArrayListAdapter(this, R.layout.list_row, cardStructs);
    cardListView.setAdapter(adapter);
    cardListView.setItemsCanFocus(false);
}

From source file:com.abcvoipsip.ui.calllog.CallLogListFragment.java

@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 {/*from w  w w .  ja v a 2  s  .co m*/
        lv.setChoiceMode(ListView.CHOICE_MODE_NONE);
        lv.setItemsCanFocus(true);
    }

    // Start out with a progress indicator.
    // setListShown(false);
}

From source file:org.deviceconnect.android.deviceplugin.fplug.setting.fragment.FPLUGControllerFragment.java

private void setListView(final View root) {
    ListView list = (ListView) root.findViewById(R.id.list);
    ItemAdapter adapter = new ItemAdapter(getActivity(), createItems());
    list.setAdapter(adapter);//from w w w. ja  va 2  s  .  co  m
    list.setItemsCanFocus(true);
    mAdapter = adapter;
}

From source file:com.google.android.apps.iosched.ui.MyScheduleFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_list_with_empty_container, container,
            false);/*from ww  w.j a  va  2s. c  om*/
    inflater.inflate(R.layout.empty_waiting_for_sync, (ViewGroup) root.findViewById(android.R.id.empty), true);
    root.setBackgroundColor(Color.WHITE);
    ListView listView = (ListView) root.findViewById(android.R.id.list);
    listView.setItemsCanFocus(true);
    listView.setCacheColorHint(Color.WHITE);
    listView.setSelector(android.R.color.transparent);
    //listView.setEmptyView(root.findViewById(android.R.id.empty));
    return root;
}

From source file:com.abcvoipsip.ui.messages.ConversationsListFragment.java

@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 {/*from w  w  w . j ava2 s  .  c  o m*/
        lv.setChoiceMode(ListView.CHOICE_MODE_NONE);
        lv.setItemsCanFocus(true);
    }
}

From source file:org.deviceconnect.android.deviceplugin.irkit.settings.fragment.IRKitVirtualDeviceFragment.java

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {

    IRKitCreateVirtualDeviceDialogFragment.setEventListner(this);

    mDBHelper = new IRKitDBHelper(getActivity());
    mVirtualDeviceAdapter = new VirtualDeviceAdapter(getActivity(), createDeviceContainers());

    View rootView = inflater.inflate(R.layout.fragment_virtual_device_list, container, false);

    final View addLayout = rootView.findViewById(R.id.add_btn);
    final View deleteLayout = rootView.findViewById(R.id.remove_btn);
    addLayout.setVisibility(View.VISIBLE);
    deleteLayout.setVisibility(View.GONE);

    Button cancelDeviceBtn = (Button) rootView.findViewById(R.id.cancel_virtual_device);
    cancelDeviceBtn.setOnClickListener(new View.OnClickListener() {
        @Override//from w  w  w  . ja v  a 2  s.co  m
        public void onClick(final View v) {
            addLayout.setVisibility(View.VISIBLE);
            deleteLayout.setVisibility(View.GONE);
            mIsRemoved = false;
            updateVirtualDeviceList();
        }
    });

    Button deleteDeviceBtn = (Button) rootView.findViewById(R.id.remove_virtual_device2);
    deleteDeviceBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (isRemove()) {
                AlertDialog.Builder alertBuilder = new AlertDialog.Builder(getActivity());
                alertBuilder.setTitle(getString(R.string.remove_virtual_device_title));
                alertBuilder.setMessage(getString(R.string.remove_virtual_device_message));
                alertBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        removeCheckVirtualDevices();
                        addLayout.setVisibility(View.VISIBLE);
                        deleteLayout.setVisibility(View.GONE);
                        mIsRemoved = false;
                        updateVirtualDeviceList();
                    }
                });
                alertBuilder.setNegativeButton("Cancel", null);
                alertBuilder.create().show();
            } else {
                IRKitCreateVirtualDeviceDialogFragment.showAlert(getActivity(),
                        getString(R.string.remove_virtual_device_title),
                        getString(R.string.remove_virtual_select_device));
                updateVirtualDeviceList();
            }
        }
    });

    Button addDeviceBtn = (Button) rootView.findViewById(R.id.add_virtual_device);
    addDeviceBtn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            IRKitCategorySelectDialogFragment irkitDialog = IRKitCategorySelectDialogFragment
                    .newInstance(mServiceId);
            irkitDialog.show(getActivity().getFragmentManager(), "fragment_dialog");
            updateVirtualDeviceList();
        }
    });

    Button selectDeleteDeviceBtn = (Button) rootView.findViewById(R.id.remove_virtual_device);
    selectDeleteDeviceBtn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            addLayout.setVisibility(View.GONE);
            deleteLayout.setVisibility(View.VISIBLE);
            mIsRemoved = true;
            updateVirtualDeviceList();
        }
    });

    ListView listView = (ListView) rootView.findViewById(R.id.listview_devicelist);
    listView.setItemsCanFocus(true);
    listView.setAdapter(mVirtualDeviceAdapter);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(final AdapterView<?> parent, final View view, final int position,
                final long id) {
            if (mIsRemoved) {
                CheckBox removeCheck = (CheckBox) view.findViewById(R.id.delete_check);
                removeCheck.setChecked(!removeCheck.isChecked());
            } else {
                IRKitVirtualDeviceListActivity activity = (IRKitVirtualDeviceListActivity) getActivity();
                activity.startApp(IRKitVirtualDeviceListActivity.MANAGE_VIRTUAL_PROFILE_PAGE,
                        mVirtuals.get(position).getServiceId());
            }
        }
    });
    return rootView;
}

From source file:com.fututel.ui.chat.ChatListFragment.java

@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 {//  w ww. ja v a  2  s . c  om
        lv.setChoiceMode(ListView.CHOICE_MODE_NONE);
        lv.setItemsCanFocus(true);
    }

}