From efb49add97cfda58c417ea4052cb6afb84c16c03 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Tue, 31 Jan 2017 23:03:10 -0800 Subject: ui: Move locale and friends into ScreenRecoveryUI class. Localized texts only make sense on devices with screens. Test: Run fake OTA on angler; check the on-screen texts. Change-Id: I3a644294c8b1f2056cfb78b2d61a598b8ddf2acf --- ui.cpp | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) (limited to 'ui.cpp') diff --git a/ui.cpp b/ui.cpp index e80d7ed04..baf6d1080 100644 --- a/ui.cpp +++ b/ui.cpp @@ -50,9 +50,7 @@ static constexpr const char* BRIGHTNESS_FILE = "/sys/class/leds/lcd-backlight/br static constexpr const char* MAX_BRIGHTNESS_FILE = "/sys/class/leds/lcd-backlight/max_brightness"; RecoveryUI::RecoveryUI() - : locale_(""), - rtl_locale_(false), - brightness_normal_(50), + : brightness_normal_(50), brightness_dimmed_(25), touch_screen_allowed_(false), kTouchLowThreshold(RECOVERY_UI_TOUCH_LOW_THRESHOLD), @@ -132,10 +130,7 @@ bool RecoveryUI::InitScreensaver() { return true; } -bool RecoveryUI::Init(const std::string& locale) { - // Set up the locale info. - SetLocale(locale); - +bool RecoveryUI::Init(const std::string& /* locale */) { ev_init(std::bind(&RecoveryUI::OnInputEvent, this, std::placeholders::_1, std::placeholders::_2), touch_screen_allowed_); @@ -574,23 +569,3 @@ void RecoveryUI::SetEnableReboot(bool enabled) { enable_reboot = enabled; pthread_mutex_unlock(&key_queue_mutex); } - -void RecoveryUI::SetLocale(const std::string& new_locale) { - this->locale_ = new_locale; - this->rtl_locale_ = false; - - if (!new_locale.empty()) { - size_t underscore = new_locale.find('_'); - // lang has the language prefix prior to '_', or full string if '_' doesn't exist. - std::string lang = new_locale.substr(0, underscore); - - // A bit cheesy: keep an explicit list of supported RTL languages. - if (lang == "ar" || // Arabic - lang == "fa" || // Persian (Farsi) - lang == "he" || // Hebrew (new language code) - lang == "iw" || // Hebrew (old language code) - lang == "ur") { // Urdu - rtl_locale_ = true; - } - } -} -- cgit v1.2.3