2 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/internal/adaptor/android/android-framework-impl.h>
32 AndroidFramework* gAndroidFramework = nullptr; // raw specific pointer to allow AndroidFramework::Get
35 Dali::Integration::AndroidFramework& AndroidFramework::New()
37 Dali::Integration::AndroidFramework* androidFramework = new Dali::Integration::AndroidFramework;
38 AndroidFramework* impl = new AndroidFramework( *androidFramework );
39 androidFramework->mImpl = impl;
40 return *androidFramework;
43 void AndroidFramework::SetNativeApplication( android_app* application )
45 mNativeApplication = application;
48 android_app* AndroidFramework::GetNativeApplication() const
50 return mNativeApplication;
53 void AndroidFramework::SetJVM( JavaVM* jvm )
58 JavaVM* AndroidFramework::GetJVM() const
63 void AndroidFramework::SetApplicationAssets( AAssetManager* assets )
68 AAssetManager* AndroidFramework::GetApplicationAssets() const
73 void AndroidFramework::SetApplicationConfiguration( AConfiguration* configuration )
75 mConfiguration = configuration;
78 AConfiguration* AndroidFramework::GetApplicationConfiguration() const
80 return mConfiguration;
83 void AndroidFramework::SetApplicationWindow( ANativeWindow* window )
88 ANativeWindow* AndroidFramework::GetApplicationWindow() const
93 void AndroidFramework::OnTerminate()
95 mFramework->AppStatusHandler( APP_DESTROYED, nullptr );
98 void AndroidFramework::OnPause()
100 mFramework->AppStatusHandler( APP_PAUSE, nullptr );
103 void AndroidFramework::OnResume()
105 mFramework->AppStatusHandler( APP_RESUME, nullptr );
108 void AndroidFramework::OnWindowCreated( ANativeWindow* window )
110 mFramework->AppStatusHandler( APP_WINDOW_CREATED, window );
113 void AndroidFramework::OnWindowDestroyed( ANativeWindow* window )
115 mFramework->AppStatusHandler( APP_WINDOW_DESTROYED, window );
118 Dali::Integration::AndroidFramework& AndroidFramework::Get()
120 DALI_ASSERT_ALWAYS( gAndroidFramework != nullptr && "AndroidFramework not instantiated" );
122 return gAndroidFramework->mAndroidFramework;
125 AndroidFramework::AndroidFramework( Dali::Integration::AndroidFramework& androidFramework )
126 : mAndroidFramework( androidFramework ),
127 mFramework( nullptr ),
128 mNativeApplication( nullptr ),
131 mConfiguration( nullptr ),
134 DALI_ASSERT_ALWAYS( gAndroidFramework == nullptr && "Cannot create more than one AndroidFramework." );
136 gAndroidFramework = this;
139 AndroidFramework::~AndroidFramework()
141 gAndroidFramework = nullptr;
144 } // namespace Adaptor
146 } // namespace Internal