Multiautocomplete -android
import androidx.annotation.NonNull;
import ridmik.one.entities.MucOptions;
import ridmik.one.ui.components.autocomplete.filter.HandleTokenFilter;
public class MucUserTokenFilter extends HandleTokenFilter<MucOptions.User> {
public MucUserTokenFilter() {
this('@');
}
public MucUserTokenFilter(char handleChar) {
super(handleChar);
}
@Override
protected boolean matchesConstraint(@NonNull MucOptions.User user, @NonNull CharSequence constraint) {
return user.getComparableName().toLowerCase().contains(constraint.toString().toLowerCase());
}
@Override
public @NonNull CharSequence toTokenString(@NonNull MucOptions.User user) {
return handleChar +user.getComparableName(); // Add handler at the begining! this is the trick!
}
}
Horrible Hamerkop