Closed tusharuit25 closed 1 year ago
This feature is needed because programmer might need to send who are those which are mentioned while typing text and need to send some notifications to them explicitly that you are mentioned; at least need id.
I could run a few tests first to see how reliable this feature could be. How urgent do you need this feature?
I used your component it work like butter ; I would appreciate if you can just let me know how to get selected item (object) which we select it from autocomplete suggestions. I have 3 days time to complete this feature in my project.
Well that sounds very urgent (thanks for the compliment btw). I could write some functions right now before this feature is fully implemented. Are you writing the project in Java/Kotlin? If it is Java, do you have access to lamdba (Java 8)? Do you use RxJava by any chance?
Its JAVA at my end ; plane java
Change Mention
to your custom object:
@NonNull
public Collection<Mention> getMentionObjects(@NonNull SocialAutoCompleteTextView textView) {
Collection<Mention> objects = new ArrayList<>();
ArrayAdapter<Mention> adapter = (ArrayAdapter<Mention>) textView.getMentionAdapter();
for (String mention : textView.getMentions()) {
for (int i = 0; i < adapter.getCount(); i++) {
Mention object = adapter.getItem(i);
if (mention.equals(object.getUsername())) {
objects.add(object);
}
}
}
return objects;
}
It's not the best approach, use it only if you are that urgent.
Ok Thank you @HendraAnggrian
@tusharuit25 You're very much welcome. I'll update this thread for future progress of this feature, thank you for your suggestion!
how to set listners to when mention is clicked i want to send id when user click on mention
I want to get mention id when User click on mention,I have tried a lot but no luck...... Can you please tell me how to achieve this ...
@hendraanggrian I strongly recommend that your Mention
object should contain Id
@MuhammadFarazAhmed did you find any way to get click listener when user click on item on list
@hendraanggrian I want to know the click event when user click on the item of dropdown. Is there any way ??
Suppose I taged 10 users within post. How to get ID of clicked taged item? Suppose :
Hi [at]Hardik How are you? [at]Peter
Tapping on [at]Hardik I need to get his user ID and redirect to his profile.
Is this achievable with this library?
@NonNull
public Collection<Mention> getMentionObjects(@NonNull SocialAutoCompleteTextView textView) {
Collection<Mention> objects = new ArrayList<>();
ArrayAdapter<Mention> adapter = (ArrayAdapter<Mention>) textView.getMentionAdapter();
for (String mention : textView.getMentions()) {
for (int i = 0; i < adapter.getCount(); i++) {
Mention object = adapter.getItem(i);
if (mention.equals(object.getUsername())) {
objects.add(object);
}
}
}
return objects;
}
Hi Tushar. Thanks for your quick reply. Actually I am using SocialTextView to display post description in Recycleview. Now I am trying to grab user's ID whenever user tap on any tagged user in that post. I tried to use above method which you shared. But its giving me error. Would you please help? @tusharkshirsagar2021
I want to get mention id when User click on mention,I have tried a lot but no luck...... Can you please tell me how to achieve this ...
Any idea on this? @hendraanggrian
how to set listners to when mention is clicked i want to send id when user click on mention
You could do it with textView.setOnMentionClickListener
.
@hendraanggrian I strongly recommend that your
Mention
object should contain Id
Mention
is not mandatory, but the interface Mentionable
is. The unique id is getUsername
.
@hendraanggrian I want to know the click event when user click on the item of dropdown. Is there any way ??
This isn't a supported behavior by MultiAutoCompleteTextView
, which is a direct superclass of SocialAutoCompleteTextView
. I'm sorry.
Suppose I taged 10 users within post. How to get ID of clicked taged item? Suppose :
Hi [at]Hardik How are you? [at]Peter
Tapping on [at]Hardik I need to get his user ID and redirect to his profile.
Is this achievable with this library?
Now let us go through this scenario for a moment. The id (or in this case, Mentionable.getUsername
) is only present when you are picking those mentions from dropdownlist with SocialAutoCompleteTextView
. If by any chance you are manually typing those mentions, the library has no idea of knowing their ids.
I'm not saying that this feature is unachievable. It's just add a bulk of logic to what is supposed to be a simple library.
Closed for inactivity.
I'm sorry to tell you that this feature isn't implemented yet. Although it is not impossible to do so, there are few caveats to note:
socialview-commons
I'll keep this issue open for more input.