All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
NativeState.h
1 // Copyright eeGeo Ltd (2017), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "INativeWindowProvider.h"
7 #include <string>
8 #include <android/asset_manager.h>
9 #include <Android/AndroidNativeState.h>
10 
11 namespace Eegeo
12 {
13  namespace Android
14  {
15  namespace Sdk
16  {
18  {
19  public:
21  JavaVM* vm,
22  JNIEnv* mainThreadEnv,
23  jobject eegeoNativeMapViewGlobalRef,
24  jclass eegeoNativeMapViewClass,
25  jobject assetManagerGlobalRef,
26  AAssetManager* assetManager,
27  jobject activityGlobalRef,
28  jclass activityClassGlobalRef,
29  jobject classLoaderGlobalRef,
30  jclass classLoaderClassGlobalRef,
31  jmethodID classLoaderLoadClassMethod,
32  jfloat deviceDpi,
33  std::string deviceModel,
34  std::string versionName,
35  int versionCode
36  );
37 
38  ~NativeState();
39 
40  JavaVM& GetVM() const { return *m_vm; }
41 
42  JNIEnv* GetJNIEnv() const { return m_mainThreadEnv; }
43 
44  float GetDeviceDpi() const { return m_deviceDpi; }
45 
46  const std::string& GetDeviceModel() const { return m_deviceModel; }
47 
48  jobject GetEegeoNativeMapView() const { return m_eegeoNativeMapViewGlobalRef; }
49  jclass GetEegeoNativeMapViewClass() const { return m_eegeoNativeMapViewClass; }
50  jobject GetActivity() const { return m_activity; }
51  jclass GetActivityClass() const { return m_activityClass; }
52 
53  AAssetManager* GetAssetManager() const { return m_assetManager; }
54 
55  ANativeWindow* GetNativeWindow() const { return m_nativeWindow; }
56 
57  void SetNativeWindow(ANativeWindow* nativeWindow);
58 
59  jclass LoadClass(JNIEnv* env, jstring strClassName);
60 
61  void ToLegacyAndroidNativeState(AndroidNativeState& androidNativeState) const;
62 
63 
64  private:
65  JavaVM* m_vm;
66  JNIEnv* m_mainThreadEnv;
67 
68  jobject m_eegeoNativeMapViewGlobalRef;
69  jclass m_eegeoNativeMapViewClass;
70 
71  jobject m_assetManagerGlobalRef;
72  AAssetManager* m_assetManager;
73 
74  jobject m_activity;
75  jclass m_activityClass;
76 
77  jobject m_classLoader;
78  jclass m_classLoaderClass;
79  jmethodID m_classLoaderLoadClassMethod;
80 
81  jfloat m_deviceDpi;
82 
83  std::string m_deviceModel;
84 
85  std::string m_versionName;
86  int m_versionCode;
87 
88  ANativeWindow* m_nativeWindow;
89  };
90  }
91  }
92 }