File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
messagekit/src/main/java/tz/co/hosannahighertech/messagekit/messages Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -370,6 +370,35 @@ public void clear(boolean notifyDataSetChanged) {
370370 }
371371 }
372372
373+ /**
374+ * Get the message position in the recyclerview
375+ *
376+ * @param messageId Message ID
377+ * @return 0 based position of the message in the adapter
378+ */
379+ @ SuppressWarnings ("unchecked" )
380+ public int getMessagePosition (String messageId ) {
381+ for (int position = 0 ; position < items .size (); position ++) {
382+ if ((items .get (position ).item instanceof IMessage )) {
383+ MESSAGE item = (MESSAGE ) items .get (position ).item ;
384+ if (item .getId ().equals (messageId )){
385+ return position ;
386+ }
387+ }
388+ }
389+ return -1 ;
390+ }
391+
392+ /**
393+ * Get the message position in the recyclerview
394+ *
395+ * @param message Message
396+ * @return 0 based position of the message in the adapter
397+ */
398+ public int getMessagePosition (MESSAGE message ) {
399+ return getMessagePosition (message .getId ());
400+ }
401+
373402 /**
374403 * Enables selection mode.
375404 *
You can’t perform that action at this time.
0 commit comments