From 97073588bebc860eb9fdb7136ee44ed673f8c3e1 Mon Sep 17 00:00:00 2001 From: zhaosy Date: Tue, 28 Mar 2023 13:19:19 +0800 Subject: [PATCH] [M108 Migration][WRTjs][VD] Merge splash screen feature 1.Support landscape/portrait splash screen landscape/portrait splash screen should be supported. https://docs.tizen.org/application/tizen-studio/web-tools/config-editor/#tizen-launch-screen-2 2.splash screen image support SHARE path LYNKCloud app need to download splash screen image from server. They save image to SHARE path(/opt/usr/home/owner/share), WRT set this image as splash screen image. Reference: https://review.tizen.org/gerrit/289862/ https://review.tizen.org/gerrit/289246/ Change-Id: I4cf8d770e2698af9c40a6e8242da109d048098e1 Signed-off-by: zhaosy --- wrt/src/browser/splash_screen.cc | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/wrt/src/browser/splash_screen.cc b/wrt/src/browser/splash_screen.cc index f2bfe70..8b225c9 100755 --- a/wrt/src/browser/splash_screen.cc +++ b/wrt/src/browser/splash_screen.cc @@ -19,6 +19,9 @@ #include "wrt/src/browser/wrt_native_window.h" #if BUILDFLAG(IS_TIZEN_TV) +#include +#include + #include "wrt/src/browser/tv/video_splash_screen.h" #endif @@ -28,6 +31,11 @@ namespace { std::unique_ptr splash_screen_; +#if BUILDFLAG(IS_TIZEN_TV) +const char* kSharePath = "/opt/usr/home/owner/share"; +const char* kVconfRotationState = "db/sysman/rotation_state"; +#endif + enum class BorderOption { REPEAT = 1, STRETCH, ROUND }; bool ParseImageBorder(const std::vector& borders, @@ -75,7 +83,22 @@ bool SplashScreen::ShowSplashScreen() { splash_screen_.reset(new SplashScreen); auto orientation = wgt::parse::ScreenOrientation::AUTO; +#if BUILDFLAG(IS_TIZEN_TV) + int rotation_state = DISPLAY_ROTATOR_ORIENTATION_LANDSCAPE; + vconf_get_int(kVconfRotationState, &rotation_state); + if (rotation_state == DISPLAY_ROTATOR_ORIENTATION_PORTRAIT || + rotation_state == DISPLAY_ROTATOR_ORIENTATION_PORTRAIT_R) + orientation = wgt::parse::ScreenOrientation::PORTRAIT; + else + orientation = wgt::parse::ScreenOrientation::LANDSCAPE; +#endif + auto* screen_data = screen_info.GetLaunchScreenData(orientation); + // get default images if fail to get LANDSCAPE/PORTRAIT images + if (!screen_data || screen_data->images.empty()) + screen_data = + screen_info.GetLaunchScreenData(wgt::parse::ScreenOrientation::AUTO); + auto* window = WRTNativeWindow::GetTopWindow(); auto dimensions = splash_screen_->GetDimensions(window); @@ -226,8 +249,18 @@ void SplashScreen::SetImage( int location_y = (window_h - image_h) / 2; evas_object_geometry_set(image_, location_x, location_y, image_w, image_h); #else - const std::string& image_path = splash_data->images.front().first; - elm_image_file_set(image_, (app_path + image_path).c_str(), nullptr); + std::string image_path = splash_data->images.front().first; +#if BUILDFLAG(IS_TIZEN_TV) + if (image_path.find("$SHARE") != std::string::npos) + image_path.replace(0, strlen("$SHARE"), kSharePath); + else + image_path = app_path + image_path; +#else + image_path = app_path + image_path; +#endif // IS_TIZEN_TV + + LOG(INFO) << "image_path: " << image_path; + elm_image_file_set(image_, image_path.c_str(), nullptr); evas_object_resize(image_, bound.first, bound.second); #endif evas_object_show(image_); -- 2.7.4