Java Code Examples for android.widget.ListView#setSelection()

The following examples show how to use android.widget.ListView#setSelection() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: AssistantBySDK   File: ItemIncomeDialog.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_item_income);
    dao = AccountItemDao.getInstance();
    EventBus.getDefault().register(this);
    itemListView = (ListView) findViewById(R.id.aii_item_list);
    items = dao.findAllByExpense(0);
    inflater = LayoutInflater.from(mContext);
    itemListView.setAdapter(itemAdapter);
 //   itemListView.setOnItemClickListener(itemItemListener);

    findViewById(R.id.aii_back).setOnClickListener(clickListener);
    findViewById(R.id.aii_edit).setOnClickListener(clickListener);

    if (!TextUtils.isEmpty(item)) {
        for (int i = 0; i < items.size(); i++) {
            if (items.get(i).getItem().equals(item)) {
                seletectedItemPosition = i;
                break;
            }
        }
    }
    itemListView.setSelection(seletectedItemPosition);
}
 
Example 2
Source Project: android-file-chooser   File: UiUtil.java    License: Apache License 2.0 6 votes vote down vote up
public static void ensureVisible(@Nullable ListView listView, int pos) {
    if (listView == null || listView.getAdapter() == null) {
        return;
    }

    if (pos < 0 || pos >= listView.getAdapter().getCount()) {
        return;
    }

    int first = listView.getFirstVisiblePosition();
    int last = listView.getLastVisiblePosition();

    if (pos < first) {
        listView.setSelection(pos);
        return;
    }

    if (pos >= last) {
        listView.setSelection(1 + pos - (last - first));
    }
}
 
Example 3
public void selectItem(int num) {
	final ListView commitList = (ListView) getView().findViewById(R.id.git_history_commit_list);
	
	selectedItem = num;
	int selection = num - commitList.getFirstVisiblePosition();
	
	//Keep the selected commit on screen... with a little bit of breathing room
	if (num < commitList.getFirstVisiblePosition() + 2) {
		commitList.setSelection(num == 0 ? num : num - 1);
	} else if (num > commitList.getLastVisiblePosition() - 2) {
		commitList.setSelection(num == commitList.getCount() - 1 ? num : num + 1);
	}
	
	for (int i = 0; i < commitList.getCount(); i ++) {
		View child = commitList.getChildAt(i);
		
		if (child != null) {
			child.setBackgroundColor(selection == i
					? getResources().getColor(R.color.holo_select)
					: getResources().getColor(android.R.color.transparent));
		}
	}
}
 
Example 4
private void updateDeviceList() {
    //TODO fix npe when opening drawer before app has fully started (no synclient)
    List<DeviceStats> list = Lists.newArrayList(syncthingClient.getDevicesHandler().getDeviceStatsList());
    Collections.sort(list, new Comparator<DeviceStats>() {
        Function<DeviceStats.DeviceStatus,Integer> fun= Functions.forMap(ImmutableMap.of(DeviceStats.DeviceStatus.OFFLINE,3, DeviceStats.DeviceStatus.ONLINE_INACTIVE,2, DeviceStats.DeviceStatus.ONLINE_ACTIVE,1));
        @Override
        public int compare(DeviceStats a, DeviceStats b) {
            return ComparisonChain.start().compare(fun.apply(a.getStatus()),fun.apply(b.getStatus())).compare(a.getName(),b.getName()).result();
        }
    });
    ListView listView = (ListView) findViewById(R.id.devices_list_view);
    ((ArrayAdapter) listView.getAdapter()).clear();
    ((ArrayAdapter<DeviceStats>) listView.getAdapter()).addAll(list);
    ((ArrayAdapter) listView.getAdapter()).notifyDataSetChanged();
    listView.setSelection(0);
}
 
