Alarm reccurence on AddEditPage is displayed according to the guide 22/179822/3
authorMichal Kolodziejski <m.kolodziejs@samsung.com>
Tue, 22 May 2018 13:44:17 +0000 (15:44 +0200)
committerMichal Kolodziejski <m.kolodziejs@samsung.com>
Wed, 23 May 2018 13:15:29 +0000 (15:15 +0200)
Change-Id: I4676495727ba940e0add6ffbdce4cdfaf4f15ebb
Signed-off-by: Michal Kolodziejski <m.kolodziejs@samsung.com>
Clock/Clock.Tizen.Mobile/Behaviors/AlarmListCellSwitchBehavior.cs
Clock/Clock.Tizen.Mobile/Tools/Converters/DaysOfWeekToStringConverter.cs [new file with mode: 0644]
Clock/Clock.Tizen.Mobile/Translation/Resources/AppResources.Designer.cs
Clock/Clock.Tizen.Mobile/Translation/Resources/AppResources.fr-FR.resx
Clock/Clock.Tizen.Mobile/Translation/Resources/AppResources.resx
Clock/Clock.Tizen.Mobile/Translation/TranslationService.cs
Clock/Clock.Tizen.Mobile/Views/AddEditAlarmPage.xaml
Clock/Clock/ViewModels/AddEditAlarmViewModel.cs

