Пример #1
0
 public static FragmentType forEnumName(String name) {
   try {
     return FragmentType.valueOf(name);
   } catch (Exception e) {
     return null;
   }
 }
Пример #2
0
 public static FragmentType getFragmentFor(Class<? extends BaseFragment> clazz) {
   for (FragmentType fragmentType : FragmentType.values()) {
     if (fragmentType.fragmentClass.isAssignableFrom(clazz)) {
       return fragmentType;
     }
   }
   return null;
 }
Пример #3
0
 @SuppressWarnings("unchecked")
 public static FragmentType getFragmentFor(String name) {
   try {
     Class<? extends BaseFragment> fragmentType =
         (Class<? extends BaseFragment>) Class.forName(name);
     return FragmentType.getFragmentFor(fragmentType);
   } catch (ClassNotFoundException e) {
     return null;
   }
 }