Example 5
Source Project: TvWidget   File: DemoListViewActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.demo_list_view);

    ListView listView = (ListView) findViewById(R.id.listView);

    MyAdapter myAdapter=new MyAdapter();
    listView.setAdapter(myAdapter);
    myAdapter.notifyDataSetChanged();

    listView.setSelected(true);
    listView.setSelection(0);

    BorderView borderView = new BorderView(this);

    borderView.setBackgroundResource(R.drawable.border_red);
    //borderView.getEffect(BorderEffect.class).setMargin(12);
    borderView.attachTo(listView);

}
 
Example 6
/**
 * listview滚动到顶部
 *
 * @param animate 是否动画
 * @return
 */
public UDBaseListOrRecyclerView scrollToTop( int offset,  boolean animate) {
     ListView lv = getListView();
    if (lv != null) {
        if (animate) {
            if (lv.getFirstVisiblePosition() > 7) {//hack fast scroll
                lv.setSelection(7);
            }
            lv.smoothScrollToPositionFromTop(0, offset);
        } else {
            lv.setSelectionFromTop(0, offset);
        }
    }
    return this;
}
 
Example 7
Source Project: iBeebo   File: Utility.java    License: GNU General Public License v3.0 5 votes vote down vote up
public static void stopListViewScrollingAndScrollToTop(ListView listView) {
    Runnable runnable = JavaReflectionUtility.getValue(listView, "mFlingRunnable");
    listView.removeCallbacks(runnable);
    listView.setSelection(Math.min(listView.getFirstVisiblePosition(), 5));
    listView.smoothScrollToPosition(0);

}
 
Example 8
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View v = inflater.inflate(R.layout.sync_passphrase_types, null);

    // Configure the passphrase type list
    ListView list = (ListView) v.findViewById(R.id.passphrase_types);
    Adapter adapter = createAdapter(getCurrentTypeFromArguments());
    list.setAdapter(adapter);
    list.setId(R.id.passphrase_type_list);
    list.setOnItemClickListener(this);
    list.setDividerHeight(0);
    PassphraseType currentType = getCurrentTypeFromArguments();
    list.setSelection(adapter.getPositionForType(currentType));

    // Configure the hint to reset the passphrase settings
    // Only show this hint if encryption has been set to use sync passphrase
    if (currentType == PassphraseType.CUSTOM_PASSPHRASE) {
        TextView instructionsView = (TextView) v.findViewById(R.id.reset_sync_text);
        instructionsView.setVisibility(View.VISIBLE);
        instructionsView.setMovementMethod(LinkMovementMethod.getInstance());
        instructionsView.setText(getResetText());
    }

    // Create and return the dialog
    return new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme)
            .setNegativeButton(R.string.cancel, this)
            .setTitle(R.string.sync_passphrase_type_title)
            .setView(v)
            .create();
}
 
Example 9
Source Project: Onosendai   File: ScrollState.java    License: Apache License 2.0 5 votes vote down vote up
private void applyToListView (final ListView lv) {
	// NOTE if this seems unreliable try wrapping setSelection*() calls in lv.post(...).
	final ListAdapter adapter = lv.getAdapter();

	if (this.itemId >= 0L) {
		for (int i = 0; i < adapter.getCount(); i++) {
			if (adapter.getItemId(i) == this.itemId) {
				lv.setSelectionFromTop(i, this.top);
				return;
			}
		}
	}

	// Also search by time before giving up.
	if (this.itemTime > 0L && adapter instanceof TweetListCursorAdapter) {
		final TweetListCursorAdapter tlca = (TweetListCursorAdapter) adapter;
		for (int i = 0; i < tlca.getCount(); i++) {
			final long itime = tlca.getItemTime(i);
			if (itime > 0L && itime <= this.itemTime) {
				lv.setSelectionFromTop(i, 0);
				return;
			}
		}
		LOG.w("Failed to restore scroll state %s to list of %s items.", this, tlca.getCount());
	}
	else {
		LOG.w("Failed to restore scroll state %s.", this);
	}

	lv.setSelection(lv.getCount() - 1);
}
 
