|
28 | 28 |
|
29 | 29 | import java.lang.reflect.Method; |
30 | 30 | import java.util.List; |
31 | | -import java.util.Objects; |
32 | 31 |
|
33 | 32 | import de.robv.android.xposed.XC_MethodHook; |
34 | 33 | import de.robv.android.xposed.XSharedPreferences; |
@@ -193,27 +192,25 @@ private void setFilter(int position) { |
193 | 192 | try { |
194 | 193 | ReflectionUtils.callMethod(methodInitFilter, null, mConversationFragment); |
195 | 194 | if (mFilterInstance == null) return; |
196 | | - var listField = ReflectionUtils.getFieldByType(mFilterInstance.getClass(), List.class); |
197 | | - var list = (List<Object>) ReflectionUtils.getObjectField(listField, mFilterInstance); |
| 195 | + var listField = ReflectionUtils.getFieldByExtendType(mFilterInstance.getClass(), List.class); |
| 196 | + var list = (List) ReflectionUtils.getObjectField(listField, mFilterInstance); |
198 | 197 | if (list == null) return; |
199 | 198 | var name = position == 0 ? "CONTACTS_FILTER" : "GROUP_FILTER"; |
200 | | - Object result = null; |
| 199 | + int index = -1; |
201 | 200 | for (var item : list) { |
202 | | - for (var field : item.getClass().getFields()) { |
203 | | - if (Objects.equals(XposedHelpers.getObjectField(item, field.getName()), name)) { |
204 | | - result = item; |
205 | | - break; |
206 | | - } |
| 201 | + if (item == null) continue; |
| 202 | + if (item.toString().contains(name)) { |
| 203 | + index = list.indexOf(item); |
| 204 | + break; |
207 | 205 | } |
208 | 206 | } |
209 | | - if (result == null) return; |
210 | | - var index = list.indexOf(result); |
| 207 | + if (index == -1) return; |
211 | 208 | ReflectionUtils.callMethod(methodSetFilter, mFilterInstance, index); |
212 | 209 | } catch (Exception e) { |
213 | 210 | logDebug(e); |
214 | 211 | } |
215 | 212 | } |
216 | | - |
| 213 | + |
217 | 214 | @NonNull |
218 | 215 | @Override |
219 | 216 | public String getPluginName() { |
|
0 commit comments