@@ -194,32 +194,25 @@ private void setFilter(int position) {
194194 try {
195195 ReflectionUtils .callMethod (methodInitFilter , null , mConversationFragment );
196196 if (mFilterInstance == null ) return ;
197- var listField = ReflectionUtils .getFieldByType (mFilterInstance .getClass (), List .class );
198- var list = (List <Object >) ReflectionUtils .getObjectField (listField , mFilterInstance );
199- // for 24.xx, it is CopyOnWriteArrayList instead of List
200- if (list == null ) {
201- listField = ReflectionUtils .getFieldByType (mFilterInstance .getClass (), CopyOnWriteArrayList .class );
202- list = (List <Object >) ReflectionUtils .getObjectField (listField , mFilterInstance );
203- }
197+ var listField = ReflectionUtils .getFieldByExtendType (mFilterInstance .getClass (), List .class );
198+ var list = (List ) ReflectionUtils .getObjectField (listField , mFilterInstance );
204199 if (list == null ) return ;
205200 var name = position == 0 ? "CONTACTS_FILTER" : "GROUP_FILTER" ;
206- Object result = null ;
201+ int index = - 1 ;
207202 for (var item : list ) {
208- for (var field : item .getClass ().getFields ()) {
209- if (Objects .equals (XposedHelpers .getObjectField (item , field .getName ()), name )) {
210- result = item ;
211- break ;
212- }
203+ if (item == null ) continue ;
204+ if (item .toString ().contains (name )) {
205+ index = list .indexOf (item );
206+ break ;
213207 }
214208 }
215- if (result == null ) return ;
216- var index = list .indexOf (result );
209+ if (index == -1 ) return ;
217210 ReflectionUtils .callMethod (methodSetFilter , mFilterInstance , index );
218211 } catch (Exception e ) {
219212 logDebug (e );
220213 }
221214 }
222-
215+
223216 @ NonNull
224217 @ Override
225218 public String getPluginName () {
0 commit comments