Example 10
public void selectPageDialog() {
    if (context == null)
        context = App.getActivity();
    final int[] pages = new int[pagination.getAll()];

    for (int i = 0; i < pagination.getAll(); i++)
        pages[i] = i + 1;

    final ListView listView = new ListView(context);
    listView.setDivider(null);
    listView.setDividerHeight(0);
    listView.setFastScrollEnabled(true);

    listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    listView.setAdapter(new PaginationAdapter(context, pages));
    listView.setItemChecked(pagination.getCurrent() - 1, true);
    listView.setSelection(pagination.getCurrent() - 1);

    AlertDialog dialog = new AlertDialog.Builder(context)
            .setView(listView)
            .show();

    if (dialog.getWindow() != null)
        dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

    listView.setOnItemClickListener((adapterView, view1, i2, l) -> {
        if (listView.getTag() != null && !((Boolean) listView.getTag())) {
            return;
        }
        selectPage(i2 * pagination.getPerPage());
        dialog.cancel();
    });
}
 
Example 11
private void showEvents(List<String> logs) {
    if (logs == null) {
        Log.w(TAG, "logs == null, are you polling too early?");
        mAdapter.add(getString(R.string.on_network_logs_available_failure));
    } else {
        Log.d(TAG, "Incoming logs size: " + logs.size());
        mAdapter.addAll(mLogs);
        ListView listView = NetworkLogsFragment.this.getListView();
        listView.setSelection(listView.getCount() - 1);
    }
}
 
Example 12
Source Project: Qshp   File: ListViewUtils.java    License: MIT License 5 votes vote down vote up
/**
 * 滚动列表到position
 *
 * @param listView
 * @param position
 */
public static void smoothScrollListView(ListView listView, int position) {
    if (Build.VERSION.SDK_INT > 7) {
        listView.smoothScrollToPositionFromTop(0, 0);
    } else {
        listView.setSelection(position);
    }
}
 
Example 13
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View v = inflater.inflate(R.layout.sync_passphrase_types, null);

    // Configure the passphrase type list
    ListView list = (ListView) v.findViewById(R.id.passphrase_types);
    Adapter adapter = createAdapter(getCurrentTypeFromArguments());
    list.setAdapter(adapter);
    list.setId(R.id.passphrase_type_list);
    list.setOnItemClickListener(this);
    list.setDividerHeight(0);
    PassphraseType currentType = getCurrentTypeFromArguments();
    list.setSelection(adapter.getPositionForType(currentType));

    // Configure the hint to reset the passphrase settings
    // Only show this hint if encryption has been set to use sync passphrase
    if (currentType == PassphraseType.CUSTOM_PASSPHRASE) {
        TextView instructionsView = (TextView) v.findViewById(R.id.reset_sync_text);
        instructionsView.setVisibility(View.VISIBLE);
        instructionsView.setMovementMethod(LinkMovementMethod.getInstance());
        instructionsView.setText(getResetText());
    }

    // Create and return the dialog
    return new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme)
            .setNegativeButton(R.string.cancel, this)
            .setTitle(R.string.sync_passphrase_type_title)
            .setView(v)
            .create();
}
 
Example 14
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_item_expense);
    dao = AccountItemDao.getInstance();
    EventBus.getDefault().register(this);
    itemListView = (ListView) findViewById(R.id.aie_item_list);
    subItemListView = (ListView) findViewById(R.id.aie_subitem_list);
    items = dao.findAllByExpense(1);
    subItems = dao.findAllSubItem();
    inflater = LayoutInflater.from(mContext);
    Log.w(TAG, "items.size=" + items.size() + ",subItems.size=" + subItems.size());
    itemListView.setAdapter(itemAdapter);
    itemListView.setOnItemClickListener(itemItemListener);
    subItemListView.setAdapter(subAdapter);
  //  subItemListView.setOnItemClickListener(subItemItemListener);

    findViewById(R.id.aie_back).setOnClickListener(clickListener);
    findViewById(R.id.aie_edit).setOnClickListener(clickListener);

    if (!TextUtils.isEmpty(item)) {
        String is[] = item.split(",");
        if (is.length == 2) {
            boolean r = false;
            for (int i = 0; i < subItems.size(); i++) {
                if (subItems.get(i).getName().equals(is[1])) {
                    for (int j = 0; j < items.size(); j++) {
                        if (items.get(j).getId() == subItems.get(i).getItemid()) {
                            if (items.get(j).getItem().equals(is[0])) {
                                selectedSubItemId = subItems.get(i).getId();
                                seletectedItemPosition = j;
                                r = true;
                                break;
                            }
                        }
                    }
                    if (r)
                        break;
                }
            }
        }
    }
    setShowSubItems(items.get(seletectedItemPosition).getId());
    itemListView.setSelection(seletectedItemPosition);
}
 
