void Init() { _filter = new IntentFilter(); _filter.AddAction("android.bluetooth.adapter.action.STATE_CHANGED"); _filter.AddAction("android.location.PROVIDERS_CHANGED"); AppDomain.CurrentDomain.UnhandledException += LogUtils.OnUnhandledException; AndroidEnvironment.UnhandledExceptionRaiser += OnUnhandledAndroidException; #if APPCENTER AppCenter.Start( Configuration.Conf.APPCENTER_DIAGNOSTICS_TOKEN, typeof(Analytics), typeof(Crashes)); #endif DroidDependencyInjectionConfig.Init(); Xamarin.Essentials.Platform.Init(this); Current.Init(this); LocalesService.Initialize(); new MigrationService().Migrate(); _permissionsBroadcastReceiver = new PermissionsBroadcastReceiver(); _flightModeBroadcastReceiver = new FlightModeHandlerBroadcastReceiver(); _backgroundNotificationBroadcastReceiver = new BackgroundNotificationBroadcastReceiver(); LogUtils.SendAllLogs(); if (PlayServicesVersionUtils.PlayServicesVersionNumberIsLargeEnough(PackageManager)) { BackgroundFetchScheduler.ScheduleBackgroundFetch(); } }
private void SetAppLanguageAndContinue(string appLanguage) { LocalPreferencesHelper.SetAppLanguage(appLanguage); LocalesService.Initialize(); LayoutUtils.OnLayoutDirectionChange(); NavigationHelper.GoToOnboardingPage(this); }
public void GetLanguage_NotNullOrEmpty() { string language = LocalesService.GetLanguage(); Assert.NotNull(language); Assert.NotEmpty(language); }
void HandleRadioBtnChange(SettingsLanguageSelection selection, UIButton sender) { if (SettingsGeneralViewModel.Selection == selection) { BokmalButton.Selected = SettingsGeneralViewModel.Selection == SettingsLanguageSelection.Bokmal; NynorskButton.Selected = SettingsGeneralViewModel.Selection == SettingsLanguageSelection.Nynorsk; EnglishButton.Selected = SettingsGeneralViewModel.Selection == SettingsLanguageSelection.English; LithuanianButton.Selected = SettingsGeneralViewModel.Selection == SettingsLanguageSelection.Lithuanian; PolishButton.Selected = SettingsGeneralViewModel.Selection == SettingsLanguageSelection.Polish; SomaliButton.Selected = SettingsGeneralViewModel.Selection == SettingsLanguageSelection.Somali; TigrinyaButton.Selected = SettingsGeneralViewModel.Selection == SettingsLanguageSelection.Tigrinya; ArabicButton.Selected = SettingsGeneralViewModel.Selection == SettingsLanguageSelection.Arabic; UrduButton.Selected = SettingsGeneralViewModel.Selection == SettingsLanguageSelection.Urdu; return; } DialogHelper.ShowDialog(this, SettingsGeneralViewModel.GetChangeLanguageViewModel, Action => { _resetViews.ResetViews(); } ); LocalPreferencesHelper.SetAppLanguage(SettingsLanguageSelectionExtensions.ToString(selection)); LayoutUtils.OnLayoutDirectionChange(); LocalesService.SetInternationalization(); SetupRadioButtons(); }
public static string GetDateFromDateTime(this DateTime?date, string dateFormat) { if (date != null) { DateTime dateTime = (DateTime)date; string appLanguage = LocalesService.GetLanguage(); CultureInfo selectedCulture = CultureInfo.GetCultureInfo(appLanguage); // Due to a bug in C# string representation in nb culture, nn must be used CultureInfo defaultCulture = CultureInfo.GetCultureInfo(Conf.DEFAULT_LANGUAGE); bool shouldUseDefaultCulture = appLanguage == "ar" || appLanguage == "ur" || appLanguage == "ti" || appLanguage == "nb"; string dateString; DateTime calenderDateTime = new DateTime( dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second, dateTime.Millisecond, new GregorianCalendar()); dateString = calenderDateTime.ToString(dateFormat, shouldUseDefaultCulture ? defaultCulture : selectedCulture); return(dateString.Replace("-", ".")); } else { return(string.Empty); } }
public bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { #if APPCENTER AppCenter.Start( Configuration.Conf.APPCENTER_DIAGNOSTICS_TOKEN, typeof(Analytics), typeof(Crashes)); #endif IOSDependencyInjectionConfig.Init(); LocalesService.Initialize(); UIApplication.SharedApplication.SetMinimumBackgroundFetchInterval(UIApplication.BackgroundFetchIntervalMinimum); new MigrationService().Migrate(); LogUtils.SendAllLogs(); AppDomain.CurrentDomain.UnhandledException += LogUtils.OnUnhandledException; SecureStorageImplementation.DefaultAccessible = Security.SecAccessible.AfterFirstUnlockThisDeviceOnly; HandleLocalNotifications(); BackgroundServiceHandler.PlatformScheduleFetch(); UIUserNotificationSettings notificationSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null ); application.RegisterUserNotificationSettings(notificationSettings); application.BeginBackgroundTask("showNotification", () => { }); LayoutUtils.OnLayoutDirectionChange(); return(true); }
public async void OnCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case Resource.Id.settings_general_english: await DialogUtils.DisplayDialogAsync(_self, GetChangeLanguageViewModel); LocalPreferencesHelper.SetAppLanguage("en"); break; case Resource.Id.settings_general_bokmal: await DialogUtils.DisplayDialogAsync(_self, GetChangeLanguageViewModel); LocalPreferencesHelper.SetAppLanguage("nb"); break; case Resource.Id.settings_general_nynorsk: await DialogUtils.DisplayDialogAsync(_self, GetChangeLanguageViewModel); LocalPreferencesHelper.SetAppLanguage("nn"); break; } LocalesService.SetInternationalization(); // TODO Client do not want reset feature for now. Left for future release. //_self._resetViews.ResetViews(); }
void HandleRadioBtnChange(SettingsLanguageSelection selection, UIButton sender) { if (SettingsGeneralViewModel.Selection == selection) { RadioButton1.Selected = SettingsGeneralViewModel.Selection == SettingsLanguageSelection.Bokmal; RadioButton2.Selected = SettingsGeneralViewModel.Selection == SettingsLanguageSelection.Nynorsk; RadioButton3.Selected = SettingsGeneralViewModel.Selection == SettingsLanguageSelection.English; return; } switch (selection) { case SettingsLanguageSelection.Bokmal: DialogHelper.ShowDialog(this, SettingsGeneralViewModel.GetChangeLanguageViewModel, (Action) => { }); LocalPreferencesHelper.SetAppLanguage("nb"); break; case SettingsLanguageSelection.Nynorsk: DialogHelper.ShowDialog(this, SettingsGeneralViewModel.GetChangeLanguageViewModel, (Action) => { }); LocalPreferencesHelper.SetAppLanguage("nn"); break; case SettingsLanguageSelection.English: DialogHelper.ShowDialog(this, SettingsGeneralViewModel.GetChangeLanguageViewModel, (Action) => { }); LocalPreferencesHelper.SetAppLanguage("en"); break; } LocalesService.SetInternationalization(); SetupRadioButtons(); }
private void SetLogoBasedOnAppLanguage() { string appLanguage = LocalesService.GetLanguage(); HealthAuthoritiesLogo.Image = appLanguage != null && appLanguage.ToLower() == "en" ? UIImage.FromBundle("HealthAuthoritiesLogo_En") : UIImage.FromBundle("HealthAuthoritiesLogo"); }
private void SetLogoBasedOnAppLanguage() { string appLanguage = LocalesService.GetLanguage(); AuthorityImageView.Image = appLanguage != null && appLanguage.ToLower() == "en" ? UIImage.FromBundle("logo_SFP_en") : UIImage.FromBundle("logo_SFP_da"); }
private void SetLogoBasedOnAppLanguage() { View logo = FindViewById <View>(Resource.Id.message_logo); string appLanguage = LocalesService.GetLanguage(); logo?.SetBackgroundResource(appLanguage != null && appLanguage.ToLower() == "en" ? Resource.Drawable.patient_logo_en : Resource.Drawable.patient_logo_da); }
public void GetLanguage_NotSupportedCulture_ReturnsDefault(string culture) { CultureInfo initialCulture = CultureInfo.CurrentCulture; CultureInfo.CurrentCulture = new CultureInfo(culture); string language = LocalesService.GetLanguage(); Assert.Equal(Conf.DEFAULT_LANGUAGE, language); CultureInfo.CurrentCulture = initialCulture; }
public void GetLanguage_SupportedCulture_ReturnsCorrect(string culture) { CultureInfo initialCulture = CultureInfo.CurrentCulture; CultureInfo.CurrentCulture = new CultureInfo(culture); string language = LocalesService.GetLanguage(); Assert.Equal(CultureInfo.CurrentCulture.TwoLetterISOLanguageName, language); CultureInfo.CurrentCulture = initialCulture; }
void HandleRadioBtnChange(SettingsLanguageSelection selection, UIButton sender) { if (SettingsGeneralViewModel.Selection == selection) { RadioButton1.Selected = SettingsGeneralViewModel.Selection == SettingsLanguageSelection.Bokmal; RadioButton2.Selected = SettingsGeneralViewModel.Selection == SettingsLanguageSelection.Nynorsk; RadioButton3.Selected = SettingsGeneralViewModel.Selection == SettingsLanguageSelection.English; return; } switch (selection) { case SettingsLanguageSelection.Bokmal: DialogHelper.ShowDialog(this, SettingsGeneralViewModel.GetChangeLanguageViewModel, Action => { // TODO Client do not want reset feature for now. Left for future release. //_resetViews.ResetViews(); }); LocalPreferencesHelper.SetAppLanguage("nb"); break; case SettingsLanguageSelection.Nynorsk: DialogHelper.ShowDialog(this, SettingsGeneralViewModel.GetChangeLanguageViewModel, Action => { // TODO Client do not want reset feature for now. Left for future release. //_resetViews.ResetViews(); }); LocalPreferencesHelper.SetAppLanguage("nn"); break; case SettingsLanguageSelection.English: DialogHelper.ShowDialog(this, SettingsGeneralViewModel.GetChangeLanguageViewModel, Action => { // TODO Client do not want reset feature for now. Left for future release. //_resetViews.ResetViews(); }); LocalPreferencesHelper.SetAppLanguage("en"); break; } LocalesService.SetInternationalization(); SetupRadioButtons(); }
private void LanguageButton_Click(object sender, EventArgs e) { Button senderButton = sender as Button; switch (senderButton.Id) { case Resource.Id.bokmal_button: LocalPreferencesHelper.SetAppLanguage("nb"); break; case Resource.Id.nynorsk_button: LocalPreferencesHelper.SetAppLanguage("nn"); break; case Resource.Id.english_button: LocalPreferencesHelper.SetAppLanguage("en"); break; case Resource.Id.arabic_button: LocalPreferencesHelper.SetAppLanguage("ar"); break; case Resource.Id.lithuanian_button: LocalPreferencesHelper.SetAppLanguage("lt"); break; case Resource.Id.polish_button: LocalPreferencesHelper.SetAppLanguage("pl"); break; case Resource.Id.somali_button: LocalPreferencesHelper.SetAppLanguage("so"); break; case Resource.Id.tigrinya_button: LocalPreferencesHelper.SetAppLanguage("ti"); break; case Resource.Id.urdu_button: LocalPreferencesHelper.SetAppLanguage("ur"); break; } LocalesService.Initialize(); NavigationHelper.GoToOnBoarding(this, true); }
public string GetName() { string language = LocalesService.GetLanguage(); switch (language) { case "nb": return(Name_NB); case "nn": return(Name_NN); case "en": return(Name_EN); default: return(Name_EN); } }
public async void OnCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case Resource.Id.settings_general_english: await DialogUtils.DisplayDialogAsync(_self, GetChangeLanguageViewModel); LocalPreferencesHelper.SetAppLanguage("en"); break; case Resource.Id.settings_general_bokmal: await DialogUtils.DisplayDialogAsync(_self, GetChangeLanguageViewModel); LocalPreferencesHelper.SetAppLanguage("nb"); break; case Resource.Id.settings_general_nynorsk: await DialogUtils.DisplayDialogAsync(_self, GetChangeLanguageViewModel); LocalPreferencesHelper.SetAppLanguage("nn"); break; } LocalesService.SetInternationalization(); }
void OnContinueInEnViewBtnTapped(UITapGestureRecognizer recognizer) { LocalPreferencesHelper.SetAppLanguage("en"); LocalesService.Initialize(); Continue(); }
private void Init() { ImageButton backButton = FindViewById <ImageButton>(Resource.Id.arrow_back_general); backButton.ContentDescription = BACK_BUTTON_ACCESSIBILITY_TEXT; TextView titleField = FindViewById <TextView>(Resource.Id.settings_general_title); TextView explanationOne = FindViewById <TextView>(Resource.Id.settings_general_explanation); TextView explanationTwo = FindViewById <TextView>(Resource.Id.settings_general_explanation_two); TextView mobileDataHeader = FindViewById <TextView>(Resource.Id.settings_general_mobile_data_header); TextView mobileDataDesc = FindViewById <TextView>(Resource.Id.settings_general_mobile_data_desc); TextView languageHeader = FindViewById <TextView>(Resource.Id.settings_general_select_lang_header); TextView languageDesc = FindViewById <TextView>(Resource.Id.settings_general_select_lang_desc_one); TextView languageLink = FindViewById <TextView>(Resource.Id.settings_general_link); TextView linkLayout = FindViewById <TextView>(Resource.Id.settings_general_link); titleField.Text = SETTINGS_GENERAL_TITLE; explanationOne.Text = SETTINGS_GENERAL_EXPLANATION_ONE; explanationTwo.Text = SETTINGS_GENERAL_EXPLANATION_TWO; mobileDataHeader.Text = SETTINGS_GENERAL_MOBILE_DATA_HEADER; mobileDataDesc.Text = SETTINGS_GENERAL_MOBILE_DATA_DESC; languageHeader.Text = SETTINGS_GENERAL_CHOOSE_LANGUAGE_HEADER; languageDesc.Text = SETTINGS_GENERAL_RESTART_REQUIRED_TEXT; languageLink.TextAlignment = TextAlignment.ViewStart; languageLink.ContentDescription = SETTINGS_GENERAL_ACCESSIBILITY_MORE_INFO_BUTTON_TEXT; titleField.SetAccessibilityDelegate(AccessibilityUtils.GetHeadingAccessibilityDelegate()); mobileDataHeader.SetAccessibilityDelegate(AccessibilityUtils.GetHeadingAccessibilityDelegate()); languageHeader.SetAccessibilityDelegate(AccessibilityUtils.GetHeadingAccessibilityDelegate()); languageLink.TextFormatted = HtmlCompat.FromHtml($"<a href=\"{SETTINGS_GENERAL_MORE_INFO_LINK}\">{SETTINGS_GENERAL_MORE_INFO_BUTTON_TEXT}</a>", HtmlCompat.FromHtmlModeLegacy); languageLink.MovementMethod = new Android.Text.Method.LinkMovementMethod(); RadioGroup radioGroup = FindViewById <RadioGroup>(Resource.Id.settings_general_select_lang_radio_group); RadioButton englishRadioButton = FindViewById <RadioButton>(Resource.Id.settings_general_english); RadioButton bokmalRadioButton = FindViewById <RadioButton>(Resource.Id.settings_general_bokmal); RadioButton nynorskRadioButton = FindViewById <RadioButton>(Resource.Id.settings_general_nynorsk); RadioButton polishRadioButton = FindViewById <RadioButton>(Resource.Id.settings_general_polish); RadioButton somaliRadioButton = FindViewById <RadioButton>(Resource.Id.settings_general_somali); RadioButton tigrinyaRadioButton = FindViewById <RadioButton>(Resource.Id.settings_general_tigrinya); RadioButton arabicRadioButton = FindViewById <RadioButton>(Resource.Id.settings_general_arabic); RadioButton urduRadioButton = FindViewById <RadioButton>(Resource.Id.settings_general_urdu); RadioButton lithuanianRadioButton = FindViewById <RadioButton>(Resource.Id.settings_general_lithuanian); englishRadioButton.Text = SETTINGS_GENERAL_EN; bokmalRadioButton.Text = SETTINGS_GENERAL_NB; nynorskRadioButton.Text = SETTINGS_GENERAL_NN; polishRadioButton.Text = SETTINGS_GENERAL_PL; somaliRadioButton.Text = SETTINGS_GENERAL_SO; tigrinyaRadioButton.Text = SETTINGS_GENERAL_TI; arabicRadioButton.Text = SETTINGS_GENERAL_AR; urduRadioButton.Text = SETTINGS_GENERAL_UR; lithuanianRadioButton.Text = SETTINGS_GENERAL_LT; string appLanguage = LocalesService.GetLanguage(); switch (appLanguage) { case "en": englishRadioButton.Checked = true; break; case "nn": nynorskRadioButton.Checked = true; break; case "pl": polishRadioButton.Checked = true; break; case "so": somaliRadioButton.Checked = true; break; case "ti": tigrinyaRadioButton.Checked = true; break; case "ar": arabicRadioButton.Checked = true; break; case "ur": urduRadioButton.Checked = true; break; case "lt": lithuanianRadioButton.Checked = true; break; default: bokmalRadioButton.Checked = true; break; } radioGroup.SetOnCheckedChangeListener(new OnCheckedChangeListener(this)); SwitchCompat switchButton = FindViewById <SwitchCompat>(Resource.Id.settings_general_switch); switchButton.Checked = _viewModel.GetStoredCheckedState(); switchButton.CheckedChange += OnCheckedChange; backButton.Click += new StressUtils.SingleClick((sender, args) => Finish()).Run; // Layout direction logic View rootView = Window.DecorView.RootView; rootView.LayoutDirection = LayoutUtils.GetLayoutDirection(); backButton.SetBackgroundResource(LayoutUtils.GetBackArrow()); languageLink.SetCompoundDrawablesRelativeWithIntrinsicBounds(null, null, ContextCompat.GetDrawable(this, LayoutUtils.GetForwardArrow()), null); }
private void Init() { Button backButton = FindViewById <Button>(Resource.Id.arrow_back_general); backButton.ContentDescription = SETTINGS_CHILD_PAGE_ACCESSIBILITY_BACK_BUTTON; TextView titleField = FindViewById <TextView>(Resource.Id.settings_general_title); TextView explanationOne = FindViewById <TextView>(Resource.Id.settings_general_explanation); TextView explanationTwo = FindViewById <TextView>(Resource.Id.settings_general_explanation_two); TextView mobileDataHeader = FindViewById <TextView>(Resource.Id.settings_general_mobile_data_header); TextView mobileDataDesc = FindViewById <TextView>(Resource.Id.settings_general_mobile_data_desc); TextView languageHeader = FindViewById <TextView>(Resource.Id.settings_general_select_lang_header); TextView languageDesc = FindViewById <TextView>(Resource.Id.settings_general_select_lang_desc_one); TextView languageLink = FindViewById <TextView>(Resource.Id.settings_general_link); TextView linkLayout = FindViewById <TextView>(Resource.Id.settings_general_link); titleField.Text = SETTINGS_GENERAL_TITLE; explanationOne.Text = SETTINGS_GENERAL_EXPLANATION_ONE; explanationTwo.Text = SETTINGS_GENERAL_EXPLANATION_TWO; mobileDataHeader.Text = SETTINGS_GENERAL_MOBILE_DATA_HEADER; mobileDataDesc.Text = SETTINGS_GENERAL_MOBILE_DATA_DESC; languageHeader.Text = SETTINGS_GENERAL_CHOOSE_LANGUAGE_HEADER; languageDesc.Text = SETTINGS_GENERAL_RESTART_REQUIRED_TEXT; languageLink.Text = SETTINGS_GENERAL_MORE_INFO_BUTTON_TEXT; languageLink.ContentDescription = SETTINGS_GENERAL_ACCESSIBILITY_MORE_INFO_BUTTON_TEXT; linkLayout.Click += new StressUtils.SingleClick( (o, args) => OpenSmitteStopLink()).Run; RadioGroup radioGroup = FindViewById <RadioGroup>(Resource.Id.settings_general_select_lang_radio_group); RadioButton englishRadioButton = FindViewById <RadioButton>(Resource.Id.settings_general_english); RadioButton bokmalRadioButton = FindViewById <RadioButton>(Resource.Id.settings_general_bokmal); RadioButton nynorskRadioButton = FindViewById <RadioButton>(Resource.Id.settings_general_nynorsk); englishRadioButton.Text = SETTINGS_GENERAL_EN; bokmalRadioButton.Text = SETTINGS_GENERAL_NB; nynorskRadioButton.Text = SETTINGS_GENERAL_NN; string appLanguage = LocalesService.GetLanguage(); if (appLanguage == "en") { englishRadioButton.Checked = true; } else if (appLanguage == "nn") { nynorskRadioButton.Checked = true; } else { bokmalRadioButton.Checked = true; } radioGroup.SetOnCheckedChangeListener(new OnCheckedChangeListener(this)); SwitchCompat switchButton = FindViewById <SwitchCompat>(Resource.Id.settings_general_switch); switchButton.Checked = _viewModel.GetStoredCheckedState(); switchButton.CheckedChange += OnCheckedChange; backButton.Click += new StressUtils.SingleClick((sender, args) => Finish()).Run; }
partial void StartButton_TouchUpInside(UIButton sender) { LocalPreferencesHelper.SetAppLanguage(Conf.DEFAULT_LANGUAGE); LocalesService.Initialize(); Continue(); }
private void LauncherButtonNn_Click(object sender, EventArgs e) { LocalPreferencesHelper.SetAppLanguage("nn"); LocalesService.Initialize(); Continue(); }
private void LauncherButtonNb_Click(object sender, EventArgs e) { LocalPreferencesHelper.SetAppLanguage(Conf.DEFAULT_LANGUAGE); LocalesService.Initialize(); Continue(); }
private void CountinueInEnButton_Click(object sender, EventArgs e) { LocalPreferencesHelper.SetAppLanguage("en"); LocalesService.Initialize(); Continue(); }
partial void StartButtonNN_TouchUpInside(UIButton sender) { LocalPreferencesHelper.SetAppLanguage("nn"); LocalesService.Initialize(); Continue(); }
public async void OnCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case Resource.Id.settings_general_english: await DialogUtils.DisplayDialogAsync(_self, GetChangeLanguageViewModel); LocalPreferencesHelper.SetAppLanguage("en"); break; case Resource.Id.settings_general_bokmal: await DialogUtils.DisplayDialogAsync(_self, GetChangeLanguageViewModel); LocalPreferencesHelper.SetAppLanguage("nb"); break; case Resource.Id.settings_general_nynorsk: await DialogUtils.DisplayDialogAsync(_self, GetChangeLanguageViewModel); LocalPreferencesHelper.SetAppLanguage("nn"); break; case Resource.Id.settings_general_polish: await DialogUtils.DisplayDialogAsync(_self, GetChangeLanguageViewModel); LocalPreferencesHelper.SetAppLanguage("pl"); break; case Resource.Id.settings_general_somali: await DialogUtils.DisplayDialogAsync(_self, GetChangeLanguageViewModel); LocalPreferencesHelper.SetAppLanguage("so"); break; case Resource.Id.settings_general_tigrinya: await DialogUtils.DisplayDialogAsync(_self, GetChangeLanguageViewModel); LocalPreferencesHelper.SetAppLanguage("ti"); break; case Resource.Id.settings_general_arabic: await DialogUtils.DisplayDialogAsync(_self, GetChangeLanguageViewModel); LocalPreferencesHelper.SetAppLanguage("ar"); break; case Resource.Id.settings_general_urdu: await DialogUtils.DisplayDialogAsync(_self, GetChangeLanguageViewModel); LocalPreferencesHelper.SetAppLanguage("ur"); break; case Resource.Id.settings_general_lithuanian: await DialogUtils.DisplayDialogAsync(_self, GetChangeLanguageViewModel); LocalPreferencesHelper.SetAppLanguage("lt"); break; } LocalesService.SetInternationalization(); _self._resetViews.ResetViews(); }