index a85aaef..b227d3e 100644 (file)
@@ -59,6 +59,7 @@ namespace Clock.Tizen.Mobile.Behaviors
         {
             base.OnAttachedTo(bindable);
             _extendedSwitch = bindable as ExtendedSwitch;
+
             if (_extendedSwitch != null)
             {
                 _extendedSwitch.Toggled += ExtendedSwitchOnToggled;
diff --git a/Clock/Clock.Tizen.Mobile/Tools/Converters/DaysOfWeekToStringConverter.cs b/Clock/Clock.Tizen.Mobile/Tools/Converters/DaysOfWeekToStringConverter.cs
new file mode 100644 (file)
index 0000000..0b18de8
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+* Copyright 2018  Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.1 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* 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.
+*/
+
+using Clock.Model;
+using Clock.Tizen.Mobile.Translation;
+using System;
+using System.Globalization;
+using System.Text;
+using Xamarin.Forms;
+using System.Linq;
+
+namespace Clock.Tizen.Mobile.Tools.Converters
+{
+    class DaysOfWeekToStringConverter : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            var ret = new StringBuilder();
+
+            if (value is DaysOfWeek daysOfWeek)
+            {
+                if (Enum.GetValues(typeof(DaysOfWeek)).Cast<DaysOfWeek>().All(e => daysOfWeek.HasFlag(e)))
+                {
+                    return TranslationService.GetTranslation("IDS_ALM_BODY_EVERYDAY");
+                }
+                if (daysOfWeek == DaysOfWeek.Never)
+                {
+                    return TranslationService.GetTranslation("IDS_CLOCK_MBODY_NEVER");
+                }
+
+                if (daysOfWeek.HasFlag(DaysOfWeek.Sunday))
+                {
+                    ret.Append($"{TranslationService.GetTranslation("IDS_CLOCK_SBODY_SUN_ABB2")} ");
+                }
+                if (daysOfWeek.HasFlag(DaysOfWeek.Monday))
+                {
+                    ret.Append($"{TranslationService.GetTranslation("IDS_CLOCK_SBODY_MON_ABB2")} ");
+                }
+                if (daysOfWeek.HasFlag(DaysOfWeek.Tuesday))
+                {
+                    ret.Append($"{TranslationService.GetTranslation("IDS_CLOCK_SBODY_TUE_ABB2")} ");
+                }
+                if (daysOfWeek.HasFlag(DaysOfWeek.Wednesday))
+                {
+                    ret.Append($"{TranslationService.GetTranslation("IDS_CLOCK_SBODY_WED_ABB2")} ");
+                }
+                if (daysOfWeek.HasFlag(DaysOfWeek.Thursday))
+                {
+                    ret.Append($"{TranslationService.GetTranslation("IDS_CLOCK_SBODY_THU_ABB2")} ");
+                }
+                if (daysOfWeek.HasFlag(DaysOfWeek.Friday))
+                {
+                    ret.Append($"{TranslationService.GetTranslation("IDS_CLOCK_SBODY_FRI_ABB2")} ");
+                }
+                if (daysOfWeek.HasFlag(DaysOfWeek.Saturday))
+                {
+                    ret.Append($"{TranslationService.GetTranslation("IDS_CLOCK_SBODY_SAT_ABB2")} ");
+                }
+            }
+
+            return ret.ToString();
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}
index ffe470c..8be44ff 100644 (file)
@@ -178,6 +178,78 @@ namespace Clock.Tizen.Mobile.Translation.Resources {
         }
         
         /// <summary>
+        ///   Looks up a localized string similar to Never.
+        /// </summary>
+        internal static string IDS_CLOCK_MBODY_NEVER {
+            get {
+                return ResourceManager.GetString("IDS_CLOCK_MBODY_NEVER", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Fri.
+        /// </summary>
+        internal static string IDS_CLOCK_SBODY_FRI_ABB2 {
+            get {
+                return ResourceManager.GetString("IDS_CLOCK_SBODY_FRI_ABB2", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Mon.
+        /// </summary>
+        internal static string IDS_CLOCK_SBODY_MON_ABB2 {
+            get {
+                return ResourceManager.GetString("IDS_CLOCK_SBODY_MON_ABB2", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Sat.
+        /// </summary>
+        internal static string IDS_CLOCK_SBODY_SAT_ABB2 {
+            get {
+                return ResourceManager.GetString("IDS_CLOCK_SBODY_SAT_ABB2", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Sun.
+        /// </summary>
+        internal static string IDS_CLOCK_SBODY_SUN_ABB2 {
+            get {
+                return ResourceManager.GetString("IDS_CLOCK_SBODY_SUN_ABB2", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Thu.
+        /// </summary>
+        internal static string IDS_CLOCK_SBODY_THU_ABB2 {
+            get {
+                return ResourceManager.GetString("IDS_CLOCK_SBODY_THU_ABB2", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Tue.
+        /// </summary>
+        internal static string IDS_CLOCK_SBODY_TUE_ABB2 {
+            get {
+                return ResourceManager.GetString("IDS_CLOCK_SBODY_TUE_ABB2", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Wed.
+        /// </summary>
+        internal static string IDS_CLOCK_SBODY_WED_ABB2 {
+            get {
+                return ResourceManager.GetString("IDS_CLOCK_SBODY_WED_ABB2", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Looks up a localized string similar to Time is up.
         /// </summary>
         internal static string IDS_TMR_POP_TIME_IS_UP {
index 9d4cacb..49b4990 100644 (file)
   <resheader name="writer">
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
+  <data name="IDS_ALM_BODY_EVERYDAY" xml:space="preserve">
+    <value>Tous les jours</value>
+  </data>
   <data name="IDS_ALM_BODY_SOUND" xml:space="preserve">
     <value>Son</value>
   </data>
   <data name="IDS_CLOCK_BODY_WORLD_CLOCK" xml:space="preserve">
     <value>Horloge mondiale</value>
   </data>
+  <data name="IDS_CLOCK_BUTTON_EDIT_ABB4" xml:space="preserve">
+    <value>Modif.</value>
+  </data>
+  <data name="IDS_CLOCK_HEADER_CREATE" xml:space="preserve">
+    <value>Créer</value>
+  </data>
+  <data name="IDS_CLOCK_HEADER_HOURS" xml:space="preserve">
+    <value>Heures</value>
+  </data>
+  <data name="IDS_CLOCK_HEADER_MINUTES" xml:space="preserve">
+    <value>Minutes</value>
+  </data>
+  <data name="IDS_CLOCK_HEADER_SECONDS" xml:space="preserve">
+    <value>Secondes</value>
+  </data>
+  <data name="IDS_CLOCK_MBODY_NEVER" xml:space="preserve">
+    <value>Jamais</value>
+  </data>
+  <data name="IDS_TMR_POP_TIME_IS_UP" xml:space="preserve">
+    <value>Temps écoulé</value>
+  </data>
 </root>
\ No newline at end of file
index 19633f9..9be5be2 100644 (file)
   <data name="IDS_CLOCK_HEADER_SECONDS" xml:space="preserve">
     <value>Seconds</value>
   </data>
+  <data name="IDS_CLOCK_MBODY_NEVER" xml:space="preserve">
+    <value>Never</value>
+  </data>
+  <data name="IDS_CLOCK_SBODY_FRI_ABB2" xml:space="preserve">
+    <value>Fri</value>
+  </data>
+  <data name="IDS_CLOCK_SBODY_MON_ABB2" xml:space="preserve">
+    <value>Mon</value>
+  </data>
+  <data name="IDS_CLOCK_SBODY_SAT_ABB2" xml:space="preserve">
+    <value>Sat</value>
+  </data>
+  <data name="IDS_CLOCK_SBODY_SUN_ABB2" xml:space="preserve">
+    <value>Sun</value>
+  </data>
+  <data name="IDS_CLOCK_SBODY_THU_ABB2" xml:space="preserve">
+    <value>Thu</value>
+  </data>
+  <data name="IDS_CLOCK_SBODY_TUE_ABB2" xml:space="preserve">
+    <value>Tue</value>
+  </data>
+  <data name="IDS_CLOCK_SBODY_WED_ABB2" xml:space="preserve">
+    <value>Wed</value>
+  </data>
   <data name="IDS_TMR_POP_TIME_IS_UP" xml:space="preserve">
     <value>Time is up</value>
   </data>
index f8a62cd..0705d44 100644 (file)
@@ -3,6 +3,7 @@ using System.Collections;
 using System.Globalization;
 using System.Reflection;
 using System.Resources;
+using System.Threading;
 using Clock.Abstractions;
 using Clock.Data;
 using Tizen;
@@ -82,6 +83,7 @@ namespace Clock.Tizen.Mobile.Translation
 
         private void ChangeAppLanguage()
         {
+            Thread.CurrentThread.CurrentUICulture = _cultureInfo;
             var resourceSet = _resourceManager.Value.GetResourceSet(_cultureInfo, true, true);
             foreach (DictionaryEntry entry in resourceSet)
             {
index 99c1ab0..1ecde01 100644 (file)
@@ -5,6 +5,7 @@
                 xmlns:controls="clr-namespace:Clock.Tizen.Mobile.Controls;assembly=Clock.Tizen.Mobile"
                 xmlns:behaviors="clr-namespace:Clock.Tizen.Mobile.Behaviors;assembly=Clock.Tizen.Mobile"
                 xmlns:converters="clr-namespace:Clock.Tools.Converters;assembly=Clock"
+                xmlns:nativeConverters="clr-namespace:Clock.Tizen.Mobile.Tools.Converters;assembly=Clock.Tizen.Mobile"
                 xmlns:generic="clr-namespace:System.Collections.Generic;assembly=System.Collections"
                 xmlns:views="clr-namespace:Clock.Tizen.Mobile.Views;assembly=Clock.Tizen.Mobile"
                 xmlns:popups="clr-namespace:Clock.Tizen.Mobile.Controls.Popups;assembly=Clock.Tizen.Mobile"
@@ -26,7 +27,8 @@
             <converters:VolumeLevelToBoolConverter x:Key="VolumeLevelToBoolConverter" />
             <converters:AlarmTypeToBoolConverter x:Key="AlarmTypeToBoolConverter" />
             <converters:AlarmTypeToSoundIconOpacityConverter x:Key="AlarmTypeToSoundIconOpacityConverter" />
-            <converters:VolumeLevelConverter x:Key="VolumeLevelConverter"/>
+            <converters:VolumeLevelConverter x:Key="VolumeLevelConverter" />
+            <nativeConverters:DaysOfWeekToStringConverter x:Key="DaysOfWeekToStringConverter" />
             <DataTemplate x:Key="timeEditTemplate">
                 <ViewCell Height="474">
                     <AbsoluteLayout>
@@ -40,7 +42,7 @@
 
             <DataTemplate x:Key="repeatEditTemplate">
                 <controls:TextCell PrimaryText="Repeat weekly"
-                                   SecondaryText="{Binding Source={x:Reference Root}, Path=BindingContext.ViewModel.Recurrence}"
+                                   SecondaryText="{Binding Source={x:Reference Root}, Path=BindingContext.ViewModel.Recurrence, Converter={StaticResource DaysOfWeekToStringConverter}}"
                                    Command="{Binding Source={x:Reference Root}, Path=BindingContext.NavigateToAlarmRecurrenceSetPageCommand}" />
             </DataTemplate>
 
index ca74f7e..b1ea30d 100644 (file)
@@ -145,6 +145,7 @@ namespace Clock.ViewModels
 
         private void TranslationServiceOnLanguageChanged(object sender, EventArgs e)
         {
+            ViewModel.TriggerUpdate();
             OnLanguageChanged();
         }