Example 15
Source Project: YiBo   File: HomePageActivity.java    License: Apache License 2.0 4 votes vote down vote up
@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		Intent intent = new Intent();
		Bundle bundle = new Bundle();

		switch (item.getItemId()) {
		case R.id.menu_accounts:
			intent.putExtras(bundle);
			intent.setClass(HomePageActivity.this, AccountsActivity.class);
			this.startActivityForResult(intent,	Constants.REQUEST_CODE_ACCOUNTS);
			break;
		case R.id.menu_search:
			this.onSearchRequested();
			break;
		case R.id.menu_back2top:
			ListView lvMicroBlog = (ListView)this.findViewById(R.id.lvMicroBlog);
            if (lvMicroBlog != null) {
          	    lvMicroBlog.setSelection(1);
            }
			break;
		case R.id.menu_setting:
			intent.setClass(HomePageActivity.this, SettingActivity.class);
			this.startActivityForResult(intent, Constants.REQUEST_CODE_SETTINGS);
			break;
		case R.id.menu_fullscreen:
			GlobalVars.IS_FULLSCREEN = !GlobalVars.IS_FULLSCREEN;
			if (GlobalVars.IS_FULLSCREEN) {
				getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
				showScreenToggle();
				item.setTitle(R.string.menu_not_fullscreen);
			} else {
				getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
				hideScreenToggle();
				item.setTitle(R.string.menu_fullscreen);
			}
			
//			String aboutMsg = getResources().getString(R.string.about);
//			aboutMsg = String.format(aboutMsg, GlobalResource.getVersionName(this));
//			new AlertDialog.Builder(this)
//			    .setTitle(this.getString(R.string.title_dialog_about))
//			    .setMessage(aboutMsg)
//			    .create()
//			    .show();
			break;
		case R.id.menu_quit:
			showDialog(DIALOG_EXIT);
			break;
		default:
			break;
		}

		return true;
	}
 
Example 16
Source Project: andOTP   File: CredentialsPreference.java    License: MIT License 4 votes vote down vote up
@Override
protected void onBindDialogView(View view) {
    value = settings.getAuthMethod();

    ListView listView = view.findViewById(R.id.credentialSelection);

    ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_list_item_single_choice, entries);
    listView.setAdapter(adapter);

    int index = entryValues.indexOf(value);
    listView.setSelection(index);
    listView.setItemChecked(index,true);
    listView.setOnItemClickListener(this);

    credentialsLayout = view.findViewById(R.id.credentialsLayout);

    passwordLayout = view.findViewById(R.id.passwordLayout);
    passwordInput = view.findViewById(R.id.passwordEdit);
    passwordConfirm = view.findViewById(R.id.passwordConfirm);

    if (settings.getBlockAccessibility()) {
        passwordLayout.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
        passwordConfirm.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && settings.getBlockAutofill()) {
        passwordLayout.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS);
        passwordConfirm.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO);
    }

    toShortWarning = view.findViewById(R.id.toShortWarning);

    passwordInput.addTextChangedListener(this);
    passwordConfirm.addTextChangedListener(this);

    Button btnCancel = view.findViewById(R.id.btnCancel);
    btnSave = view.findViewById(R.id.btnSave);

    btnCancel.setOnClickListener(this);
    btnSave.setOnClickListener(this);

    updateLayout();

    super.onBindDialogView(view);
}
 
