From: Anton Obzhirov Date: Wed, 29 Jan 2020 18:02:54 +0000 (+0000) Subject: Add Android DALi demo build. X-Git-Tag: dali_1.5.1~2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d2faadf5269d5ffa65175b35266af3bc7be3ece9;p=platform%2Fcore%2Fuifw%2Fdali-demo.git Add Android DALi demo build. Generates DALi examples shared objects and Android DALi launcher application. Android DALi application apk then can be installed on supported Android device. Change-Id: I2f87030feab33aa5c4c944323eb0ca0c042db6bd --- diff --git a/README.md b/README.md index e4ee788..d154302 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ ### Requirements - - Ubuntu 14.04 or later + - Ubuntu 16.04 or later - Environment created using dali_env script in dali-core repository - GCC version 6 @@ -71,3 +71,34 @@ Before running make install as normal: - Add all source files for the required example in this directory. - Modify "com.samsung.dali-demo.xml" to include your example so that it can be launched on target. - No changes are required to the make system as long as the above is followed, your example will be automatically built & installed. + +## 3. Building for Android + +### Requirements + + - Ubuntu 16.04 or later + - GCC version 6 + +### Building the Repository + +To build the repository enter the 'build/android' folder: + + $ cd dali-demo/build/android + +Then run the following command: + + $ ./build.sh + +For debug build: + + $ DEBUG=1 ./build.sh + +To clean the build: + + $ ./build.sh clean + +To install apks: + + $ adb install -r ./app/build/outputs/apk/debug/dali-demo-debug.apk + $ adb install -r ./app/build/outputs/apk/release/dali-demo-release.apk + diff --git a/build/android/.gitignore b/build/android/.gitignore new file mode 100644 index 0000000..e136078 --- /dev/null +++ b/build/android/.gitignore @@ -0,0 +1,7 @@ +build +gradle +.gradle +gradlew +gradlew.bat +local.properties +gradle.properties diff --git a/build/android/app/.gitignore b/build/android/app/.gitignore new file mode 100644 index 0000000..0e60033 --- /dev/null +++ b/build/android/app/.gitignore @@ -0,0 +1 @@ +.cxx diff --git a/build/android/app/build.gradle b/build/android/app/build.gradle new file mode 100644 index 0000000..28042e4 --- /dev/null +++ b/build/android/app/build.gradle @@ -0,0 +1,120 @@ +apply plugin: 'com.android.application' + +def buildType = "debug" +def androidABI = System.getenv('TARGET') +def daliDir = System.getenv('DALI_DIR') +def daliEnvDir = System.getenv('DALI_ENV_DIR') +def daliEnvLibDir = daliEnvDir + '/lib' +def daliEnvFilesDir = daliEnvDir + '/files' + +android { + signingConfigs { + config { + storeFile file("../key.jks") + storePassword "Samsung" + keyAlias "key0" + keyPassword "Samsung" + } + } + compileSdkVersion 28 + defaultConfig { + applicationId = 'com.sec.dalidemo' + minSdkVersion 26 + targetSdkVersion 26 + versionCode 1 + versionName "1.0" + externalNativeBuild { + cmake { + cppFlags "-fexceptions -frtti -w -Wall -std=gnu++11" + arguments '-DANDROID_STL=c++_shared' + } + } + } + project.archivesBaseName = 'dali-demo' + aaptOptions { + noCompress '' + } + buildTypes { + debug { + ndk { + abiFilters androidABI + } + buildType = "debug" + } + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), + 'proguard-rules.pro' + ndk { + abiFilters androidABI + } + + signingConfig signingConfigs.config + buildType = "release" + } + } + packagingOptions { + if( androidABI == "arm64-v8a" ) + { + pickFirst 'lib/arm64-v8a/libc++_shared.so' + pickFirst 'lib/arm64-v8a/libdaliview.so' + } + else + { + pickFirst 'lib/armeabi-v7a/libc++_shared.so' + pickFirst 'lib/armeabi-v7a/libdaliview.so' + } + } + sourceSets { + main { + jniLibs.srcDirs += daliEnvLibDir + assets.srcDirs += daliEnvFilesDir + } + } + lintOptions { + checkReleaseBuilds false + } + externalNativeBuild { + cmake { + version '3.10.2' + path 'src/main/cpp/CMakeLists.txt' + } + } + compileOptions { + targetCompatibility = 1.6 + sourceCompatibility = 1.6 + } +} + +dependencies { + implementation fileTree(include: ['*.jar'], dir: 'libs') + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' +} + +task buildDaliDependencies(type:Exec) { + environment "PREFIX", daliEnvDir + environment "ANDROID_ABI", androidABI + environment "ANDROID_PLATFORM", "26" + if (buildType == 'debug') + environment "DEBUG", "1" + workingDir file(daliDir + '/android-dependencies/cmake').getAbsolutePath() + commandLine 'sh', './buildall.sh' +} + +task buildDali(type:Exec) { + workingDir "../dali" + if (buildType == 'debug') + environment "DEBUG", "1" + commandLine 'sh', './build.sh' +} + +task cleanDali(type:Exec) { + workingDir "../dali" + commandLine 'sh', './build.sh', 'clean' +} + +buildDali.dependsOn buildDaliDependencies +preBuild.dependsOn buildDali + +clean.dependsOn cleanDali diff --git a/build/android/app/src/main/AndroidManifest.xml b/build/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..15e8dc0 --- /dev/null +++ b/build/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/android/app/src/main/cpp/CMakeLists.txt b/build/android/app/src/main/cpp/CMakeLists.txt new file mode 100644 index 0000000..39e67ad --- /dev/null +++ b/build/android/app/src/main/cpp/CMakeLists.txt @@ -0,0 +1,54 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 3.4.1) + +SET(DALI_ENV_DIR $ENV{DALI_ENV_DIR}) +SET(ENV{PKG_CONFIG_PATH} "${DALI_ENV_DIR}/lib/${ANDROID_ABI}/pkgconfig:$ENV{PKG_CONFIG_PATH}") +FIND_PACKAGE(PkgConfig REQUIRED) + +SET(ANDROID_SDK $ENV{ANDROID_SDK}) +SET(ANDROID_NDK $ENV{ANDROID_NDK}) + +# build native_app_glue as a static lib +ADD_LIBRARY(native_app_glue STATIC + ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c) + +# now build app's shared lib +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -frtti -w -Wall -std=gnu++11") + +# Export ANativeActivity_onCreate(), +# Refer to: https://github.com/android-ndk/ndk/issues/381. +SET(CMAKE_SHARED_LINKER_FLAGS + "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate") + +ADD_LIBRARY(native-activity SHARED main.cpp) + +TARGET_INCLUDE_DIRECTORIES(native-activity PRIVATE + ${ANDROID_NDK}/sources/android/native_app_glue) + +INCLUDE_DIRECTORIES(${DALI_ENV_DIR}/include) +INCLUDE_DIRECTORIES(${DALI_ENV_DIR}/include/dali) + +IF(${CMAKE_BUILD_TYPE} STREQUAL "Debug") + SET(ENABLE_TRACE ON) +ELSE() + SET(ENABLE_TRACE OFF) +ENDIF() + +IF(EXISTS "${DALI_ENV_DIR}") + PKG_CHECK_MODULES(DALI_CORE dali-core REQUIRED NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH) + PKG_CHECK_MODULES(DALI_ADAPTOR dali-adaptor REQUIRED NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH) + PKG_CHECK_MODULES(DALI_TOOLKIT dali-toolkit REQUIRED NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH) +ELSE() + MESSAGE(WARNING "${DALI_ENV_DIR} not found!") +ENDIF() + +# add lib dependencies +TARGET_LINK_LIBRARIES(native-activity + ${DALI_TOOLKIT_LDFLAGS} + ${DALI_ADAPTOR_LDFLAGS} + ${DALI_CORE_LDFLAGS} + native_app_glue + z + android + log + EGL + GLESv3) diff --git a/build/android/app/src/main/cpp/main.cpp b/build/android/app/src/main/cpp/main.cpp new file mode 100644 index 0000000..02fb4c4 --- /dev/null +++ b/build/android/app/src/main/cpp/main.cpp @@ -0,0 +1,293 @@ +/* + * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +// from android_native_app_glue.c +#ifndef NDEBUG +#define LOGV(...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, "dalidemo", __VA_ARGS__)) +#else +#define LOGV(...) ((void)0) +#endif + +namespace +{ + +void free_saved_state(struct android_app *android_app) +{ + pthread_mutex_lock(&android_app->mutex); + + if (android_app->savedState != NULL) + { + free(android_app->savedState); + android_app->savedState = NULL; + android_app->savedStateSize = 0; + } + + pthread_mutex_unlock(&android_app->mutex); +} + +void android_app_destroy(struct android_app *android_app) +{ + LOGV("android_app_destroy"); + free_saved_state(android_app); + pthread_mutex_lock(&android_app->mutex); + + if (android_app->inputQueue != NULL) + { + AInputQueue_detachLooper(android_app->inputQueue); + } + + AConfiguration_delete(android_app->config); + android_app->destroyed = 1; + + pthread_cond_broadcast(&android_app->cond); + pthread_mutex_unlock(&android_app->mutex); + + // Can't touch android_app object after this. +} + +} + +void ExtractAsset(struct android_app* state, const std::string& assetPath, const std::string& filePath) +{ + AAsset* asset = AAssetManager_open(state->activity->assetManager, assetPath.c_str(), AASSET_MODE_BUFFER); + if (asset) + { + size_t length = AAsset_getLength(asset) + 1; + + char* buffer = new char[length]; + length = AAsset_read(asset, buffer, length); + + FILE* file = fopen(filePath.c_str(), "wb"); + if (file) + { + fwrite(buffer, 1, length, file); + fclose(file); + } + + delete[] buffer; + AAsset_close(asset); + } +} + +void ExtractAssets(struct android_app* state, const std::string& assetDirPath, const std::string& filesDirPath) +{ + AAssetDir* assetDir = AAssetManager_openDir(state->activity->assetManager, assetDirPath.c_str()); + if (assetDir) + { + if (mkdir(filesDirPath.c_str(), S_IRWXU) != -1) + { + const char *filename = NULL; + std::string assetPath = assetDirPath + "/"; + while ((filename = AAssetDir_getNextFileName(assetDir)) != NULL) + { + ExtractAsset(state, assetPath + filename, filesDirPath + "/" + filename); + } + } + + AAssetDir_close(assetDir); + } +} + +void ExtractFontConfig(struct android_app* state, std::string assetFontConfig, std::string fontsPath) +{ + AAsset* asset = AAssetManager_open(state->activity->assetManager, assetFontConfig.c_str(), AASSET_MODE_BUFFER); + if (asset) + { + size_t length = AAsset_getLength(asset) + 1; + + char* buffer = new char[length]; + length = AAsset_read(asset, buffer, length); + + std::string fontConfig = std::string(buffer, length); + int i = fontConfig.find("~"); + if (i != std::string::npos) + { + std::string filesDir = state->activity->internalDataPath; + fontConfig.replace(i, 1, filesDir); + } + + std::string fontsFontConfig = fontsPath; + FILE* file = fopen(fontsFontConfig.c_str(), "wb"); + if (file) + { + fwrite(fontConfig.c_str(), 1, fontConfig.size(), file); + fclose(file); + } + + delete[] buffer; + AAsset_close(asset); + } +} + +class DaliDemoNativeActivity +{ +public: + ANativeActivity* activity; + DaliDemoNativeActivity(ANativeActivity* activity) + : activity(activity) + { + } + + class NativeActivityJNI + { + public: + ANativeActivity* activity; + JNIEnv* env; + jclass clazz; + + NativeActivityJNI(ANativeActivity* activity) + : activity(activity) + { + activity->vm->AttachCurrentThread(&env, NULL); + clazz = env->GetObjectClass(activity->clazz); + } + + ~NativeActivityJNI() + { + activity->vm->DetachCurrentThread(); + } + + jstring toJString(const std::string& str) + { + return env->NewStringUTF(str.c_str()); + } + + std::string toString(jstring jstr) + { + std::string out; + if (jstr) + { + const char* utf = env->GetStringUTFChars(jstr, 0); + out = std::string(utf); + env->ReleaseStringUTFChars(jstr, utf); + } + + return out; + } + + std::string callStringMethod(const std::string& name, const std::string& arg) + { + jmethodID methodID = env->GetMethodID(clazz, name.c_str(), "(Ljava/lang/String;)Ljava/lang/String;"); + jstring jstr = (jstring)env->CallObjectMethod(activity->clazz, methodID, toJString(arg)); + return toString(jstr); + } + }; + + std::string getMetaData(const std::string& key) + { + NativeActivityJNI nativeActivityJNI(activity); + return nativeActivityJNI.callStringMethod("getMetaData", key); + } + + std::string getIntentStringExtra(const std::string& key) + { + NativeActivityJNI nativeActivityJNI(activity); + return nativeActivityJNI.callStringMethod("getIntentStringExtra", key); + } +}; + +extern "C" void FcConfigPathInit(const char* path, const char* file); + +void android_main( struct android_app* state ) +{ + std::string filesDir = state->activity->internalDataPath; + + std::string fontconfigPath = filesDir + "/fonts"; + setenv("FONTCONFIG_PATH", fontconfigPath.c_str(), 1); + + std::string fontconfigFile = fontconfigPath + "/fonts.conf"; + setenv("FONTCONFIG_FILE", fontconfigFile.c_str(), 1); + + struct stat st = { 0 }; + FcConfigPathInit( fontconfigPath.c_str(), fontconfigFile.c_str() ); + + if (stat(fontconfigPath.c_str(), &st) == -1) + { + mkdir(fontconfigPath.c_str(), S_IRWXU); + ExtractFontConfig(state, "fonts/fonts.conf", fontconfigPath + "/fonts.conf"); + ExtractFontConfig(state, "fonts/fonts.dtd", fontconfigPath + "/fonts.dtd" ); + ExtractFontConfig(state, "fonts/local.conf", fontconfigPath + "/local.conf"); + ExtractAssets(state, "fonts/dejavu", fontconfigPath + "/dejavu"); + ExtractAssets(state, "fonts/tizen", fontconfigPath + "/tizen"); + ExtractAssets(state, "fonts/bitmap", fontconfigPath + "/bitmap"); + } + + Dali::Integration::AndroidFramework::New(); + Dali::Integration::AndroidFramework::Get().SetNativeApplication( state ); + Dali::Integration::AndroidFramework::Get().SetApplicationConfiguration( state->config ); + Dali::Integration::AndroidFramework::Get().SetApplicationAssets( state->activity->assetManager ); + Dali::Integration::AndroidFramework::Get().SetInternalDataPath( filesDir ); + + DaliDemoNativeActivity nativeActivity(state->activity); + + int status = 0; + std::string libpath = "/data/data/com.sec.dalidemo/lib/libdali-demo.so"; + std::string callParam = nativeActivity.getIntentStringExtra("start"); + if (callParam.empty()) + { + callParam = nativeActivity.getMetaData("start"); + } + + if (!callParam.empty()) + { + libpath = "/data/data/com.sec.dalidemo/lib/lib" + callParam + ".so"; + } + + void* handle = dlopen( libpath.c_str(), RTLD_LAZY ); + if (!handle) + { + std::exit(status); + } + + dlerror(); /* Clear any existing error */ + + int (*main)(int, char**) = (int(*)(int, char**))dlsym(handle, "main"); + if (main) + { + status = main( 0, nullptr ); + } + + if (handle) + { + dlclose(handle); + handle = nullptr; + } + + android_app_destroy(state); + + Dali::Integration::AndroidFramework::Get().SetNativeApplication(nullptr); + Dali::Integration::AndroidFramework::Get().SetApplicationConfiguration(nullptr); + Dali::Integration::AndroidFramework::Get().SetApplicationAssets(nullptr); + Dali::Integration::AndroidFramework::Delete(); + + // We need to kill the application process manually, DALi cannot restart in the same process due to memory leaks + std::exit(status); +} + +//END_INCLUDE(all) diff --git a/build/android/app/src/main/java/com/sec/dalidemo/DaliDemoApplication.java b/build/android/app/src/main/java/com/sec/dalidemo/DaliDemoApplication.java new file mode 100644 index 0000000..7c853cc --- /dev/null +++ b/build/android/app/src/main/java/com/sec/dalidemo/DaliDemoApplication.java @@ -0,0 +1,6 @@ +package com.sec.dalidemo; + +import android.app.Application; + +public class DaliDemoApplication extends Application { +} diff --git a/build/android/app/src/main/java/com/sec/dalidemo/DaliDemoNativeActivity.java b/build/android/app/src/main/java/com/sec/dalidemo/DaliDemoNativeActivity.java new file mode 100644 index 0000000..64a7853 --- /dev/null +++ b/build/android/app/src/main/java/com/sec/dalidemo/DaliDemoNativeActivity.java @@ -0,0 +1,97 @@ +package com.sec.dalidemo; + +import android.annotation.TargetApi; +import android.app.NativeActivity; +import android.content.ComponentName; +import android.content.Context; +import android.content.pm.ActivityInfo; +import android.content.pm.ApplicationInfo; +import android.content.pm.PackageManager; +import android.os.Bundle; +import android.view.View; +import android.view.WindowManager; + +public class DaliDemoNativeActivity extends NativeActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Hide toolbar + int SDK_INT = android.os.Build.VERSION.SDK_INT; + if(SDK_INT >= 19) + { + setImmersiveSticky(); + + View decorView = getWindow().getDecorView(); + decorView.setOnSystemUiVisibilityChangeListener + (new View.OnSystemUiVisibilityChangeListener() { + @Override + public void onSystemUiVisibilityChange(int visibility) { + setImmersiveSticky(); + } + }); + } + } + + @TargetApi(19) + void setImmersiveSticky() { + View decorView = getWindow().getDecorView(); + decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN + | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY + | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); + } + + @TargetApi(19) + protected void onResume() { + super.onResume(); + + //Hide toolbar + int SDK_INT = android.os.Build.VERSION.SDK_INT; + if (SDK_INT >= 11 && SDK_INT < 14) + { + getWindow().getDecorView().setSystemUiVisibility(View.STATUS_BAR_HIDDEN); + } + else if (SDK_INT >= 14 && SDK_INT < 19) + { + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LOW_PROFILE); + } + else if (SDK_INT >= 19) + { + setImmersiveSticky(); + } + } + + protected void onPause() { + super.onPause(); + } + + public final void setSoftInputMode(boolean visible) { + if (visible) { + getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); + } + else { + getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); + } + } + + public final String getMetaData(String key) { + try { + ActivityInfo ai = getApplicationContext().getPackageManager() + .getActivityInfo(getComponentName(), PackageManager.GET_META_DATA); + Bundle bundle = ai.metaData; + if (bundle != null) + return bundle.getString(key); + } catch (PackageManager.NameNotFoundException e) { + e.printStackTrace(); + } + + return null; + } + + public final String getIntentStringExtra(String key) { + return getIntent().getStringExtra(key); + } +} diff --git a/build/android/app/src/main/java/com/sec/dalidemo/DaliExamplesNativeActivity.java b/build/android/app/src/main/java/com/sec/dalidemo/DaliExamplesNativeActivity.java new file mode 100644 index 0000000..a331a47 --- /dev/null +++ b/build/android/app/src/main/java/com/sec/dalidemo/DaliExamplesNativeActivity.java @@ -0,0 +1,5 @@ +package com.sec.dalidemo; + +public class DaliExamplesNativeActivity extends DaliDemoNativeActivity { +} + diff --git a/build/android/app/src/main/java/com/sec/dalidemo/DaliTestsNativeActivity.java b/build/android/app/src/main/java/com/sec/dalidemo/DaliTestsNativeActivity.java new file mode 100644 index 0000000..09420a7 --- /dev/null +++ b/build/android/app/src/main/java/com/sec/dalidemo/DaliTestsNativeActivity.java @@ -0,0 +1,4 @@ +package com.sec.dalidemo; + +public class DaliTestsNativeActivity extends DaliDemoNativeActivity { +} diff --git a/build/android/app/src/main/res/mipmap-hdpi/dali_examples.png b/build/android/app/src/main/res/mipmap-hdpi/dali_examples.png new file mode 100644 index 0000000..349b175 Binary files /dev/null and b/build/android/app/src/main/res/mipmap-hdpi/dali_examples.png differ diff --git a/build/android/app/src/main/res/mipmap-hdpi/dali_launcher.png b/build/android/app/src/main/res/mipmap-hdpi/dali_launcher.png new file mode 100644 index 0000000..2ea08ce Binary files /dev/null and b/build/android/app/src/main/res/mipmap-hdpi/dali_launcher.png differ diff --git a/build/android/app/src/main/res/mipmap-hdpi/dali_tests.png b/build/android/app/src/main/res/mipmap-hdpi/dali_tests.png new file mode 100644 index 0000000..42280e0 Binary files /dev/null and b/build/android/app/src/main/res/mipmap-hdpi/dali_tests.png differ diff --git a/build/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/build/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..cde69bc Binary files /dev/null and b/build/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/build/android/app/src/main/res/mipmap-mdpi/dali_examples.png b/build/android/app/src/main/res/mipmap-mdpi/dali_examples.png new file mode 100644 index 0000000..349b175 Binary files /dev/null and b/build/android/app/src/main/res/mipmap-mdpi/dali_examples.png differ diff --git a/build/android/app/src/main/res/mipmap-mdpi/dali_launcher.png b/build/android/app/src/main/res/mipmap-mdpi/dali_launcher.png new file mode 100644 index 0000000..e7100a3 Binary files /dev/null and b/build/android/app/src/main/res/mipmap-mdpi/dali_launcher.png differ diff --git a/build/android/app/src/main/res/mipmap-mdpi/dali_tests.png b/build/android/app/src/main/res/mipmap-mdpi/dali_tests.png new file mode 100644 index 0000000..42280e0 Binary files /dev/null and b/build/android/app/src/main/res/mipmap-mdpi/dali_tests.png differ diff --git a/build/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/build/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..c133a0c Binary files /dev/null and b/build/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/build/android/app/src/main/res/mipmap-xhdpi/dali_examples.png b/build/android/app/src/main/res/mipmap-xhdpi/dali_examples.png new file mode 100644 index 0000000..349b175 Binary files /dev/null and b/build/android/app/src/main/res/mipmap-xhdpi/dali_examples.png differ diff --git a/build/android/app/src/main/res/mipmap-xhdpi/dali_launcher.png b/build/android/app/src/main/res/mipmap-xhdpi/dali_launcher.png new file mode 100644 index 0000000..2eb63d4 Binary files /dev/null and b/build/android/app/src/main/res/mipmap-xhdpi/dali_launcher.png differ diff --git a/build/android/app/src/main/res/mipmap-xhdpi/dali_tests.png b/build/android/app/src/main/res/mipmap-xhdpi/dali_tests.png new file mode 100644 index 0000000..42280e0 Binary files /dev/null and b/build/android/app/src/main/res/mipmap-xhdpi/dali_tests.png differ diff --git a/build/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/build/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..bfa42f0 Binary files /dev/null and b/build/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/build/android/app/src/main/res/mipmap-xxhdpi/dali_examples.png b/build/android/app/src/main/res/mipmap-xxhdpi/dali_examples.png new file mode 100644 index 0000000..349b175 Binary files /dev/null and b/build/android/app/src/main/res/mipmap-xxhdpi/dali_examples.png differ diff --git a/build/android/app/src/main/res/mipmap-xxhdpi/dali_launcher.png b/build/android/app/src/main/res/mipmap-xxhdpi/dali_launcher.png new file mode 100644 index 0000000..6a18f3d Binary files /dev/null and b/build/android/app/src/main/res/mipmap-xxhdpi/dali_launcher.png differ diff --git a/build/android/app/src/main/res/mipmap-xxhdpi/dali_tests.png b/build/android/app/src/main/res/mipmap-xxhdpi/dali_tests.png new file mode 100644 index 0000000..42280e0 Binary files /dev/null and b/build/android/app/src/main/res/mipmap-xxhdpi/dali_tests.png differ diff --git a/build/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/build/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..324e72c Binary files /dev/null and b/build/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/build/android/app/src/main/res/values/strings.xml b/build/android/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..e07cdd0 --- /dev/null +++ b/build/android/app/src/main/res/values/strings.xml @@ -0,0 +1,7 @@ + + + DALi + DALi Demo + DALi Examples + DALi Tests + diff --git a/build/android/build.gradle b/build/android/build.gradle new file mode 100644 index 0000000..5b10372 --- /dev/null +++ b/build/android/build.gradle @@ -0,0 +1,26 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +buildscript { + repositories { + google() + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:3.5.2' + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} + + + + + diff --git a/build/android/build.sh b/build/android/build.sh new file mode 100755 index 0000000..6e0bf9f --- /dev/null +++ b/build/android/build.sh @@ -0,0 +1,93 @@ +[ -z $ROOT_DIR ] && ROOT_DIR=$HOME +echo "Using ROOT_DIR=\"$ROOT_DIR\"" + +[ -z $DALI_DIR ] && DALI_DIR=$(cd ../../../;pwd) +echo "Using DALI_DIR=\"$DALI_DIR\"" +export DALI_DIR=$DALI_DIR + +[ -z $DALI_ENV_DIR ] && DALI_ENV_DIR=$DALI_DIR/dali-env/android +echo "Using DALI_ENV_DIR=\"$DALI_ENV_DIR\"" +export DALI_ENV_DIR=$DALI_ENV_DIR + +[ -z $TARGET ] && export TARGET=armeabi-v7a +echo "Using TARGET=\"$TARGET\"" + +if [ ! -z $http_proxy ] +then + proxyFull=${http_proxy/http:\/\/} + proxyHost=$(echo $proxyFull | cut -d: -f 1) + proxyPort=$(echo $proxyFull | cut -d: -f 2) + SdbProxyOptions="--proxy=http --proxy_host=$proxyHost --proxy_port=$proxyPort" + echo "Proxy detected Host:$proxyHost Port:$proxyPort" +fi + +if [ ! -d "$ANDROID_SDK" ]; then + if [ ! -d "$ROOT_DIR/Android/Sdk" ]; then + mkdir -p "$ROOT_DIR/Android/Sdk" + cd "$ROOT_DIR/Android/Sdk" + wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip + unzip sdk-tools-linux-4333796.zip + tools/bin/sdkmanager --update $SdbProxyOptions + yes | tools/bin/sdkmanager $SdbProxyOptions "patcher;v4" "platform-tools" "platforms;android-29" "build-tools;29.0.2" "lldb;3.1" "cmake;3.10.2.4988404" "ndk-bundle" "ndk;20.1.5948944" + cd - + fi +fi + +if [ ! -d "$ANDROID_SDK" ]; then +# try default path + if [ -d "$ROOT_DIR/Android/Sdk" ]; then + export ANDROID_SDK=$ROOT_DIR/Android/Sdk + fi +fi + +if [ ! -d "$ANDROID_NDK" ]; then + if [ -d "$ANDROID_SDK" ]; then + NDK_DIR=$(find $ANDROID_SDK -maxdepth 2 -name ndk-build | sed 's/\/ndk-build//') + if [ -d "$NDK_DIR" ]; then + export ANDROID_NDK=$NDK_DIR + fi + fi +fi + +if [ ! -d "$ROOT_DIR/gradle/gradle-5.4.1" ]; then + mkdir -p $ROOT_DIR/gradle + cd $ROOT_DIR/gradle + wget https://services.gradle.org/distributions/gradle-5.4.1-bin.zip + unzip gradle-5.4.1-bin.zip + cd - +fi + +GRADLE_PROPERTIES_FILE=gradle.properties +if [ ! -f $GRADLE_PROPERTIES_FILE ] +then + echo "org.gradle.jvmargs=-Xmx1536m" > $GRADLE_PROPERTIES_FILE + if [ ! -z $http_proxy ] + then + echo "systemProp.http.proxyHost=$proxyHost" >> $GRADLE_PROPERTIES_FILE + echo "systemProp.http.proxyPort=$proxyPort" >> $GRADLE_PROPERTIES_FILE + + if [ ! -z $https_proxy ] + then + httpsProxyFull=${https_proxy/https:\/\/} + httpsProxyHost=$(echo $httpsProxyFull | cut -d: -f 1) + httpsProxyPort=$(echo $httpsProxyFull | cut -d: -f 2) + echo "systemProp.https.proxyHost=$httpsProxyHost" >> $GRADLE_PROPERTIES_FILE + echo "systemProp.https.proxyPort=$httpsProxyPort" >> $GRADLE_PROPERTIES_FILE + fi + fi +fi + +export PATH=$PATH:$ROOT_DIR/gradle/gradle-5.4.1/bin +[ ! -f local.properties ] && echo 'sdk.dir='$(echo $ANDROID_SDK) > local.properties + +gradle wrapper +if [ "$1" = "clean" ]; then + ./gradlew clean +else + if [ -z "$DEBUG" ]; then + ./gradlew assembleRelease + else + ./gradlew assembleDebug + fi +fi + diff --git a/build/android/dali/.gitignore b/build/android/dali/.gitignore new file mode 100644 index 0000000..d5e56bb --- /dev/null +++ b/build/android/dali/.gitignore @@ -0,0 +1,7 @@ +lib +obj +dali-core +dali-adaptor +dali-toolkit +dali-demo + diff --git a/build/android/dali/build.sh b/build/android/dali/build.sh new file mode 100755 index 0000000..62969f4 --- /dev/null +++ b/build/android/dali/build.sh @@ -0,0 +1,33 @@ +#!/bin/bash +if [ -z "$ANDROID_SDK" ]; then + . ./env.sh +fi + +if [ ! -d "$ANDROID_SDK" ]; then + echo "Please install Android SDK into "$ANDROID_SDK + exit 1 +fi + +if [ ! -d "$ANDROID_NDK" ]; then + echo "Please install Android NDK into "$ANDROID_NDK + exit 1 +fi + +if [ "$1" = "clean" ]; then + echo "Cleaning dali..." + rm -rf ./dali-core + rm -rf ./dali-adaptor + rm -rf ./dali-toolkit + rm -rf ./dali-demo + exit 0 +fi + +if [ ! -z "$DEBUG" ]; then + export ENABLE_TRACE=ON +fi + +ANDROID_PLATFORM=26 ANDROID_ABI=${TARGET} ./build_core.sh || exit 1 +ANDROID_PLATFORM=26 ANDROID_ABI=${TARGET} ./build_adaptor.sh || exit 1 +ANDROID_PLATFORM=26 ANDROID_ABI=${TARGET} ./build_toolkit.sh || exit 1 +ANDROID_PLATFORM=26 ANDROID_ABI=${TARGET} ./build_demo.sh || exit 1 + diff --git a/build/android/dali/build_adaptor.sh b/build/android/dali/build_adaptor.sh new file mode 100755 index 0000000..76ab10e --- /dev/null +++ b/build/android/dali/build_adaptor.sh @@ -0,0 +1,27 @@ +if [ -d ./dali-adaptor/cmake/${ANDROID_ABI} ]; then + cd ./dali-adaptor/cmake/${ANDROID_ABI} +else + mkdir -p ./dali-adaptor/cmake/${ANDROID_ABI} + cd ./dali-adaptor/cmake/${ANDROID_ABI} + + if [ ! -z "$DEBUG" ]; then + export CMAKE_BUILD_TYPE=Debug + else + export CMAKE_BUILD_TYPE=Release + fi + + if [ -z "$ENABLE_TRACE" ]; then + export ENABLE_TRACE=OFF + fi + + export PREFIX=${DALI_ENV_DIR} + export PKG_CONFIG_LIBDIR=${ANDROID_NDK}/prebuilt/linux-x86_64/lib/pkgconfig + export PKG_CONFIG_PATH=${PREFIX}/lib/${ANDROID_ABI}/pkgconfig + export DALI_DATA_RO_DIR=assets + export DALI_DATA_RW_DIR=/data/data/com.sec.dali_demo/files + ${ANDROID_SDK}/cmake/3.10.2.4988404/bin/cmake ${DALI_DIR}/dali-adaptor/build/tizen -DCMAKE_C_COMPILER=${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -DCMAKE_CXX_COMPILER=${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=${ANDROID_PLATFORM} -DANDROID_ABI=${ANDROID_ABI} -DANDROID_NDK=${ANDROID_NDK} -DANDROID_STL=c++_shared -DCMAKE_CXX_FLAGS='-fexceptions -frtti -w -Wall -std=gnu++11' -DINCLUDE_DIR=${PREFIX}/include -DLIB_DIR=${PREFIX}/lib/${ANDROID_ABI} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DENABLE_TRACE=${ENABLE_TRACE} -DENABLE_PROFILE=ANDROID +fi + +make -j8 || exit 1 +make install || exit 1 +cd - diff --git a/build/android/dali/build_core.sh b/build/android/dali/build_core.sh new file mode 100755 index 0000000..0632405 --- /dev/null +++ b/build/android/dali/build_core.sh @@ -0,0 +1,27 @@ + +if [ -d ./dali-core/cmake/${ANDROID_ABI} ]; then + cd ./dali-core/cmake/${ANDROID_ABI} +else + mkdir -p ./dali-core/cmake/${ANDROID_ABI} + cd ./dali-core/cmake/${ANDROID_ABI} + + if [ ! -z "$DEBUG" ]; then + export CMAKE_BUILD_TYPE=Debug + else + export CMAKE_BUILD_TYPE=Release + fi + + if [ -z "$ENABLE_TRACE" ]; then + export ENABLE_TRACE=OFF + fi + + export PREFIX=${DALI_ENV_DIR} + export PKG_CONFIG_LIBDIR=${ANDROID_NDK}/prebuilt/linux-x86_64/lib/pkgconfig + export PKG_CONFIG_PATH=${PREFIX}/lib/${ANDROID_ABI}/pkgconfig + ${ANDROID_SDK}/cmake/3.10.2.4988404/bin/cmake ${DALI_DIR}/dali-core/build/tizen -DCMAKE_C_COMPILER=${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -DCMAKE_CXX_COMPILER=${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=${ANDROID_PLATFORM} -DANDROID_ABI=${ANDROID_ABI} -DANDROID_NDK=${ANDROID_NDK} -DANDROID_STL=c++_shared -DCMAKE_CXX_FLAGS='-fexceptions -frtti -w -Wall -std=gnu++11' -DINCLUDE_DIR=${PREFIX}/include -DLIB_DIR=${PREFIX}/lib/${ANDROID_ABI} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DENABLE_TRACE=${ENABLE_TRACE} +fi + +make -j8 || exit 1 +make install || exit 1 + +cd - diff --git a/build/android/dali/build_demo.sh b/build/android/dali/build_demo.sh new file mode 100755 index 0000000..add4444 --- /dev/null +++ b/build/android/dali/build_demo.sh @@ -0,0 +1,32 @@ + +if [ -d ./dali-demo/cmake/${ANDROID_ABI} ]; then + cd ./dali-demo/cmake/${ANDROID_ABI} +else + mkdir -p ./dali-demo/cmake/${ANDROID_ABI} + cd ./dali-demo/cmake/${ANDROID_ABI} + + if [ ! -z "$DEBUG" ]; then + export CMAKE_BUILD_TYPE=Debug + else + export CMAKE_BUILD_TYPE=Release + fi + + if [ -z "$ENABLE_TRACE" ]; then + export ENABLE_TRACE=OFF + fi + + export PREFIX=${DALI_ENV_DIR} + export PKG_CONFIG_LIBDIR=${ANDROID_NDK}/prebuilt/linux-x86_64/lib/pkgconfig + export PKG_CONFIG_PATH=${PREFIX}/lib/${ANDROID_ABI}/pkgconfig + export DALI_APP_RES_DIR=${PREFIX}/files + export DALI_APP_DIR=${PREFIX}/lib/${ANDROID_ABI} + export DALI_DEMO_RES_DIR=assets + + ${ANDROID_SDK}/cmake/3.10.2.4988404/bin/cmake ${DALI_DIR}/dali-demo/build/tizen -DCMAKE_C_COMPILER=${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -DCMAKE_CXX_COMPILER=${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=${ANDROID_PLATFORM} -DANDROID_ABI=${ANDROID_ABI} -DANDROID_NDK=${ANDROID_NDK} -DANDROID_STL=c++_shared -DCMAKE_CXX_FLAGS='-fexceptions -frtti -w -Wall -std=gnu++11' -DINCLUDE_DIR=${PREFIX}/include -DLIB_DIR=${PREFIX}/lib/${ANDROID_ABI} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DENABLE_TRACE=${ENABLE_TRACE} -DINTERNATIONALIZATION=OFF -DSHARED=ON -DDALI_APP_RES_DIR=${DALI_APP_RES_DIR} -DDALI_APP_DIR=${DALI_APP_DIR} -DDALI_DEMO_RES_DIR=${DALI_DEMO_RES_DIR} +fi + +make -j8 || exit 1 +make install || exit 1 + +cd - + diff --git a/build/android/dali/build_toolkit.sh b/build/android/dali/build_toolkit.sh new file mode 100755 index 0000000..3b4f9a9 --- /dev/null +++ b/build/android/dali/build_toolkit.sh @@ -0,0 +1,33 @@ + +if [ -d ./dali-toolkit/cmake/${ANDROID_ABI} ]; then + cd ./dali-toolkit/cmake/${ANDROID_ABI} +else + mkdir -p ./dali-toolkit/cmake/${ANDROID_ABI} + cd ./dali-toolkit/cmake/${ANDROID_ABI} + + if [ ! -z "$DEBUG" ]; then + export CMAKE_BUILD_TYPE=Debug + else + export CMAKE_BUILD_TYPE=Release + fi + + if [ -z "$ENABLE_TRACE" ]; then + export ENABLE_TRACE=OFF + fi + + export PREFIX=${DALI_ENV_DIR} + export PKG_CONFIG_LIBDIR=${ANDROID_NDK}/prebuilt/linux-x86_64/lib/pkgconfig + export PKG_CONFIG_PATH=${PREFIX}/lib/${ANDROID_ABI}/pkgconfig + export DALI_DATA_RO_DIR=assets + export DALI_DATA_RW_DIR=/data/data/com.sec.dali_demo/files + export DALI_DATA_RO_INSTALL_DIR=${PREFIX}/files + export DALI_DATA_RW_INSTALL_DIR=${PREFIX}/files + + ${ANDROID_SDK}/cmake/3.10.2.4988404/bin/cmake ${DALI_DIR}/dali-toolkit/build/tizen -DCMAKE_C_COMPILER=${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -DCMAKE_CXX_COMPILER=${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=${ANDROID_PLATFORM} -DANDROID_ABI=${ANDROID_ABI} -DANDROID_NDK=${ANDROID_NDK} -DANDROID_STL=c++_shared -DCMAKE_CXX_FLAGS='-fexceptions -frtti -w -Wall -std=gnu++11' -DINCLUDE_DIR=${PREFIX}/include -DLIB_DIR=${PREFIX}/lib/${ANDROID_ABI} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DENABLE_TRACE=${ENABLE_TRACE} -DWITH_STYLE='2048x1080' +fi + +make -j8 || exit 1 +make install || exit 1 +cp -R ${DALI_DIR}/dali-toolkit/automated-tests/resources/fonts/* ${DALI_DIR}/dali-env/android/files/fonts + +cd - diff --git a/build/android/dali/env.sh b/build/android/dali/env.sh new file mode 100755 index 0000000..09f0539 --- /dev/null +++ b/build/android/dali/env.sh @@ -0,0 +1,23 @@ +if [ ! -d "$ANDROID_SDK" ]; then +# try default path +if [ -d "$HOME/Android/Sdk" ]; then +export ANDROID_SDK=$HOME/Android/Sdk +fi +fi + +if [ ! -d "$ANDROID_NDK" ]; then +if [ -d $ANDROID_SDK ]; then +NDK_DIR=$(find $ANDROID_SDK -maxdepth 2 -name ndk-build | sed 's/\/ndk-build//') +if [ -d "$NDK_DIR" ]; then +export ANDROID_NDK=$NDK_DIR +fi +fi +fi + +if [ ! -d "$DALI_DIR" ]; then +export DALI_DIR=$(cd ../../../../; pwd) +fi + +if [ ! -d "$DALI_ENV_DIR" ]; then +export DALI_ENV_DIR=$DALI_DIR/dali-env/android +fi diff --git a/build/android/key.jks b/build/android/key.jks new file mode 100644 index 0000000..f2502d9 Binary files /dev/null and b/build/android/key.jks differ diff --git a/build/android/settings.gradle b/build/android/settings.gradle new file mode 100644 index 0000000..573abcb --- /dev/null +++ b/build/android/settings.gradle @@ -0,0 +1,2 @@ +include ':app' + diff --git a/build/tizen/CMakeLists.txt b/build/tizen/CMakeLists.txt index a0b8322..f6d8ad8 100644 --- a/build/tizen/CMakeLists.txt +++ b/build/tizen/CMakeLists.txt @@ -17,15 +17,15 @@ SET(DEMO_SHARED ${CMAKE_SOURCE_DIR}/../../shared) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) IF(DEFINED DALI_APP_DIR) - SET(BINDIR ${DALI_APP_DIR}/bin) + SET(BINDIR ${DALI_APP_DIR}) ELSE() - SET(BINDIR ${PREFIX}/bin) + SET(BINDIR ${PREFIX}/bin) ENDIF() IF(DEFINED DALI_APP_RES_DIR) - SET(APP_DATA_RES_DIR ${DALI_APP_RES_DIR}) + SET(APP_DATA_RES_DIR ${DALI_APP_RES_DIR}) ELSE() - SET(APP_DATA_RES_DIR ${PREFIX}/share/com.samsung.dali-demo/res) + SET(APP_DATA_RES_DIR ${PREFIX}/share/com.samsung.dali-demo/res) ENDIF() MESSAGE( STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE} ) @@ -42,7 +42,11 @@ SET(LOCAL_MODELS_DIR ${RESOURCE_DIR}/models) SET(LOCAL_SCRIPTS_DIR ${RESOURCE_DIR}/scripts) SET(LOCAL_SHADERS_DIR ${RESOURCE_DIR}/shaders) IF(NOT DEFINED LOCAL_STYLE_DIR) - SET(LOCAL_STYLE_DIR ${RESOURCE_DIR}/style) + SET(LOCAL_STYLE_DIR ${RESOURCE_DIR}/style) +ENDIF() + +IF(ANDROID) + SET(LOCAL_STYLE_ANDROID_DIR ${RESOURCE_DIR}/style/android) ENDIF() SET(IMAGES_DIR ${APP_DATA_RES_DIR}/images/) @@ -54,23 +58,36 @@ SET(SHADERS_DIR ${APP_DATA_RES_DIR}/shaders/) SET(STYLE_DIR ${APP_DATA_RES_DIR}/style/) IF(NOT DEFINED LOCALE_DIR) - SET(LOCALE_DIR ${PREFIX}/share/locale) + SET(LOCALE_DIR ${PREFIX}/share/locale) +ENDIF() + +IF(DEFINED DALI_DEMO_RES_DIR) + SET(DEMO_IMAGE_DIR \\"${DALI_DEMO_RES_DIR}/images/\\") + SET(DEMO_GAME_DIR \\"${DALI_DEMO_RES_DIR}/game/\\") + SET(DEMO_VIDEO_DIR \\"${DALI_DEMO_RES_DIR}/videos/\\") + SET(DEMO_MODEL_DIR \\"${DALI_DEMO_RES_DIR}/models/\\") + SET(DEMO_SCRIPT_DIR \\"${DALI_DEMO_RES_DIR}/scripts/\\") + SET(DEMO_SHADER_DIR \\"${DALI_DEMO_RES_DIR}/shaders/\\") + SET(DEMO_STYLE_DIR \\"${DALI_DEMO_RES_DIR}/style/\\") + SET(DEMO_THEME_PATH \\"${DALI_DEMO_RES_DIR}/style/demo-theme.json\\") + SET(DEMO_LOCALE_DIR \\"${DALI_DEMO_RES_DIR}/locale\\") + SET(DEMO_STYLE_IMAGE_DIR \\"${DALI_DEMO_RES_DIR}/style/images\\") +ELSE() + SET(DEMO_GAME_DIR \\"${GAME_DIR}\\") + SET(DEMO_IMAGE_DIR \\"${IMAGES_DIR}\\") + SET(DEMO_VIDEO_DIR \\"${VIDEOS_DIR}\\") + SET(DEMO_MODEL_DIR \\"${MODELS_DIR}\\") + SET(DEMO_SCRIPT_DIR \\"${SCRIPTS_DIR}\\") + SET(DEMO_SHADER_DIR \\"${SHADERS_DIR}\\") + SET(DEMO_STYLE_DIR \\"${STYLE_DIR}\\") + SET(DEMO_THEME_PATH \\"${STYLE_DIR}demo-theme.json\\") + SET(DEMO_LOCALE_DIR \\"${LOCALE_DIR}\\") + SET(DEMO_STYLE_IMAGE_DIR ${STYLE_DIR}/images) ENDIF() -SET(DEMO_GAME_DIR \\"${GAME_DIR}\\") -SET(DEMO_IMAGE_DIR \\"${IMAGES_DIR}\\") -SET(DEMO_VIDEO_DIR \\"${VIDEOS_DIR}\\") -SET(DEMO_MODEL_DIR \\"${MODELS_DIR}\\") -SET(DEMO_SCRIPT_DIR \\"${SCRIPTS_DIR}\\") -SET(DEMO_SHADER_DIR \\"${SHADERS_DIR}\\") -SET(DEMO_STYLE_DIR \\"${STYLE_DIR}\\") -SET(DEMO_THEME_PATH \\"${STYLE_DIR}demo-theme.json\\") SET(DEMO_EXAMPLE_BIN \\"${BINDIR}/\\") -SET(DEMO_LOCALE_DIR \\"${LOCALE_DIR}\\") SET(DEMO_LANG \\"${LANG}\\") -SET(DEMO_STYLE_IMAGE_DIR ${STYLE_DIR}/images) - FILE(GLOB LOCAL_IMAGES_PNG RELATIVE "${LOCAL_IMAGES_DIR}" "${LOCAL_IMAGES_DIR}/*.png") FILE(GLOB LOCAL_IMAGES_JPG RELATIVE "${LOCAL_IMAGES_DIR}" "${LOCAL_IMAGES_DIR}/*.jpg") FILE(GLOB LOCAL_IMAGES_GIF RELATIVE "${LOCAL_IMAGES_DIR}" "${LOCAL_IMAGES_DIR}/*.gif") @@ -121,6 +138,14 @@ FOREACH(flag ${LOCAL_STYLES_LIST}) ENDFOREACH(flag) MESSAGE("Installed ${LOCAL_STYLES_LIST} to ${STYLE_DIR}") +IF(ANDROID) +FILE(GLOB LOCAL_STYLES_ANDROID_LIST "${LOCAL_STYLE_ANDROID_DIR}/*.json") +FOREACH(flag ${LOCAL_STYLES_ANDROID_LIST}) + INSTALL(FILES ${flag} DESTINATION ${STYLE_DIR}) +ENDFOREACH(flag) +MESSAGE("Installed ${LOCAL_STYLES_ANDROID_LIST} to ${STYLE_DIR}") +ENDIF() + FILE(GLOB LOCAL_STYLE_IMAGES_LIST "${LOCAL_STYLE_DIR}/images/*.png") FOREACH(flag ${LOCAL_STYLE_IMAGES_LIST}) INSTALL(FILES ${flag} DESTINATION ${STYLE_DIR}/images) diff --git a/build/tizen/demo/CMakeLists.txt b/build/tizen/demo/CMakeLists.txt index 4e73070..ac3c3f5 100644 --- a/build/tizen/demo/CMakeLists.txt +++ b/build/tizen/demo/CMakeLists.txt @@ -6,10 +6,26 @@ SET(DEMO_SRCS ${DEMO_SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp" "${ROOT_SRC_DIR}/shared/dali-table-view.cpp" - "${ROOT_SRC_DIR}/shared/execute-process-unix.cpp" ) -ADD_EXECUTABLE(${PROJECT_NAME} ${DEMO_SRCS}) +IF(ANDROID) + SET(DEMO_SRCS + ${DEMO_SRCS} + "${ROOT_SRC_DIR}/shared/execute-process-android.cpp" + ) +ELSE() + SET(DEMO_SRCS + ${DEMO_SRCS} + "${ROOT_SRC_DIR}/shared/execute-process-unix.cpp" + ) +ENDIF() + +IF(SHARED) + ADD_LIBRARY(${PROJECT_NAME} SHARED ${DEMO_SRCS}) +ELSE() + ADD_EXECUTABLE(${PROJECT_NAME} ${DEMO_SRCS}) +ENDIF() + TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${REQUIRED_PKGS_LDFLAGS} -pie) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR}) diff --git a/build/tizen/examples-reel/CMakeLists.txt b/build/tizen/examples-reel/CMakeLists.txt index 887ce5c..aae2efd 100644 --- a/build/tizen/examples-reel/CMakeLists.txt +++ b/build/tizen/examples-reel/CMakeLists.txt @@ -6,10 +6,26 @@ SET(EXAMPLES_REEL_SRCS ${EXAMPLES_REEL_SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp" "${ROOT_SRC_DIR}/shared/dali-table-view.cpp" - "${ROOT_SRC_DIR}/shared/execute-process-unix.cpp" ) -ADD_EXECUTABLE(dali-examples ${EXAMPLES_REEL_SRCS}) +IF(ANDROID) + SET(EXAMPLES_REEL_SRCS + ${EXAMPLES_REEL_SRCS} + "${ROOT_SRC_DIR}/shared/execute-process-android.cpp" + ) +ELSE() + SET(EXAMPLES_REEL_SRCS + ${EXAMPLES_REEL_SRCS} + "${ROOT_SRC_DIR}/shared/execute-process-unix.cpp" + ) +ENDIF() + +IF(SHARED) + ADD_LIBRARY(dali-examples SHARED ${EXAMPLES_REEL_SRCS}) +ELSE() + ADD_EXECUTABLE(dali-examples ${EXAMPLES_REEL_SRCS}) +ENDIF() + TARGET_LINK_LIBRARIES(dali-examples ${REQUIRED_PKGS_LDFLAGS} -pie) INSTALL(TARGETS dali-examples DESTINATION ${BINDIR}) diff --git a/build/tizen/examples/CMakeLists.txt b/build/tizen/examples/CMakeLists.txt index ee0d04f..3a55570 100644 --- a/build/tizen/examples/CMakeLists.txt +++ b/build/tizen/examples/CMakeLists.txt @@ -16,7 +16,11 @@ SUBDIRLIST(SUBDIRS ${EXAMPLES_SRC_DIR}) FOREACH(EXAMPLE ${SUBDIRS}) FILE(GLOB SRCS "${EXAMPLES_SRC_DIR}/${EXAMPLE}/*.cpp") SET(SRCS ${SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp") - ADD_EXECUTABLE(${EXAMPLE}.example ${SRCS}) + IF(SHARED) + ADD_LIBRARY(${EXAMPLE}.example SHARED ${SRCS}) + ELSE() + ADD_EXECUTABLE(${EXAMPLE}.example ${SRCS}) + ENDIF() TARGET_LINK_LIBRARIES(${EXAMPLE}.example ${REQUIRED_PKGS_LDFLAGS} -pie) INSTALL(TARGETS ${EXAMPLE}.example DESTINATION ${BINDIR}) ENDFOREACH(EXAMPLE) diff --git a/build/tizen/tests-reel/CMakeLists.txt b/build/tizen/tests-reel/CMakeLists.txt index 2eb4c53..6c69839 100644 --- a/build/tizen/tests-reel/CMakeLists.txt +++ b/build/tizen/tests-reel/CMakeLists.txt @@ -6,10 +6,25 @@ SET(TESTS_REEL_SRCS ${TESTS_REEL_SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp" "${ROOT_SRC_DIR}/shared/dali-table-view.cpp" - "${ROOT_SRC_DIR}/shared/execute-process-unix.cpp" ) -ADD_EXECUTABLE(dali-tests ${TESTS_REEL_SRCS}) +IF(ANDROID) + SET(TESTS_REEL_SRCS + ${TESTS_REEL_SRCS} + "${ROOT_SRC_DIR}/shared/execute-process-android.cpp" + ) +ELSE() + SET(TESTS_REEL_SRCS + ${TESTS_REEL_SRCS} + "${ROOT_SRC_DIR}/shared/execute-process-unix.cpp" + ) +ENDIF() + +IF(SHARED) + ADD_LIBRARY(dali-tests SHARED ${TESTS_REEL_SRCS}) +ELSE() + ADD_EXECUTABLE(dali-tests ${TESTS_REEL_SRCS}) +ENDIF() TARGET_LINK_LIBRARIES(dali-tests ${REQUIRED_PKGS_LDFLAGS} -pie) INSTALL(TARGETS dali-tests DESTINATION ${BINDIR}) diff --git a/demo/dali-demo.cpp b/demo/dali-demo.cpp index b720769..2884a32 100644 --- a/demo/dali-demo.cpp +++ b/demo/dali-demo.cpp @@ -27,9 +27,11 @@ using namespace Dali; int DALI_EXPORT_API main(int argc, char **argv) { // Configure gettext for internalization +#ifdef INTERNATIONALIZATION_ENABLED bindtextdomain(DALI_DEMO_DOMAIN_LOCAL, DEMO_LOCALE_DIR); textdomain(DALI_DEMO_DOMAIN_LOCAL); setlocale(LC_ALL, DEMO_LANG); +#endif Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); diff --git a/examples-reel/dali-examples-reel.cpp b/examples-reel/dali-examples-reel.cpp index a1358a8..f525f07 100644 --- a/examples-reel/dali-examples-reel.cpp +++ b/examples-reel/dali-examples-reel.cpp @@ -27,9 +27,11 @@ using namespace Dali; int DALI_EXPORT_API main(int argc, char **argv) { // Configure gettext for internalization +#ifdef INTERNATIONALIZATION_ENABLED bindtextdomain(DALI_DEMO_DOMAIN_LOCAL, DEMO_LOCALE_DIR); textdomain(DALI_DEMO_DOMAIN_LOCAL); setlocale(LC_ALL, DEMO_LANG); +#endif Application app = Application::New( &argc, &argv, DEMO_STYLE_DIR "/examples-theme.json" ); diff --git a/examples/animated-gradient-call-active/animated-gradient-call-active.cpp b/examples/animated-gradient-call-active/animated-gradient-call-active.cpp index 5f515a8..49fdd43 100644 --- a/examples/animated-gradient-call-active/animated-gradient-call-active.cpp +++ b/examples/animated-gradient-call-active/animated-gradient-call-active.cpp @@ -402,7 +402,7 @@ private: float mButtonDelay; }; -int main(int argc, char **argv) +int DALI_EXPORT_API main(int argc, char **argv) { Application application = Application::New( &argc, &argv ); diff --git a/examples/animated-gradient-card-active/animated-gradient-card-active.cpp b/examples/animated-gradient-card-active/animated-gradient-card-active.cpp index 3414361..2678b19 100644 --- a/examples/animated-gradient-card-active/animated-gradient-card-active.cpp +++ b/examples/animated-gradient-card-active/animated-gradient-card-active.cpp @@ -824,7 +824,7 @@ private: bool mIsTouchedActor; }; -int main(int argc, char **argv) +int DALI_EXPORT_API main(int argc, char **argv) { Application application = Application::New( &argc, &argv ); diff --git a/examples/bezier-curve/bezier-curve-example.cpp b/examples/bezier-curve/bezier-curve-example.cpp index 8fddca7..20ce083 100644 --- a/examples/bezier-curve/bezier-curve-example.cpp +++ b/examples/bezier-curve/bezier-curve-example.cpp @@ -23,6 +23,7 @@ using namespace Dali; using namespace Dali::Toolkit; +using namespace std; namespace { @@ -444,7 +445,7 @@ public: auto gridSize = mGrid.GetProperty( Actor::Property::SIZE ); // Get target value auto currentPosition = actor.GetCurrentPosition(); // Get constrained current value - position = Vector2( std::floor( currentPosition.x ), std::floor( currentPosition.y ) ); + position = Vector2( floor( currentPosition.x ), floor( currentPosition.y ) ); point.x = Clamp( position.x / gridSize.x, -0.5f, 0.5f ) + 0.5f; point.y = 0.5f - position.y / gridSize.y; @@ -612,7 +613,7 @@ private: }; -int main( int argc, char **argv ) +int DALI_EXPORT_API main( int argc, char **argv ) { Application application = Application::New( &argc, &argv ); diff --git a/examples/bloom-view/bloom-view-example.cpp b/examples/bloom-view/bloom-view-example.cpp index dd64493..7c856c1 100644 --- a/examples/bloom-view/bloom-view-example.cpp +++ b/examples/bloom-view/bloom-view-example.cpp @@ -210,7 +210,7 @@ private: BloomView mBloomView; }; -int main(int argc, char **argv) +int DALI_EXPORT_API main(int argc, char **argv) { Application application = Application::New( &argc, &argv ); diff --git a/examples/frame-callback/frame-callback.cpp b/examples/frame-callback/frame-callback.cpp index fcab8fc..52ef117 100644 --- a/examples/frame-callback/frame-callback.cpp +++ b/examples/frame-callback/frame-callback.cpp @@ -19,6 +19,7 @@ #include "frame-callback.h" using namespace Dali; +using namespace std; FrameCallback::FrameCallback() : mActorIdContainer(), @@ -46,7 +47,7 @@ void FrameCallback::Update( Dali::UpdateProxy& updateProxy, float /* elapsedSeco if( updateProxy.GetPositionAndSize( i, position, size ) ) // Retrieve the position and size using the Actor ID. { float halfWidthPoint = stageHalfWidth - size.width * 0.5f; - float xTranslation = std::abs( position.x ); + float xTranslation = abs( position.x ); if( xTranslation > halfWidthPoint ) { // Actor has hit the edge, adjust the size accordingly. diff --git a/examples/gestures/gesture-example.cpp b/examples/gestures/gesture-example.cpp index a28ab95..2cca96d 100644 --- a/examples/gestures/gesture-example.cpp +++ b/examples/gestures/gesture-example.cpp @@ -23,6 +23,7 @@ using namespace Dali; using namespace Dali::Toolkit; +using namespace std; namespace { @@ -322,8 +323,8 @@ private: // Move actor back to center if we're out of bounds Vector2 halfStageSize = Stage::GetCurrent().GetSize() * 0.5f; - if( ( std::abs( newPosition.x ) > halfStageSize.width ) || - ( std::abs( newPosition.y ) > halfStageSize.height ) ) + if( ( abs( newPosition.x ) > halfStageSize.width ) || + ( abs( newPosition.y ) > halfStageSize.height ) ) { anim.AnimateTo( Property( actor, Actor::Property::POSITION ), Vector3::ZERO, AlphaFunction::EASE_IN ); } diff --git a/examples/page-turn-view/page-turn-view-example.cpp b/examples/page-turn-view/page-turn-view-example.cpp index 1bb1411..a8e53e5 100644 --- a/examples/page-turn-view/page-turn-view-example.cpp +++ b/examples/page-turn-view/page-turn-view-example.cpp @@ -277,7 +277,7 @@ void PageTurnExample::OnKeyEvent(const KeyEvent& event) } // Entry point for applications -int main( int argc, char **argv ) +int DALI_EXPORT_API main( int argc, char **argv ) { Application app = Application::New(&argc, &argv); PageTurnExample test ( app ); diff --git a/examples/pre-render-callback/pre-render-callback-example.cpp b/examples/pre-render-callback/pre-render-callback-example.cpp index 0b10a8c..bf5173a 100644 --- a/examples/pre-render-callback/pre-render-callback-example.cpp +++ b/examples/pre-render-callback/pre-render-callback-example.cpp @@ -253,7 +253,7 @@ private: } // namespace Dali -int main( int argc, char **argv ) +int DALI_EXPORT_API main( int argc, char **argv ) { Dali::Application application = Dali::Application::New( &argc, &argv ); Dali::PreRenderCallbackController controller( application ); diff --git a/examples/refraction-effect/refraction-effect-example.cpp b/examples/refraction-effect/refraction-effect-example.cpp index a0256c9..b825388 100644 --- a/examples/refraction-effect/refraction-effect-example.cpp +++ b/examples/refraction-effect/refraction-effect-example.cpp @@ -475,7 +475,7 @@ private: Dali::Vector fileBuffer; if( !Dali::FileLoader::ReadFile( objFileName, bufferSize, fileBuffer, Dali::FileLoader::FileType::TEXT ) ) { - DALI_LOG_WARNING( "file open failed for: \"%s\"", objFileName ); + DALI_LOG_WARNING( "file open failed for: \"%s\"", objFileName.c_str() ); return; } diff --git a/examples/rendering-basic-pbr/ktx-loader.cpp b/examples/rendering-basic-pbr/ktx-loader.cpp index 790d1e2..03b6b80 100644 --- a/examples/rendering-basic-pbr/ktx-loader.cpp +++ b/examples/rendering-basic-pbr/ktx-loader.cpp @@ -114,7 +114,7 @@ bool LoadCubeMapFromKtxFile( const std::string& path, CubeData& cubedata ) // Skip the key-values: const long int imageSizeOffset = sizeof(KtxFileHeader) + header.bytesOfKeyValueData; - if( fseek(fp, imageSizeOffset, SEEK_END) ) + if( fseek(fp, 0, SEEK_END) ) { return false; } @@ -125,6 +125,8 @@ bool LoadCubeMapFromKtxFile( const std::string& path, CubeData& cubedata ) return false; } + lSize -= imageSizeOffset; + rewind(fp); if( fseek(fp, imageSizeOffset, SEEK_SET) ) diff --git a/examples/simple-bitmap-font-text-label/simple-text-label-example.cpp b/examples/simple-bitmap-font-text-label/simple-text-label-example.cpp index 04ad1fb..51845bb 100644 --- a/examples/simple-bitmap-font-text-label/simple-text-label-example.cpp +++ b/examples/simple-bitmap-font-text-label/simple-text-label-example.cpp @@ -194,7 +194,7 @@ void RunTest( Application& application ) } /** Entry point for Linux & Tizen applications */ -int main( int argc, char **argv ) +int DALI_EXPORT_API main( int argc, char **argv ) { Application application = Application::New( &argc, &argv ); diff --git a/examples/simple-text-field/simple-text-field.cpp b/examples/simple-text-field/simple-text-field.cpp index 3516e77..45fa17d 100644 --- a/examples/simple-text-field/simple-text-field.cpp +++ b/examples/simple-text-field/simple-text-field.cpp @@ -96,7 +96,7 @@ void RunTest( Application& application ) } /** Entry point for Linux & Tizen applications */ -int main( int argc, char **argv ) +int DALI_EXPORT_API main( int argc, char **argv ) { // DALI_DEMO_THEME_PATH not passed to Application so TextField example uses default Toolkit style sheet. Application application = Application::New( &argc, &argv ); diff --git a/examples/simple-text-label/simple-text-label-example.cpp b/examples/simple-text-label/simple-text-label-example.cpp index 78e7db7..89c079d 100644 --- a/examples/simple-text-label/simple-text-label-example.cpp +++ b/examples/simple-text-label/simple-text-label-example.cpp @@ -95,7 +95,7 @@ void RunTest( Application& application ) } /** Entry point for Linux & Tizen applications */ -int main( int argc, char **argv ) +int DALI_EXPORT_API main( int argc, char **argv ) { Application application = Application::New( &argc, &argv ); diff --git a/examples/simple-text-renderer/simple-text-renderer-example.cpp b/examples/simple-text-renderer/simple-text-renderer-example.cpp index c980170..676a3e1 100644 --- a/examples/simple-text-renderer/simple-text-renderer-example.cpp +++ b/examples/simple-text-renderer/simple-text-renderer-example.cpp @@ -342,7 +342,7 @@ private: }; /** Entry point for Linux & Tizen applications */ -int main( int argc, char **argv ) +int DALI_EXPORT_API main( int argc, char **argv ) { Application application = Application::New( &argc, &argv ); diff --git a/examples/simple-text-visual/simple-text-visual-example.cpp b/examples/simple-text-visual/simple-text-visual-example.cpp index b92e2a4..5964010 100644 --- a/examples/simple-text-visual/simple-text-visual-example.cpp +++ b/examples/simple-text-visual/simple-text-visual-example.cpp @@ -104,7 +104,7 @@ void RunTest( Application& application ) } /** Entry point for Linux & Tizen applications */ -int main( int argc, char **argv ) +int DALI_EXPORT_API main( int argc, char **argv ) { Application application = Application::New( &argc, &argv ); diff --git a/packaging/com.samsung.dali-demo.spec b/packaging/com.samsung.dali-demo.spec index a9245bd..67ffb68 100755 --- a/packaging/com.samsung.dali-demo.spec +++ b/packaging/com.samsung.dali-demo.spec @@ -57,7 +57,7 @@ CXXFLAGS+=" -D_ARCH_ARM_" cd %{_builddir}/%{name}-%{version}/build/tizen -cmake -DDALI_APP_DIR=%{dali_app_ro_dir} \ +cmake -DDALI_APP_DIR=%{dali_app_ro_dir}/bin \ -DLOCALE_DIR=%{locale_dir} \ -DDALI_APP_RES_DIR=%{dali_app_res_dir} \ %if 0%{?enable_debug} @@ -75,7 +75,7 @@ make %{?jobs:-j%jobs} %install rm -rf %{buildroot} cd build/tizen -%make_install DALI_APP_DIR=%{dali_app_ro_dir} +%make_install DALI_APP_DIR=%{dali_app_ro_dir}/bin %make_install DDALI_APP_RES_DIR=%{dali_app_res_dir} mkdir -p %{buildroot}%{dali_xml_file_dir} diff --git a/resources/style/android/animated-gradient-call-active-style.json b/resources/style/android/animated-gradient-call-active-style.json new file mode 100644 index 0000000..d73dc38 --- /dev/null +++ b/resources/style/android/animated-gradient-call-active-style.json @@ -0,0 +1,76 @@ +{ + "styles": { + "IncomeBackground": { + "background": { + "visualType": "ANIMATED_GRADIENT", + "gradientType": "RADIAL", + "unitType": "USER_SPACE", + "startPosition": [0.0, 0.0], + "endPosition": [180.0, 0.0], + "startColor": [0.1333, 0.1647, 0.2941, 1.0], + "endColor": [0.0784, 0.3961, 0.4863, 1.0], + "rotateCenter": [0.0, 0.0], + "rotateAmount": 0.0, + "offset": { + "startValue": 0.0, + "targetValue": 2.0, + "directionType": "BACKWARD", + "duration": 1.25, + "delay": 0.0, + "repeat": -1, + "repeatDelay": 0.0, + "motionType": "LOOP", + "easingType": "LINEAR" + } + } + }, + "ActiveBackground":{ + "background":{ + "visualType": "ANIMATED_GRADIENT", + "gradientType": "RADIAL", + "unitType": "USER_SPACE", + "startPosition": [0.0, 0.0], + "endPosition": [180.0, 0.0], + "startColor": [0.1066, 0.1318, 0.2353, 1.0], + "endColor": [0.0627, 0.3169, 0.3890, 1.0], + "rotateCenter": [0.0, 0.0], + "rotateAmount": 0.0, + "offset": { + "startValue": 0.0, + "targetValue": 2.0, + "directionType": "BACKWARD", + "duration": 4.0, + "delay": 0.0, + "repeat": -1, + "repeatDelay": 0.0, + "motionType": "LOOP", + "easingType": "LINEAR" + } + } + }, + "DeclineButton":{ + "background":{ + "visualType": "ANIMATED_GRADIENT", + "gradientType": "LINEAR", + "unitType": "USER_SPACE", + "startPosition": [-180.0, 0.0], + "endPosition": [180.0, 0.0], + "startColor": [0.8941, 0.0078, 0.0078, 1.0], + "endColor": [1.0000, 0.5961, 0.0000, 1.0], + "rotateCenter": [0.0, 0.0], + "rotateAmount": 0.78539816, + "offset": { + "startValue": 0.0, + "targetValue": 2.0, + "directionType": "FORWARD", + "duration": 1.8, + "delay": -1.2, + "repeat": -1, + "repeatDelay": 1.2, + "motionType": "LOOP", + "easingType": "IN_OUT" + } + } + } + } +} diff --git a/resources/style/android/base-theme.json b/resources/style/android/base-theme.json new file mode 100644 index 0000000..b477b96 --- /dev/null +++ b/resources/style/android/base-theme.json @@ -0,0 +1,206 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +{ + "styles": + { + "ConfirmationPopup":{ + "popupBackgroundImage":"{APPLICATION_RESOURCE_PATH}/images/00_popup_bg.9.png" + }, + + "CustomPopupStyle":{ + "popupBackgroundImage":"{APPLICATION_RESOURCE_PATH}/images/popup.9.png", + "popupBackgroundBorder":[0,4,4,0], + "tailUpImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-up.png", + "tailDownImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-down.png", + "tailLeftImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-left.png", + "tailRightImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-right.png" + }, + + "DemoTileBase": + { + "states": + { + "NORMAL": + { + "color":[0.4, 0.6, 0.9, 0.6], + "visuals": + { + "image": + { + "url":"{APPLICATION_RESOURCE_PATH}/images/demo-tile-texture.9.png", +// TILE_BACKGROUND_ALPHA +// This shader takes a texture. +// An alpha discard is performed. +// The shader uses the tiles position within the scroll-view page and the scroll-views rotation position to create a parallax effect. + "shader": + { + "fragmentShader":[ + " varying mediump vec2 vTexCoord;", + " uniform lowp vec4 uColor;", + " uniform sampler2D sTexture;", + " uniform mediump vec3 uCustomPosition;", + "", + " void main()", + " {", + " if( texture2D( sTexture, vTexCoord ).a <= 0.0001 )", + " {", + " discard;", + " }", + "", + " mediump vec2 wrapTexCoord = vec2( ( vTexCoord.x / 4.0 ) + ( uCustomPosition.x / 4.0 ) + ( uCustomPosition.z / 2.0 ), vTexCoord.y / 4.0 );", + " mediump vec4 color = texture2D( sTexture, wrapTexCoord );", + " mediump float positionWeight = ( uCustomPosition.y + 0.3 ) * color.r * 2.0;", + "", + " gl_FragColor = vec4( positionWeight, positionWeight, positionWeight, 0.9 ) * uColor + vec4( uColor.xyz, 0.0 );", + " }" + ] + } + } + } + }, + "FOCUSED": + { + "color":[0.3, 0.5, 0.8, 0.5], + "visuals": + { + "image": + { + "url":"{APPLICATION_RESOURCE_PATH}/images/demo-tile-texture-focused.9.png", +// TILE_BACKGROUND_ALPHA +// This shader takes a texture. +// An alpha discard is performed. +// The shader uses the tiles position within the scroll-view page and the scroll-views rotation position to create a parallax effect. + "shader": + { + "fragmentShader":[ + " varying mediump vec2 vTexCoord;", + " uniform lowp vec4 uColor;", + " uniform sampler2D sTexture;", + " uniform mediump vec3 uCustomPosition;", + "", + " void main()", + " {", + " if( texture2D( sTexture, vTexCoord ).a <= 0.0001 )", + " {", + " discard;", + " }", + "", + " mediump vec2 wrapTexCoord = vec2( ( vTexCoord.x / 4.0 ) + ( uCustomPosition.x / 4.0 ) + ( uCustomPosition.z / 2.0 ), vTexCoord.y / 4.0 );", + " mediump vec4 color = texture2D( sTexture, wrapTexCoord );", + " mediump float positionWeight = ( uCustomPosition.y + 0.3 ) * color.r * 2.0;", + "", + " gl_FragColor = vec4( positionWeight, positionWeight, positionWeight, 0.9 ) * uColor + vec4( uColor.xyz, 0.0 );", + " }" + ] + } + } + } + } + } + }, + "FocusActor": + { + "visuals": + { + "image": + { + "url":"{APPLICATION_RESOURCE_PATH}/images/tile-focus.9.png" + } + } + }, + "DemoTileBorder": + { + "visuals": + { + "image": + { + "url":"{APPLICATION_RESOURCE_PATH}/images/item-background.9.png" // TILE_BACKGROUND + } + } + }, + "TextLabelRosemary": + { + "fontFamily":"Rosemary" + }, + "TextLabel": + { + "fontStyle":{"weight":"normal"}, + "pointSize":8 + }, + "LauncherLabel": + { + "pointSize":8 + }, + + "ToolbarLabel": + { + "pointSize":8 + }, + + "BuilderLabel": + { + "pointSize":8 + }, + + "ScrollView": + { + "overshootEffectColor":"B018" + }, + + "ImageScalingGroupLabel": + { + "pointSize":8 + }, + + "ImageScalingButton": + { + "label":{ + "pointSize":8 + } + }, +// +// Simple Visuals Application Style section +// + "MyControl": + { + "states": + { + "NORMAL": + { + "visuals": + { + "iconVisual": + { + "url":"{APPLICATION_RESOURCE_PATH}/images/application-icon-13.png" + } + } + }, + "FOCUSED": + { + "visuals": + { + "iconVisual": + { + "url":"{APPLICATION_RESOURCE_PATH}/images/application-icon-83.png" + } + } + } + } + } + } +} diff --git a/resources/style/android/basic-light-theme.json b/resources/style/android/basic-light-theme.json new file mode 100644 index 0000000..ae863f2 --- /dev/null +++ b/resources/style/android/basic-light-theme.json @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2000-2017 Samsung Electronics Co., Ltd + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +{ + "styles": + { + // + // Simple Visuals Application styling + // + "BasicLightButton": + { + "states": + { + "NORMAL": + { + "unselectedBackgroundVisual": + { + "url":"{APPLICATION_RESOURCE_PATH}/images/button-white-up.9.png" + } + }, + "FOCUSED": + { + "unselectedBackgroundVisual": + { + "url":"{APPLICATION_RESOURCE_PATH}/images/button-white-up.9.png" + } + } + } + } + } +} diff --git a/resources/style/android/contact-cards-example-theme.json b/resources/style/android/contact-cards-example-theme.json new file mode 100644 index 0000000..3f4ea12 --- /dev/null +++ b/resources/style/android/contact-cards-example-theme.json @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +{ + "styles": + { + "ContactNameTextLabel": + { + "textColor": [ 0, 0, 0, 1 ], + "horizontalAlignment": "CENTER", + "pointSize": 8 + }, + + "ContactDetailTextLabel": + { + "textColor": [ 0, 0, 0, 1 ], + "multiLine": true, + "pointSize": 8 + } + } +} diff --git a/resources/style/android/progress-bar-example-theme.json b/resources/style/android/progress-bar-example-theme.json new file mode 100644 index 0000000..971ee7d --- /dev/null +++ b/resources/style/android/progress-bar-example-theme.json @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +{ + "styles": + { + "ProgressBar": + { + "trackVisual":{ + "url":"{APPLICATION_RESOURCE_PATH}/images/new-progress-bar-track.9.png" + }, + "progressVisual":{ + "url":"{APPLICATION_RESOURCE_PATH}/images/new-progress-bar-progress.9.png" + }, + "secondaryProgressVisual":{ + "url":"{APPLICATION_RESOURCE_PATH}/images/new-progress-bar-secondary-progress.9.png" + } + } + } +} diff --git a/resources/style/android/simple-example-theme.json b/resources/style/android/simple-example-theme.json new file mode 100644 index 0000000..d2b68e5 --- /dev/null +++ b/resources/style/android/simple-example-theme.json @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2000-2017 Samsung Electronics Co., Ltd + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +{ + "styles": + { + // + // Simple Visuals Application styling + // + "MyControl": + { + "states": + { + "NORMAL": + { + "visuals": + { + "iconVisual": + { + "url":"{APPLICATION_RESOURCE_PATH}/images/application-icon-13.png" + } + } + }, + "FOCUSED": + { + "visuals": + { + "iconVisual": + { + "url":"{APPLICATION_RESOURCE_PATH}/images/application-icon-83.png" + } + } + } + } + } + } +} diff --git a/resources/style/android/style-example-theme-one.json b/resources/style/android/style-example-theme-one.json new file mode 100644 index 0000000..74025d2 --- /dev/null +++ b/resources/style/android/style-example-theme-one.json @@ -0,0 +1,467 @@ +{ + "constants": + { + "STYLE_DIR":"{APPLICATION_RESOURCE_PATH}/style" + }, + "styles": + { + "Title":{ + "textColor":"#0000ff", + "background": + { + "visualType":"COLOR", + "mixColor": [ 1.0, 1.0, 1.0, 1.0 ] + } + }, + "TableView":{ + "background": + { + "visualType":"COLOR", + "mixColor": [ 1.0, 1.0, 1.0, 0.03 ] + } + }, + "FlexContainer":{ + "background": + { + "visualType":"COLOR", + "mixColor": [ 1.0, 1.0, 1.0, 0.1 ] + } + }, + "RadioButton":{ + "label":{ + "textColor": [1,1,1,1] + } + }, + "CheckBoxButton":{ + "label":{ + "textColor": [1,1,1,1] + } + }, + "ColorLabel1":{ + "textColor": [1,0,0,1] + }, + "ColorLabel2":{ + "textColor": [0,1,0,1] + }, + "ColorLabel3":{ + "textColor": [0.3,0.3,1,1] + }, + "ThemeLabel":{ + "textColor":[0,1,1,1] + }, + "PopupTitle":{ + "textColor":[1,1,1,1] + }, + "PopupBody":{ + "textColor":[1,1,0,1] + }, + "TextLabel":{ + "textColor":[0,0,0,1] + }, + "ColorSlider1":{ + "styles":["Slider"] + }, + "ColorSlider2":{ + "styles":["slider"] + }, + "ColorSlider3":{ + "styles":["slider"] + }, + "ImageChannelControl": + { + "enableVisibilityTransition": + [ + { + "target":"imageVisual", + "property":"opacity", + "initialValue":0, + "targetValue":1, + "animator": + { + "alphaFunction":"EASE_IN_OUT", + "timePeriod": + { + "duration":0.25, + "delay":0 + } + } + }, + { + "target":"imageVisual", + "property":"size", + "targetValue":[1,1] + } + ], + "disableVisibilityTransition": + [ + { + "target":"imageVisual", + "property":"opacity", + "targetValue":0, + "animator": + { + "alphaFunction":"EASE_IN_OUT", + "timePeriod": + { + "duration":0.25, + "delay":0 + } + } + }, + { + "target":"imageVisual", + "property":"size", + "targetValue":[1,1,1] + } + ] + }, + "ShadowButton": + { + "states": + { + "NORMAL": + { + "visuals": + { + "backgroundVisual":{ + "visualType":"IMAGE", + "url":"{STYLE_DIR}/images/shadowButtonBg.9.png", + "depthIndex":0 + }, + + "checkboxBgVisual":{ + "visualType":"IMAGE", + "url":"{STYLE_DIR}/images/CheckBg.png", + "transform":{ + "size":[0.12, 0.37], + "offset":[30,0], + "offsetPolicy":["ABSOLUTE", "ABSOLUTE"], + "sizePolicy":["RELATIVE", "RELATIVE"], + "origin":"CENTER_BEGIN", + "anchorPoint":"CENTER_BEGIN" + }, + "depthIndex":1 + }, + + "labelVisual":{ + "visualType":"TEXT", + "text":"Don't show again", + "pointSize":8, + "horizontalAlignment":"END", + "verticalAlignment":"CENTER", + "textColor":[1,1,1,1], + "mixColor":[0,0,0,1], + "transform":{ + "size":[0.9, 0.9], + "offset":[-30,0], + "offsetPolicy":["ABSOLUTE", "ABSOLUTE"], + "sizePolicy":["RELATIVE", "RELATIVE"], + "origin":"CENTER_END", + "anchorPoint":"CENTER_END" + }, + "depthIndex":1 + } + }, + + "states": + { + "CHECKED": + { + "visuals": + { + "checkboxFgVisual":{ + "visualType":"IMAGE", + "url":"{STYLE_DIR}/images/Tick.png", + "transform":{ + "size":[0.12, 0.37], + "offset":[30,0], + "offsetPolicy":["ABSOLUTE", "ABSOLUTE"], + "sizePolicy":["RELATIVE", "RELATIVE"], + "origin":"CENTER_BEGIN", + "anchorPoint":"CENTER_BEGIN" + }, + "depthIndex":2 + } + }, + "entryTransition": + [ + { + "target":"checkboxFgVisual", + "property":"pixelArea", + "initialValue":[0.0, 0.0, 0.0, 1.0], + "targetValue":[0.0, 0.0, 1.0, 1.0], + "animator": + { + "alphaFunction":"EASE_IN", + "timePeriod": + { + "duration":0.4, + "delay":0 + } + } + }, + { + "target":"checkboxFgVisual", + "property":"size", + "initialValue":[0.0, 0.37], + "targetValue":[0.12, 0.37], + "animator": + { + "alphaFunction":"EASE_IN", + "timePeriod": + { + "duration":0.4, + "delay":0 + } + } + } + ], + "exitTransition": + [ + { + "target":"checkboxFgVisual", + "property":"pixelArea", + "initialValue":[0.0, 0.0, 1.0, 1.0], + "targetValue":[0.0, 0.0, 0.0, 1.0], + "animator": + { + "alphaFunction":"EASE_OUT", + "timePeriod": + { + "duration":0.4, + "delay":0 + } + } + }, + { + "target":"checkboxFgVisual", + "property":"size", + "targetValue":[0.0, 0.37], + "animator": + { + "alphaFunction":"EASE_OUT", + "timePeriod": + { + "duration":0.4, + "delay":0 + } + } + } + ] + }, + "UNCHECKED": + { + } + } + }, + //"FOCUSED" + "DISABLED": + { + "visuals": + { + "checkboxBgVisual":{ + "visualType":"IMAGE", + "url":"{STYLE_DIR}/images/CheckBg.png", + "transform":{ + "size":[0.09, 0.28], + "offset":[30,0], + "offsetPolicy":["ABSOLUTE", "ABSOLUTE"], + "sizePolicy":["RELATIVE", "RELATIVE"], + "origin":"CENTER_BEGIN", + "anchorPoint":"CENTER_BEGIN" + }, + "depthIndex":0 + }, + + "checkboxFgVisual":{ + "visualType":"IMAGE", + "url":"{STYLE_DIR}/images/Tick.png", + "transform":{ + "size":[0.09, 0.28], + "offset":[30,0], + "offsetPolicy":["ABSOLUTE", "ABSOLUTE"], + "sizePolicy":["RELATIVE", "RELATIVE"], + "origin":"CENTER_BEGIN", + "anchorPoint":"CENTER_BEGIN" + }, + "depthIndex":1 + }, + + "labelVisual":{ + "visualType":"TEXT", + "text":"Don't show again", + "pointSize":8, + "horizontalAlignment":"END", + "verticalAlignment":"CENTER", + "textColor":[1,1,1,1], + "mixColor":[0.3, 0.3, 0.3, 1], + "transform":{ + "size":[0.9, 0.9], + "offset":[-30,0], + "offsetPolicy":["ABSOLUTE", "ABSOLUTE"], + "sizePolicy":["RELATIVE", "RELATIVE"], + "origin":"CENTER_END", + "anchorPoint":"CENTER_END" + }, + "depthIndex":1 + } + }, + "states": + { + "CHECKED": + { + "visuals": + { + "checkboxFgVisual":{ + "visualType":"IMAGE", + "url":"{STYLE_DIR}/images/Tick.png", + "transform":{ + "size":[0.09, 0.28], + "offset":[30,0], + "offsetPolicy":["ABSOLUTE", "ABSOLUTE"], + "sizePolicy":["RELATIVE", "RELATIVE"], + "origin":"CENTER_BEGIN", + "anchorPoint":"CENTER_BEGIN" + }, + "depthIndex":2 + } + } + }, + "UNCHECKED": + { + } + } + } + }, + "transitions": + [ + { + "from":"DISABLED", + "to":"NORMAL", + "visualName":"backgroundVisual", + "effect":"FADE_IN", + "animator": + { + "alphaFunction":"EASE_OUT_BACK", + "duration":0.8 + } + }, + { + "from":"DISABLED", + "to":"NORMAL", + "visualName":"*", + "effect":"CROSSFADE", + "animator": + { + "alphaFunction":"EASE_OUT_BACK", + "duration":0.8 + } + }, + { + "from":"NORMAL", + "to":"DISABLED", + "visualName":"backgroundVisual", + "effect":"FADE_OUT", + "animator": + { + "alphaFunction":"EASE_OUT_BACK", + "duration":0.8 + } + }, + { + "from":"NORMAL", + "to":"DISABLED", + "visualName":"*", + "effect":"CROSSFADE", + "animator": + { + "alphaFunction":"EASE_OUT_BACK", + "duration":0.8 + } + } + ] + }, + "BeatControl": + { + "beatVisual":{ + "visualType":"IMAGE", + "url":"{APPLICATION_RESOURCE_PATH}/images/Logo-for-demo.png" + }, + + "bounceTransition": + [ + { + "target":"beatVisual", + "property":"size", + "initialValue":[0.5, 0.5], + "targetValue":[0.75, 0.75], + "animator": + { + "alphaFunction":"BOUNCE", + "timePeriod": + { + "duration":0.5, + "delay":0 + } + } + } + ], + + "leftTransition": + [ + { + "target":"beatVisual", + "property":"offset", + "initialValue":[0, 0], + "targetValue":[0.25, 0], + "animator": + { + "alphaFunction":"BOUNCE", + "timePeriod": + { + "duration":0.5, + "delay":0 + } + } + } + ], + + "upTransition": + [ + { + "target":"beatVisual", + "property":"offset", + "initialValue":[0, 0], + "targetValue":[0, 0.25], + "animator": + { + "alphaFunction":"BOUNCE", + "timePeriod": + { + "duration":0.5, + "delay":0 + } + } + } + ], + + "fadeTransition": + [ + { + "target":"beatVisual", + "property":"opacity", + "targetValue":0, + "animator": + { + "alphaFunction":"BOUNCE", + "timePeriod": + { + "duration":0.8, + "delay":0 + } + } + } + ] + } + } +} diff --git a/resources/style/android/style-example-theme-three.json b/resources/style/android/style-example-theme-three.json new file mode 100644 index 0000000..f77d957 --- /dev/null +++ b/resources/style/android/style-example-theme-three.json @@ -0,0 +1,109 @@ +{ + "styles": + { + "Title":{ + "textColor":"#0000ff", + "background": + { + "visualType":"COLOR", + "mixColor": [ 1.0, 1.0, 1.0, 1.0 ] + } + }, + "TableView":{ + "background": + { + "visualType":"COLOR", + "mixColor": [ 1.0, 1.0, 1.0, 0.03 ] + } + }, + "RadioButton":{ + "label":{ + "textColor": [1,1,1,1] + } + }, + "CheckboxButton":{ + "label":{ + "textColor": [1,1,1,1] + } + }, + "ColorLabel1":{ + "textColor": [1,0,0,1] + }, + "ColorLabel2":{ + "textColor": [0,1,0,1] + }, + "ColorLabel3":{ + "textColor": [0.3,0.3,1,1] + }, + "ThemeLabel":{ + "textColor":[0,1,1,1] + }, + "PopupTitle":{ + "textColor":[1,1,1,1] + }, + "PopupBody":{ + "textColor":[1,1,0,1] + }, + "TextLabel":{ + "textColor":[0,0,0,1] + }, + "ImageChannelControl": + { + "enableVisibilityTransition": + [ + { + "target":"imageVisual", + "property":"size", + "initialValue":[0.1,0.1], + "targetValue":[1,1], + "animator": + { + "alphaFunction":"EASE_IN", + "timePeriod": + { + "duration":0.3, + "delay":0.1 + } + } + }, + { + "target":"imageVisual", + "property":"mixColor", + "targetValue":[1,1,1,1] + } + ], + "disableVisibilityTransition": + [ + { + "target":"imageVisual", + "property":"size", + "initialValue":[1,1], + "targetValue":[0.1,0.1], + "animator": + { + "alphaFunction":"EASE_OUT", + "timePeriod": + { + "duration":0.3, + "delay":0.0 + } + } + }, + { + "target":"imageVisual", + "property":"mixColor", + "targetValue":[1,1,1,0], + "animator": + { + "alphaFunction":"EASE_OUT", + "timePeriod": + { + "duration":0.3, + "delay":0.0 + } + } + } + ] + } + } +} diff --git a/resources/style/android/style-example-theme-two.json b/resources/style/android/style-example-theme-two.json new file mode 100644 index 0000000..fa8ed33 --- /dev/null +++ b/resources/style/android/style-example-theme-two.json @@ -0,0 +1,235 @@ +{ + "constants": + { + "STYLE_DIR":"{APPLICATION_RESOURCE_PATH}/style" + }, + "styles": + { + "Title":{ + "textColor":"#0000ff", + "background": + { + "visualType":"COLOR", + "mixColor": [ 1.0, 1.0, 1.0, 1.0 ] + } + }, + "TableView":{ + "background": + { + "visualType":"GRADIENT", + "startPosition": [0,-1], + "endPosition": [0,1], + "stopColor": [ [ 1.0, 0.0, 1.0, 0.03 ], [1.0,0.0,1.0,0.15] ] + } + }, + + // Change an icon size, see if it gets properly re-sized + "RadioButton":{ + "unselectedVisual": + { + "visualType": "IMAGE", + "url": "{STYLE_DIR}/images/radio-button-unselected.png" + }, + "selectedVisual": + { + "visualType": "IMAGE", + "url": "{STYLE_DIR}/images/radio-button-selected.png" + }, + "label":{ + "textColor": [0.1,1,1,1] + } + }, + "checkboxbutton":{ + "label":{ + "textColor": [1,1,1,1] + } + }, + "colorLabel1":{ + "textColor": [1,0,0,1] + }, + "colorLabel2":{ + "textColor": [0,1,0,1] + }, + "colorLabel3":{ + "textColor": [0.3,0.3,1,1] + }, + "themelabel":{ + "textColor":[0,1,1,1] + }, + "popupTitle":{ + "textColor":[1,1,1,1] + }, + "popupBody":{ + "textColor":[1,1,0,1] + }, + + // Note, this overrides any non-renamed label styles, e.g. those in a button. + "TextLabel":{ + //"textColor":[0,0,0,1] + }, + + "ThinSlider":{ + "styles": ["slider"], + "showPopup":true, + "showValue":false, + "valuePrecision":0, + "handleVisual":{ + "size":[48,48] + }, + "trackVisual":{ + "size":[10, 10] + }, + "enabled":true + }, + "ColorSlider1":{ + "styles":["ThinSlider"], + "progressVisual":{ + "url":"{STYLE_DIR}/images/slider-skin-progress-red.9.png" + } + }, + "ColorSlider2":{ + "styles":["ThinSlider"], + "progressVisual":{ + "url":"{STYLE_DIR}/images/slider-skin-progress-green.9.png" + } + }, + "ColorSlider3":{ + "styles":["thinslider"], + "progressVisual":{ + "url":"{STYLE_DIR}/images/slider-skin-progress-blue.9.png" + } + }, + "ImageChannelControl": + { + "enableVisibilityTransition": + [ + { + "target":"imageVisual", + "property":"mixColor", + "initialValue":[1,1,1,0], + "targetValue":[1,1,1,1], + "animator": + { + "alphaFunction":"EASE_IN_OUT", + "timePeriod": + { + "duration":0.4, + "delay":0 + } + } + }, + { + "target":"imageVisual", + "property":"size", + "targetValue":[1,1] + } + ], + "disableVisibilityTransition": + [ + { + "target":"imageVisual", + "property":"mixColor", + "targetValue":[1,1,1,0], + "animator": + { + "alphaFunction":"EASE_IN_OUT", + "timePeriod": + { + "duration":0.4, + "delay":0.2 + } + } + }, + { + "target":"imageVisual", + "property":"size", + "targetValue":[1,1] + } + ] + }, + "ShadowButton": + { + "backgroundVisual":{ + "visualType":"IMAGE", + "url":"{STYLE_DIR}/images/shadowButtonBg.9.png" + }, + "checkboxBgVisual":{ + "visualType":"IMAGE", + "url":"{STYLE_DIR}/images/CheckBg.png", + "transform":{ + "size":[0.09, 0.28], + "offset":[30,0], + "offsetPolicy":["ABSOLUTE", "ABSOLUTE"], + "sizePolicy":["RELATIVE", "RELATIVE"], + "origin":"CENTER_BEGIN", + "anchorPoint":"CENTER_BEGIN" + } + }, + "checkboxFgVisual":{ + "visualType":"IMAGE", + "url":"{STYLE_DIR}/images/Tick.png", + "transform":{ + "size":[0.09, 0.28], + "offset":[30,0], + "offsetPolicy":["ABSOLUTE", "ABSOLUTE"], + "sizePolicy":["RELATIVE", "RELATIVE"], + "origin":"CENTER_BEGIN", + "anchorPoint":"CENTER_BEGIN" + } + }, + "labelVisual":{ + "visualType":"TEXT", + "text":"Don't show again", + "pointSize":8, + "horizontalAlignment":"END", + "verticalAlignment":"CENTER", + "textColor":[1,1,1,1], + "mixColor":[0.3, 0.3, 0.3, 1], + "transform":{ + "size":[0.9, 0.9], + "offset":[-30,0], + "offsetPolicy":["ABSOLUTE", "ABSOLUTE"], + "sizePolicy":["RELATIVE", "RELATIVE"], + "origin":"CENTER_END", + "anchorPoint":"CENTER_END" + } + }, + "activeTransition": + [ + { + "target":"checkboxBgVisual", + "property":"size", + "initialValue":[0.09, 0.28], + "targetValue":[0.12, 0.37], + "animator": + { + "alphaFunction":"EASE_OUT_BACK", + "timePeriod": + { + "duration":0.8, + "delay":0 + } + } + } + ], + "inactiveTransition": + [ + { + "target":"checkboxBgVisual", + "property":"size", + "initialValue":[0.12, 0.37], + "targetValue":[0.09, 0.28], + "animator": + { + "alphaFunction":"EASE_OUT_BACK", + "timePeriod": + { + "duration":0.8, + "delay":0 + } + } + } + ] + } + } +} diff --git a/resources/style/android/text-editor-example-theme.json b/resources/style/android/text-editor-example-theme.json new file mode 100644 index 0000000..48470b4 --- /dev/null +++ b/resources/style/android/text-editor-example-theme.json @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2000-2017 Samsung Electronics Co., Ltd + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +{ + "styles": + { + "ScrollBar": + { + "indicatorShowDuration":1.0, + "indicatorHideDuration":1.0, + "background": { + "rendererType": "image", + "url": "{APPLICATION_RESOURCE_PATH}/images/button-disabled.9.png" + } + }, + "ScrollBarIndicator": + { + "resourceUrl":"{APPLICATION_RESOURCE_PATH}/images/button-white-up.9.png" + } + } +} diff --git a/resources/style/android/tooltip-example-theme.json b/resources/style/android/tooltip-example-theme.json new file mode 100644 index 0000000..74e4158 --- /dev/null +++ b/resources/style/android/tooltip-example-theme.json @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +{ + "styles": + { + "TooltipTextOnly" : + { + "tooltip": "Using defaults defined in the Toolkit stylesheet" + }, + + "TooltipArray" : + { + "tooltip" : + { + "content" : + [ + { + "visualType" : "IMAGE", + "url" : "{APPLICATION_RESOURCE_PATH}/images/application-icon-0.png", + "desiredWidth" : 75, + "desiredHeight" : 75 + }, + { + "visualType" : "TEXT", + "text" : "An icon on the left and\nmulti-line text on the right", + "multiLine" : true, + "pointSize" : 8 + } + ], + "tail" : true + } + }, + + "TooltipCustom" : + { + "tooltip": + { + "content": + { + "visualType" : "TEXT", + "textColor" : [1,1,1,1], + "text" : "Completely custom style\nthat disappears on movement", + "multiLine" : true, + "pointSize" : 8 + }, + "waitTime":0.5, + "background": + { + "visual":"{APPLICATION_RESOURCE_PATH}/images/tooltip.9.png", + "border":[1,5,5,1] + }, + "tail": + { + "visibility":true, + "aboveVisual":"{APPLICATION_RESOURCE_PATH}/images/tooltip-tail-above.png", + "belowVisual":"{APPLICATION_RESOURCE_PATH}/images/tooltip-tail-below.png" + }, + "position":"ABOVE", + "hoverPointOffset":[10,10], + "movementThreshold":5, + "disappearOnMovement":true + } + }, + + "TableView" : + { + "cellPadding" : [ 5.0, 5.0 ] + } + } +} diff --git a/shared/dali-demo-strings.h b/shared/dali-demo-strings.h index 354338f..2969f79 100644 --- a/shared/dali-demo-strings.h +++ b/shared/dali-demo-strings.h @@ -19,7 +19,9 @@ #ifndef DALI_DEMO_STRINGS_H #define DALI_DEMO_STRINGS_H +#ifdef INTERNATIONALIZATION_ENABLED #include +#endif #ifdef __cplusplus extern "C" diff --git a/shared/dali-table-view.cpp b/shared/dali-table-view.cpp index 9be600d..8fcf8b1 100644 --- a/shared/dali-table-view.cpp +++ b/shared/dali-table-view.cpp @@ -620,7 +620,7 @@ void DaliTableView::OnPressedAnimationFinished( Dali::Animation& source ) { std::string name = mPressedActor.GetName(); - ExecuteProcess( name ); + ExecuteProcess( name, mApplication ); mPressedActor.Reset(); } diff --git a/shared/execute-process-android.cpp b/shared/execute-process-android.cpp new file mode 100644 index 0000000..d042a55 --- /dev/null +++ b/shared/execute-process-android.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + + // FILE HEADER +#include "execute-process.h" + + // EXTERNAL INCLUDES +#include +#include +#include + +void ExecuteProcess( const std::string& processName, Dali::Application& application ) +{ + std::stringstream stream; + stream << "am start -a android.intent.action.MAIN -n com.sec.dalidemo/.DaliDemoNativeActivity --user 0 --es start " << processName.c_str(); + pid_t parentPID = getpid(); + + pid_t pid = fork(); + if( pid == 0 ) + { + do + { + sleep( 1 ); + } + while( kill( parentPID, 0 ) == 0 ); + + system( stream.str().c_str() ); + exit( 0 ); + } + else + { + application.Quit(); + } +} diff --git a/shared/execute-process-unix.cpp b/shared/execute-process-unix.cpp index 6b87e54..aa77771 100644 --- a/shared/execute-process-unix.cpp +++ b/shared/execute-process-unix.cpp @@ -23,12 +23,12 @@ #include #include -void ExecuteProcess( const std::string& processName ) +void ExecuteProcess( const std::string& processName, Dali::Application& application ) { std::stringstream stream; stream << DEMO_EXAMPLE_BIN << processName.c_str(); pid_t pid = fork(); - if( pid == 0) + if( pid == 0 ) { execlp( stream.str().c_str(), processName.c_str(), NULL ); DALI_ASSERT_ALWAYS(false && "exec failed!"); diff --git a/shared/execute-process-win.cpp b/shared/execute-process-win.cpp index 3eb89f4..8445221 100644 --- a/shared/execute-process-win.cpp +++ b/shared/execute-process-win.cpp @@ -27,7 +27,7 @@ namespace const std::string PATH_SEPARATOR( "\\" ); } -void ExecuteProcess( const std::string& processName ) +void ExecuteProcess( const std::string& processName, Dali::Application& application ) { char currentPath[MAX_PATH]; DWORD numberOfCharacters = GetCurrentDirectory( MAX_PATH, currentPath ); diff --git a/shared/execute-process.h b/shared/execute-process.h index d31a4a1..c3d11cd 100644 --- a/shared/execute-process.h +++ b/shared/execute-process.h @@ -20,8 +20,9 @@ // EXTERNAL INCLUDES #include +#include -void ExecuteProcess( const std::string& processName ); +void ExecuteProcess( const std::string& processName, Dali::Application& application ); #endif // DALI_DEMO_EXECUTE_PROCESS_H diff --git a/tests-reel/dali-tests-reel.cpp b/tests-reel/dali-tests-reel.cpp index 18a3fa2..7abe064 100644 --- a/tests-reel/dali-tests-reel.cpp +++ b/tests-reel/dali-tests-reel.cpp @@ -27,10 +27,11 @@ using namespace Dali; int DALI_EXPORT_API main(int argc, char **argv) { // Configure gettext for internalization +#if INTERNATIONALIZATION_ENABLED bindtextdomain(DALI_DEMO_DOMAIN_LOCAL, DEMO_LOCALE_DIR); textdomain(DALI_DEMO_DOMAIN_LOCAL); setlocale(LC_ALL, DEMO_LANG); - +#endif Application app = Application::New( &argc, &argv, DEMO_STYLE_DIR "/tests-theme.json" ); // Create the demo launcher