1 #ifndef DALI_INTEGRATION_ANDROID_FRAMEWORK_IMPL_H
2 #define DALI_INTEGRATION_ANDROID_FRAMEWORK_IMPL_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/integration-api/adaptor-framework/android/android-framework.h>
25 #include <dali/internal/adaptor/common/framework.h>
33 /// Android application events
36 APP_WINDOW_CREATED = 0,
46 * AndroidFramework implementation to set/get Android native interfaces for Android Adaptor.
47 * Also passes Android application events to Android Adaptor internal framework.
49 class AndroidFramework
53 * @brief Create a new Android framework.
55 * @return a reference to the Android framework
57 static Dali::Integration::AndroidFramework& New();
60 * @brief Delete an Android framework.
65 * @copydoc Dali::Integration::AndroidFramework::SetNativeApplication()
67 void SetNativeApplication(android_app* application);
70 * @copydoc Dali::Integration::AndroidFramework::GetNativeApplication()
72 android_app* GetNativeApplication() const;
75 * @copydoc Dali::Integration::AndroidFramework::SetJVM()
77 void SetJVM(JavaVM* jvm);
80 * @copydoc Dali::Integration::AndroidFramework::GetJVM()
82 JavaVM* GetJVM() const;
85 * @copydoc Dali::Integration::AndroidFramework::SetApplicationAssets()
87 void SetApplicationAssets(AAssetManager* assets);
90 * @copydoc Dali::Integration::AndroidFramework::GetApplicationAssets()
92 AAssetManager* GetApplicationAssets() const;
95 * copydoc Dali::Integration::AndroidFramework::SetInternalDataPath()
97 void SetInternalDataPath(const std::string& path);
100 * copydoc Dali::Integration::AndroidFramework::GetInternalDataPath()
102 std::string GetInternalDataPath() const;
105 * @copydoc Dali::Integration::AndroidFramework::SetApplicationConfiguration()
107 void SetApplicationConfiguration(AConfiguration* configuration);
110 * @copydoc Dali::Integration::AndroidFramework::GetApplicationConfiguration()
112 AConfiguration* GetApplicationConfiguration() const;
115 * @copydoc Dali::Integration::AndroidFramework::SetApplicationWindow()
117 void SetApplicationWindow(ANativeWindow* window);
120 * @copydoc Dali::Integration::AndroidFramework::GetApplicationWindow()
122 ANativeWindow* GetApplicationWindow() const;
125 * @copydoc Dali::Integration::AndroidFramework::OnTerminate()
130 * @copydoc Dali::Integration::AndroidFramework::OnPause()
135 * @copydoc Dali::Integration::AndroidFramework::OnResume()
140 * @copydoc Dali::Integration::AndroidFramework::OnWindowCreated()
142 void OnWindowCreated(ANativeWindow* window);
145 * @copydoc Dali::Integration::AndroidFramework::OnWindowDestroyed()
147 void OnWindowDestroyed(ANativeWindow* window);
150 * @copydoc Dali::Integration::AndroidFramework::Get()
152 static Dali::Integration::AndroidFramework& Get();
155 * @brief Sets an internal framework.
157 void SetFramework(Framework* framework)
159 mFramework = framework;
163 * @brief Gets an internal framework.
165 * @return a pointer to the internal framework
167 Framework* GetFramework()
173 * Virtual destructor.
175 virtual ~AndroidFramework();
177 // Not copyable or movable
178 AndroidFramework(const AndroidFramework&) = delete; ///< Deleted copy constructor
179 AndroidFramework(AndroidFramework&&) = delete; ///< Deleted move constructor
180 AndroidFramework& operator=(const AndroidFramework&) = delete; ///< Deleted copy assignment operator
181 AndroidFramework& operator=(AndroidFramework&&) = delete; ///< Deleted move assignment operator
184 AndroidFramework(Dali::Integration::AndroidFramework* androidFramework);
185 Dali::Integration::AndroidFramework* mAndroidFramework;
186 Framework* mFramework;
188 android_app* mNativeApplication;
189 ANativeWindow* mWindow;
190 AAssetManager* mAssets;
191 std::string mInternalDataPath;
192 AConfiguration* mConfiguration;
196 static AndroidFramework& GetImplementation(Dali::Integration::AndroidFramework& androidFramework)
198 return *androidFramework.mImpl;
200 static Framework& GetFramework(Dali::Integration::AndroidFramework& androidFramework)
202 return *androidFramework.mImpl->mFramework;
206 } // namespace Adaptor
208 } // namespace Internal
212 #endif // DALI_INTEGRATION_ANDROID_FRAMEWORK_IMPL_H