mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-22 20:25:01 +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() {
|
public static void registerCustomFactories() {
|
||||||
PropertyRegistry propertyRegistry = PropertyRegistry.INSTANCE;
|
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());
|
propertyRegistry.register(new OCId.Factory());
|
||||||
reflectionMap.put(NCPreview.NAME, new NCPreview.Factory());
|
propertyRegistry.register(new NCPreview.Factory());
|
||||||
reflectionMap.put(NCEncrypted.NAME, new NCEncrypted.Factory());
|
propertyRegistry.register(new NCEncrypted.Factory());
|
||||||
reflectionMap.put(OCFavorite.NAME, new OCFavorite.Factory());
|
propertyRegistry.register(new OCFavorite.Factory());
|
||||||
reflectionMap.put(OCSize.NAME, new OCSize.Factory());
|
propertyRegistry.register(new OCSize.Factory());
|
||||||
reflectionMap.put(NCPermission.NAME, new NCPermission.Factory());
|
propertyRegistry.register(new NCPermission.Factory());
|
||||||
|
|
||||||
factories.set(propertyRegistry, reflectionMap);
|
|
||||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
|
||||||
Log.w(TAG, "Error registering custom factories", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user