abumoallim / android-multi-select-dialog Goto Github PK
View Code? Open in Web Editor NEWA multi choice select dialog with Search and Text highlighting
A multi choice select dialog with Search and Text highlighting
please provide select all option as first element of drop down
I didn't look into this in code terms, but if you already have a selection, then deselect it and scroll up / down, the item will be selected again.
I'll get back to this when i finish editing my own stuff,
-Ali.
Please can you provide select all option.
It would be nice if you create setting for minimum number of selected items, for example I want to select 1+ items or 0. When I try to deselect all items I got Toast message with text like this: "Please select atleast one option" and I have to do workarounds.
Please could you create a constructor where we could pass in our own theme. Thanks!
for (int i = 0; i < selectedIds.size(); i++) {
if (dataSet.isEmpty()) {
dataSet.add(new EditExhibitionItemsDataModel(selectedIds.get(i), selectedNames.get(i), selectedPrices.get(i), "", selectedCodes.get(i)));
mAdapter.notifyDataSetChanged();
}else {
if (!isPresent(selectedIds.get(i))) {
dataSet.add(new EditExhibitionItemsDataModel(selectedIds.get(i), selectedNames.get(i), selectedPrices.get(i), "", selectedCodes.get(i)));
mAdapter.notifyDataSetChanged();
}
}
}
Hi!
Could you create overrides for validation messages when min / max selection limit is not valid?
Example usage:
setMinSelectionLimitValidationMessage("Min is {0}");
setMaxSelectionLimitValidationMessage("Max is {0}");
{0} (if exists in string) could be replaced with Min / Max SelectionLimit value.
Now texts are hardcoded so I can't use any other language.
App crashes on every time re-opening and modyfiying the selected item after that when Done is pressed it crashes with outofmemmory
is it possible to chenge the color of checkbox
?
Hey,
Thanks alot for the library. I used it and it works fine, however, i have 1 issue, How do i get the text of the item that i selected ? I can get the ID just fine.
Thanks in Advance.
Running this in a fragment
trying to get basic example working,
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;
import com.abdeveloper.library.MultiSelectDialog;
import com.abdeveloper.library.MultiSelectModel;
import java.util.ArrayList;
public class NewChatThreadFragment extends Fragment {
private String TAG = "Cancel";
Button show_dialog_btn;
MultiSelectDialog multiSelectDialog;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_new_chat_thread, container, false);
show_dialog_btn = view.findViewById(R.id.show_dialog);
show_dialog_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
multiSelectDialog.show(getSupportFragmentManager(), "multiSelectDialog");
}
});
//preselected Ids of Country List
final ArrayList<Integer> alreadySelectedCountries = new ArrayList<>();
alreadySelectedCountries.add(1);
alreadySelectedCountries.add(3);
alreadySelectedCountries.add(4);
alreadySelectedCountries.add(7);
//List of Countries with Name and Id
ArrayList<MultiSelectModel> listOfCountries= new ArrayList<>();
listOfCountries.add(new MultiSelectModel(1,"INDIA"));
listOfCountries.add(new MultiSelectModel(2,"USA"));
listOfCountries.add(new MultiSelectModel(3,"UK"));
listOfCountries.add(new MultiSelectModel(4,"UAE"));
listOfCountries.add(new MultiSelectModel(5,"JAPAN"));
listOfCountries.add(new MultiSelectModel(6,"SINGAPORE"));
listOfCountries.add(new MultiSelectModel(7,"CHINA"));
listOfCountries.add(new MultiSelectModel(8,"RUSSIA"));
listOfCountries.add(new MultiSelectModel(9,"BANGLADESH"));
listOfCountries.add(new MultiSelectModel(10,"BELGIUM"));
listOfCountries.add(new MultiSelectModel(11,"DENMARK"));
listOfCountries.add(new MultiSelectModel(12,"GERMANY"));
listOfCountries.add(new MultiSelectModel(13,"HONG KONG"));
listOfCountries.add(new MultiSelectModel(14,"INDONESIA"));
listOfCountries.add(new MultiSelectModel(15,"NETHERLAND"));
listOfCountries.add(new MultiSelectModel(16,"NEW ZEALAND"));
listOfCountries.add(new MultiSelectModel(17,"PORTUGAL"));
listOfCountries.add(new MultiSelectModel(18,"KUWAIT"));
listOfCountries.add(new MultiSelectModel(19,"QATAR"));
listOfCountries.add(new MultiSelectModel(20,"SAUDI ARABIA"));
listOfCountries.add(new MultiSelectModel(21,"SRI LANKA"));
listOfCountries.add(new MultiSelectModel(130,"CANADA"));
//MultiSelectModel
multiSelectDialog = new MultiSelectDialog()
.title("Title") //setting title for dialog
.titleSize(25)
.positiveText("Done")
.negativeText("Cancel")
.setMinSelectionLimit(0)
.setMaxSelectionLimit(listOfCountries.size())
.preSelectIDsList(alreadySelectedCountries) //List of ids that you need to be selected
.multiSelectList(listOfCountries) // the multi select model list with ids and name
.onSubmit(new MultiSelectDialog.SubmitCallbackListener() {
@Override
public void onSelected(ArrayList<Integer> selectedIds, ArrayList<String> selectedNames, String dataString) {
//will return list of selected IDS
for (int i = 0; i < selectedIds.size(); i++) {
Toast.makeText(getContext(), "Selected Ids : " + selectedIds.get(i) + "\n" +
"Selected Names : " + selectedNames.get(i) + "\n" +
"DataString : " + dataString, Toast.LENGTH_SHORT).show();
}
}
@Override
public void onCancel() {
Log.d(TAG,"Dialog cancelled");
}
});
return view;
}
}
what am i missing?
please provide the option for clear all selections
Hey again,
After looking into it i've found that the cancel button is also returning ArrayList ids from onDismiss(), which is wrong, because it's acting the same as Apply button.
Example: Select an item, press cancel, that item will be selected. Would be better if you'd make a condition for it to revert all selections.
how can is get checked checkbox count
Hi is there a way to set my own error message for minimum selection?
Thank you.
I think there is an issue when the MultiSelectModel object have an 'id' greater than 127, It does not allow user to select that item on checklist.
hello,
I am facing an issue that is setCancelable not working
Hi,
problem i am facing is when i select 1 item from the list and scroll the list, 10 items which are listed in last are showing as selected then if i scroll up 7 items from the start showing as selected. if i press done button only my selected item shows.
also if i check on 1 item and then click on search all the items are showing selected.
so i am facing showing selection of item on scroll up/down bug.
First of all thanks for the great work you have done in this repo ... while using your library there is need to set limit on min and max number of item that can be selected currently minimum is set to 1 by default but I need to set it while creating the dialog. How can i achieve this?
Can you add fonts too?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.