@@ -287,8 +287,8 @@ public static Class<?> getClazz(Context context) {
287287 .filter (c -> Stream .of (c .getDeclaredFields ()).anyMatch (m -> m .getType () == String .class ))
288288 .filter (c -> Stream .of (c .getDeclaredFields ()).anyMatch (m -> m .getType () == ArrayList .class ))
289289 .filter (c -> Stream .of (c .getDeclaredFields ()).anyMatch (m -> m .getType () == boolean .class ))
290- .filter (c -> Stream .of (c .getDeclaredMethods ()).anyMatch (m -> m .getReturnType () == ArrayList .class ))
291- .filter (c -> Stream .of (c .getDeclaredMethods ()).anyMatch (m -> m .getReturnType () == String [].class ))
290+ .filter (c -> Stream .of (c .getDeclaredMethods ()).anyMatch (m -> m .getReturnType () == ArrayList .class && Modifier . isFinal ( m . getModifiers ()) && m . getParameterTypes (). length == 0 ))
291+ .filter (c -> Stream .of (c .getDeclaredMethods ()).anyMatch (m -> m .getReturnType () == String [].class && Modifier . isFinal ( m . getModifiers ()) && m . getParameterTypes (). length == 0 ))
292292 .findFirst ()
293293 .get ();
294294 } catch (NoSuchElementException e ) {
@@ -298,20 +298,24 @@ public static Class<?> getClazz(Context context) {
298298 return clazz ;
299299 }
300300
301- public static Method getTabInitMethod () {
301+ public static Method getTabInitMethod (Context context ) {
302302 if (initMethod == null ) {
303303 Method [] methods = findMethodsByExactParameters (clazz , ArrayList .class );
304304 if (methods .length != 0 )
305305 initMethod = methods [0 ];
306+ else
307+ MessageHelper .sendNotification (context , MessageHelper .tabClassNotFoundCode );
306308 }
307309 return initMethod ;
308310 }
309311
310- public static Method getTabRefreshMethod () {
312+ public static Method getTabRefreshMethod (Context context ) {
311313 if (refreshMethod == null ) {
312314 Method [] methods = findMethodsByExactParameters (clazz , void .class , List .class );
313315 if (methods .length != 0 )
314316 refreshMethod = methods [0 ];
317+ else
318+ MessageHelper .sendNotification (context , MessageHelper .tabClassNotFoundCode );
315319 }
316320 return refreshMethod ;
317321 }
@@ -348,6 +352,40 @@ public static Class<?> getClazz(Context context) {
348352 }
349353 }
350354
355+ /**
356+ * 评论
357+ */
358+ public static class CommentDataClass {
359+ private static Class <?> clazz ;
360+
361+ public static Class <?> getClazz (Context context ) {
362+ if (clazz == null ) {
363+ try {
364+ Pattern pattern = Pattern .compile ("^com\\ .netease\\ .cloudmusic\\ .module\\ .comment2\\ .[a-z]\\ .[a-z]$" );
365+ List <String > list = ClassHelper .getFilteredClasses (pattern , Collections .reverseOrder ());
366+ clazz = Stream .of (list )
367+ .map (s -> findClass (s , classLoader ))
368+ .filter (c -> Modifier .isPublic (c .getModifiers ()))
369+ .filter (m -> !Modifier .isInterface (m .getModifiers ()))
370+ .filter (m -> !Modifier .isStatic (m .getModifiers ()))
371+ .filter (m -> !Modifier .isAbstract (m .getModifiers ()))
372+ .filter (c -> Stream .of (c .getDeclaredFields ()).anyMatch (m -> m .getType () == int .class ))
373+ .filter (c -> Stream .of (c .getDeclaredFields ()).anyMatch (m -> m .getType () == List .class ))
374+ .filter (c -> Stream .of (c .getDeclaredFields ()).anyMatch (m -> m .getType () == ArrayList .class ))
375+ .filter (c -> Stream .of (c .getDeclaredFields ()).anyMatch (m -> m .getType () == Intent .class ))
376+ .filter (c -> Stream .of (c .getDeclaredFields ()).anyMatch (m -> m .getType () == String .class ))
377+ .filter (c -> Stream .of (c .getDeclaredFields ()).anyMatch (m -> m .getType () == long .class ))
378+ .filter (c -> Stream .of (c .getDeclaredFields ()).anyMatch (m -> m .getType () == boolean .class ))
379+ .findFirst ()
380+ .get ();
381+ } catch (NoSuchElementException e ) {
382+ e .printStackTrace ();
383+ }
384+ }
385+ return clazz ;
386+ }
387+ }
388+
351389 public static class OKHttp3Response {
352390 private static Class <?> clazz ;
353391
0 commit comments