mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 02:39:23 +02:00
nativePlugins methods (returns empty array)
This commit is contained in:
parent
e850c98c26
commit
260252f2b3
5 changed files with 37 additions and 1 deletions
|
@ -18,6 +18,6 @@ include $(BUILD_SHARED_LIBRARY)
|
|||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := NativeFormats-v1
|
||||
LOCAL_SRC_FILES := NativeFormats/*.cpp
|
||||
LOCAL_SRC_FILES := $(wildcard NativeFormats/*.cpp) $(wildcard NativeFormats/util/*.cpp)
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
|
|
@ -16,3 +16,26 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#include <AndroidUtil.h>
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jobjectArray JNICALL Java_org_geometerplus_fbreader_formats_PluginCollection_nativePlugins(JNIEnv* env, jobject thiz) {
|
||||
//const std::vector<shared_ptr<FormatPlugin> > plugins = PluginCollection::Instance().plugins();
|
||||
const size_t size = 0;//plugins.size();
|
||||
jclass cls = env->FindClass(AndroidUtil::Class_NativeFormatPlugin);
|
||||
jobjectArray javaPlugins = env->NewObjectArray(size, cls, NULL);
|
||||
|
||||
/*
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
jstring fileType = AndroidUtil::createJavaString(env, plugins[i]->supportedFileType());
|
||||
env->SetObjectArrayElement(
|
||||
javaPlugins, i,
|
||||
env->NewObject(cls, AndroidUtil::MID_NativeFormatPlugin_init, fileType)
|
||||
);
|
||||
}
|
||||
*/
|
||||
return javaPlugins;
|
||||
}
|
||||
|
|
|
@ -18,3 +18,5 @@
|
|||
*/
|
||||
|
||||
#include "AndroidUtil.h"
|
||||
|
||||
const char * const AndroidUtil::Class_NativeFormatPlugin = "org/geometerplus/fbreader/formats/NativeFormatPlugin";
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
#ifndef __ANDROIDUTIL_H__
|
||||
#define __ANDROIDUTIL_H__
|
||||
|
||||
class AndroidUtil {
|
||||
|
||||
public:
|
||||
static const char * const Class_NativeFormatPlugin;
|
||||
};
|
||||
|
||||
#endif /* __ANDROIDUTIL_H__ */
|
||||
|
|
|
@ -45,6 +45,11 @@ public class PluginCollection {
|
|||
public static PluginCollection Instance() {
|
||||
if (ourInstance == null) {
|
||||
ourInstance = new PluginCollection();
|
||||
|
||||
// This code can not be moved to constructor because nativePlugins() is a native method
|
||||
for (FormatPlugin p : ourInstance.nativePlugins()) {
|
||||
ourInstance.addPlugin(p);
|
||||
}
|
||||
}
|
||||
return ourInstance;
|
||||
}
|
||||
|
@ -108,4 +113,6 @@ public class PluginCollection {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private native FormatPlugin[] nativePlugins();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue