mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 12:39:58 +01:00
use proper register-method instead of reflection
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
7a4785e083
commit
7eef68ef36
@ -104,22 +104,12 @@ public class DavUtils {
|
||||
|
||||
public static void registerCustomFactories() {
|
||||
PropertyRegistry propertyRegistry = PropertyRegistry.INSTANCE;
|
||||
try {
|
||||
Field factories = propertyRegistry.getClass().getDeclaredField("factories");
|
||||
factories.setAccessible(true);
|
||||
Map<Property.Name, PropertyFactory> reflectionMap = (HashMap<Property.Name,
|
||||
PropertyFactory>) factories.get(propertyRegistry);
|
||||
|
||||
reflectionMap.put(OCId.NAME, new OCId.Factory());
|
||||
reflectionMap.put(NCPreview.NAME, new NCPreview.Factory());
|
||||
reflectionMap.put(NCEncrypted.NAME, new NCEncrypted.Factory());
|
||||
reflectionMap.put(OCFavorite.NAME, new OCFavorite.Factory());
|
||||
reflectionMap.put(OCSize.NAME, new OCSize.Factory());
|
||||
reflectionMap.put(NCPermission.NAME, new NCPermission.Factory());
|
||||
|
||||
factories.set(propertyRegistry, reflectionMap);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
Log.w(TAG, "Error registering custom factories", e);
|
||||
}
|
||||
propertyRegistry.register(new OCId.Factory());
|
||||
propertyRegistry.register(new NCPreview.Factory());
|
||||
propertyRegistry.register(new NCEncrypted.Factory());
|
||||
propertyRegistry.register(new OCFavorite.Factory());
|
||||
propertyRegistry.register(new OCSize.Factory());
|
||||
propertyRegistry.register(new NCPermission.Factory());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user