Example 17
private void navigateToFolder(FileInfo fileInfo) {
    Log.d("navigateToFolder", "BEGIN");
    if (indexBrowser.isRoot() && PathUtils.isParent(fileInfo.getPath())) {
        showAllFoldersListView(); //navigate back to folder list
    } else {
        if (fileInfo.isDirectory()) {
            indexBrowser.navigateTo(fileInfo);
            FileInfo newFileInfo=PathUtils.isParent(fileInfo.getPath())?indexBrowser.getCurrentPathInfo():fileInfo;
            if (!indexBrowser.isCacheReadyAfterALittleWait()) {
                Log.d("navigateToFolder", "load folder cache bg");
                new AsyncTask<Void, Void, Void>() {
                    @Override
                    protected void onPreExecute() {
                        updateMainProgressBar(true,"open directory: " + (indexBrowser.isRoot() ? folderBrowser.getFolderInfo(indexBrowser.getFolder()).getLabel() : indexBrowser.getCurrentPathFileName()));
                    }

                    @Override
                    protected Void doInBackground(Void... voids) {
                        indexBrowser.waitForCacheReady();
                        return null;
                    }

                    @Override
                    protected void onPostExecute(Void aVoid) {
                        Log.d("navigateToFolder", "cache ready, navigate to folder");
                        updateMainProgressBar(false,null);
                        navigateToFolder(newFileInfo);
                    }
                }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
            } else {
                List<FileInfo> list = indexBrowser.listFiles();
                Log.i("navigateToFolder", "list for path = '" + indexBrowser.getCurrentPath() + "' list = " + list.size() + " records");
                Log.d("navigateToFolder", "list for path = '" + indexBrowser.getCurrentPath() + "' list = " + list);
                checkArgument(!list.isEmpty());//list must contain at least the 'parent' path
                ListView listView = (ListView) findViewById(R.id.main_folder_and_files_list_view);
                ArrayAdapter adapter = (ArrayAdapter) listView.getAdapter();
                adapter.clear();
                adapter.addAll(list);
                adapter.notifyDataSetChanged();
                listView.setSelection(0);
                saveCurrentFolder();
                ((TextView) findViewById(R.id.main_header_folder_label)).setText(indexBrowser.isRoot()
                        ?folderBrowser.getFolderInfo(indexBrowser.getFolder()).getLabel()
                        :newFileInfo.getFileName());
            }
        } else {
            pullFile(fileInfo);
        }
    }
    Log.d("navigateToFolder", "END");
}
 
Example 18
@Override
void scrollToPosition(ListView list, int pos) {
    list.setSelection(pos);
}
 
Example 19
Source Project: DialogUtil   File: MaterialDialogHolder.java    License: Apache License 2.0 4 votes vote down vote up
private void buildChoose(Context context, final ConfigBean bean) {

        messageContentRoot.setVisibility(View.GONE);
        final ListView listView = new ListView(context);
        listView.setDivider(null);
        SuperLvAdapter adapter = buildAdapterByType(bean);
        listView.setAdapter(adapter);
        adapter.addAll(bean.chooseBeans);

        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        listView.setLayoutParams(params);

        contentView.addView(listView,1);

        if(bean.type == DefaultConfig.TYPE_MD_SINGLE_CHOOSE){
            listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
            listView.setSelection(bean.defaultChosen);
            //todo 点击一个item即可消失
            listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                    if(bean.listener !=null){
                        bean.listener.onGetChoose(position,bean.chooseBeans.get(position).txt);
                    }
                    if(bean.itemListener !=null){
                        bean.itemListener.onItemClick(bean.chooseBeans.get(position).txt,position);
                    }
                    Tool.dismiss(bean);
                }
            });
        }else {
            listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
            btnP.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                   SparseBooleanArray booleanArray =  listView.getCheckedItemPositions();
                   //todo 回传多选结果
                    List<Integer> selectedIndexs = new ArrayList<>(booleanArray.size());
                    List<CharSequence> selectStrs = new ArrayList<>(booleanArray.size());
                    boolean[] states = new boolean[bean.chooseBeans.size()];
                    for (int i = 0; i < booleanArray.size(); i++) {
                        Boolean selected = booleanArray.get(i);
                        if(selected){
                            selectedIndexs.add(i);
                            selectStrs.add(bean.chooseBeans.get(i).txt);
                        }
                        states[i] = selected;
                    }
                    bean.listener.onChoosen(selectedIndexs,selectStrs,states);
                    Tool.dismiss(bean);
                }
            });
        }
        //初始化其选择状态
        for (int i = 0; i < bean.chooseBeans.size(); i++) {
            ChooseBean chooseBean = bean.chooseBeans.get(i);
            listView.setItemChecked(i,chooseBean.choosen);
        }
    }
 
Example 20
public View create() {

            LinearLayout content = (LinearLayout) mInflater.inflate(R.layout.sdl_dialog, mContainer, false);
            TextView vTitle = (TextView) content.findViewById(R.id.sdl_title);
            TextView vMessage = (TextView) content.findViewById(R.id.sdl_message);
            FrameLayout vCustomView = (FrameLayout) content.findViewById(R.id.sdl_custom);
            Button vPositiveButton = (Button) content.findViewById(R.id.sdl_button_positive);
            Button vNegativeButton = (Button) content.findViewById(R.id.sdl_button_negative);
            Button vNeutralButton = (Button) content.findViewById(R.id.sdl_button_neutral);
            Button vPositiveButtonStacked = (Button) content.findViewById(R.id.sdl_button_positive_stacked);
            Button vNegativeButtonStacked = (Button) content.findViewById(R.id.sdl_button_negative_stacked);
            Button vNeutralButtonStacked = (Button) content.findViewById(R.id.sdl_button_neutral_stacked);
            View vButtonsDefault = content.findViewById(R.id.sdl_buttons_default);
            View vButtonsStacked = content.findViewById(R.id.sdl_buttons_stacked);
            ListView vList = (ListView) content.findViewById(R.id.sdl_list);

            Typeface regularFont = TypefaceHelper.get(mContext, "Roboto-Regular");
            Typeface mediumFont = TypefaceHelper.get(mContext, "Roboto-Medium");

            set(vTitle, mTitle, mediumFont);
            set(vMessage, mMessage, regularFont);
            setPaddingOfTitleAndMessage(vTitle, vMessage);

            if (mCustomView != null) {
                vCustomView.addView(mCustomView);
            }
            if (mListAdapter != null) {
                vList.setAdapter(mListAdapter);
                vList.setOnItemClickListener(mOnItemClickListener);
                if (mListCheckedItemIdx != -1) {
                    vList.setSelection(mListCheckedItemIdx);
                }
                if (mListCheckedItemMultipleIds != null) {
                    vList.setChoiceMode(mChoiceMode);
                    for (int i : mListCheckedItemMultipleIds) {
                        vList.setItemChecked(i, true);
                    }
                }
            }

            if (shouldStackButtons()) {
                set(vPositiveButtonStacked, mPositiveButtonText, mediumFont, mPositiveButtonListener);
                set(vNegativeButtonStacked, mNegativeButtonText, mediumFont, mNegativeButtonListener);
                set(vNeutralButtonStacked, mNeutralButtonText, mediumFont, mNeutralButtonListener);
                vButtonsDefault.setVisibility(View.GONE);
                vButtonsStacked.setVisibility(View.VISIBLE);
            } else {
                set(vPositiveButton, mPositiveButtonText, mediumFont, mPositiveButtonListener);
                set(vNegativeButton, mNegativeButtonText, mediumFont, mNegativeButtonListener);
                set(vNeutralButton, mNeutralButtonText, mediumFont, mNeutralButtonListener);
                vButtonsDefault.setVisibility(View.VISIBLE);
                vButtonsStacked.setVisibility(View.GONE);
            }
            if (TextUtils.isEmpty(mPositiveButtonText) && TextUtils.isEmpty(mNegativeButtonText) && TextUtils.isEmpty
                    (mNeutralButtonText)) {
                vButtonsDefault.setVisibility(View.GONE);
            }

            return content;
        }