public class CircleSpinner : Spinner, IRotaryActionWidget
{
IntPtr _circleHandle;
- double _angleRatio = 1.0;
+ double _angleRatio = -1.0;
CircleSurface _surface;
/// <summary>
/// Sets or gets the circle spinner angle per each spinner value.
/// </summary>
/// <since_tizen> preview </since_tizen>
+ [Obsolete("Use Step")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
public double AngleRatio
{
get
{
+ if(_angleRatio <= 0)
+ {
+ if(Maximum == Minimum)
+ {
+ return 0.0;
+ }
+ else
+ {
+ return 360/(Maximum - Minimum);
+ }
+ }
+
return _angleRatio;
}
set
{
- _angleRatio = value;
- Interop.Eext.eext_circle_object_spinner_angle_set(CircleHandle, _angleRatio);
+ if(value > 0)
+ {
+ if (_angleRatio == value) return;
+
+ _angleRatio = value;
+
+ Interop.Eext.eext_circle_object_spinner_angle_set(CircleHandle, _angleRatio);
+ }
}
}
[DllImport(Libraries.Notification, EntryPoint = "notification_set_delete_timeout")]
internal static extern NotificationError SetDeleteTime(NotificationSafeHandle handle, int timeout);
- [DllImport(Libraries.Notification, EntryPoint = "notification_set_extention_data")]
- internal static extern NotificationError SetExtentionData(NotificationSafeHandle handle, string key, SafeBundleHandle bundleHandle);
+ [DllImport(Libraries.Notification, EntryPoint = "notification_set_extension_data")]
+ internal static extern NotificationError SetExtensionData(NotificationSafeHandle handle, string key, SafeBundleHandle bundleHandle);
- [DllImport(Libraries.Notification, EntryPoint = "notification_get_extention_data")]
- internal static extern NotificationError GetExtentionData(NotificationSafeHandle handle, string key, out SafeBundleHandle bundleHandle);
+ [DllImport(Libraries.Notification, EntryPoint = "notification_get_extension_data")]
+ internal static extern NotificationError GetExtensionData(NotificationSafeHandle handle, string key, out SafeBundleHandle bundleHandle);
[DllImport(Libraries.Notification, EntryPoint = "notification_get_args")]
- internal static extern NotificationError GetExtentionBundle(NotificationSafeHandle handle, out IntPtr args, out IntPtr group_args);
+ internal static extern NotificationError GetExtensionBundle(NotificationSafeHandle handle, out IntPtr args, out IntPtr group_args);
[DllImport(Libraries.Notification, EntryPoint = "notification_get_default_button")]
internal static extern NotificationError GetDefaultButton(NotificationSafeHandle handle, out int index);
foreach (string key in GetextraDataDictionary().Keys)
{
Log.Info(LogTag, "Start to bind Notification.ExtenderData to SafeHandle");
- Interop.Notification.SetExtentionData(Handle, key, extraDataDictionary[key].SafeBundleHandle);
+ Interop.Notification.SetExtensionData(Handle, key, extraDataDictionary[key].SafeBundleHandle);
}
foreach (Notification.StyleBase style in styleDictionary.Values)
internal Notification Build()
{
- IntPtr extention = IntPtr.Zero;
- IntPtr extentionBundlePtr = IntPtr.Zero;
+ IntPtr extension = IntPtr.Zero;
+ IntPtr extensionBundlePtr = IntPtr.Zero;
NotificationBinder.BindSafeHandle(this);
- Interop.Notification.GetExtentionBundle(Handle, out extention, out extentionBundlePtr);
+ Interop.Notification.GetExtensionBundle(Handle, out extension, out extensionBundlePtr);
- if (extention != IntPtr.Zero)
+ if (extension != IntPtr.Zero)
{
- Bundle bundle = new Bundle(new SafeBundleHandle(extention, false));
+ Bundle bundle = new Bundle(new SafeBundleHandle(extension, false));
foreach (string key in bundle.Keys)
{
if (key.StartsWith("_NOTIFICATION_EXTENSION_EVENT_"))
continue;
SafeBundleHandle sbh;
- Interop.Notification.GetExtentionData(Handle, key, out sbh);
+ Interop.Notification.GetExtensionData(Handle, key, out sbh);
extraDataDictionary.Add(key, new Bundle(sbh));
}
}
Bundle bundle = new Bundle();
bundle.AddItem(replyKey, ((int)this.ParentIndex).ToString());
- Interop.Notification.SetExtentionData(notification.Handle, replyKey, bundle.SafeBundleHandle);
+ Interop.Notification.SetExtensionData(notification.Handle, replyKey, bundle.SafeBundleHandle);
Interop.Notification.SetPlaceHolderLength(notification.Handle, this.ReplyMax);
Interop.Notification.SetText(notification.Handle, NotificationText.PlaceHolder, PlaceHolderText, null, -1);
try
{
SafeBundleHandle bundleHandle;
- Interop.Notification.GetExtentionData(notification.Handle, replyKey, out bundleHandle);
+ Interop.Notification.GetExtensionData(notification.Handle, replyKey, out bundleHandle);
Bundle bundle = new Bundle(bundleHandle);
reply.ParentIndex = (ButtonIndex)int.Parse(bundle.GetItem(replyKey).ToString());
}
[DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_property")]
internal static extern ErrorCode GetProperties(NotificationSafeHandle handle, out int flags);
- [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_extention_data")]
+ [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_extension_data")]
internal static extern ErrorCode GetExtender(NotificationSafeHandle handle, string key, out SafeBundleHandle value);
[DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_clone")]
internal static extern ErrorCode NotificationListFree(IntPtr list);
[DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_args")]
- internal static extern ErrorCode GetExtentionBundle(NotificationSafeHandle handle, out IntPtr args, out IntPtr groupArgs);
+ internal static extern ErrorCode GetExtensionBundle(NotificationSafeHandle handle, out IntPtr args, out IntPtr groupArgs);
[DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_hide_timeout")]
internal static extern ErrorCode GetHideTimeout(NotificationSafeHandle handle, out int timeout);
NotificationLayout layout;
NotificationType type;
string text;
- IntPtr extention = IntPtr.Zero;
+ IntPtr extension = IntPtr.Zero;
IntPtr dummy = IntPtr.Zero;
SafeAppControlHandle appcontrol = null;
eventargs.IsVisible = false;
}
- err = Interop.NotificationEventListener.GetExtentionBundle(eventargs.Handle, out extention, out dummy);
+ err = Interop.NotificationEventListener.GetExtensionBundle(eventargs.Handle, out extension, out dummy);
if (err != Interop.NotificationEventListener.ErrorCode.None)
{
Log.Info(LogTag, "unable to get Extender");
}
- if (extention != IntPtr.Zero)
+ if (extension != IntPtr.Zero)
{
- Bundle bundle = new Bundle(new SafeBundleHandle(extention, false));
+ Bundle bundle = new Bundle(new SafeBundleHandle(extension, false));
foreach (string key in bundle.Keys)
{
if (key.StartsWith("_NOTIFICATION_EXTENSION_EVENT_"))
}
/// <summary>
- /// Set: Enables looping for 'count' repeats. A zero is the same as Looping = true; i.e., repeat forever.<br />
- /// If Play() Stop() or 'count' loops is reached, the loop counter will reset.<br />
+ /// Set: Enables looping for a specified number of repeats. A zero is the same as Looping = true; i.e., repeat forever.<br />
+ /// This property resets the looping value and should not be used with the Looping property.<br />
/// Setting this parameter does not cause the animation to Play().<br />
/// Get: Gets the loop count. A zero is the same as Looping = true; i.e., repeat forever.<br />
/// The loop count is initially 1 for play once.<br />
}
-}
\ No newline at end of file
+}
class CircleSpinnerTest1 : TestCaseBase
{
public override string TestName => "CircleSpinnerTest1";
- public override string TestDescription => "To test basic operation of Circle Spinner";
+ public override string TestDescription => "To test basic operation of Circle Spinner with no AngleRatio";
public override void Run(Window window)
{
Text = "Spinner Test",
LabelFormat = "%d Value",
Style = "circle",
- AngleRatio = 3.0,
Minimum = 0,
- Maximum = 360,
+ Maximum = 100,
Value = 0,
Step = 10,
Interval = 0.5,
class CircleSpinnerTest2 : TestCaseBase
{
public override string TestName => "CircleSpinnerTest2";
- public override string TestDescription => "To test basic operation of Circle Spinner";
+ public override string TestDescription => "To test basic operation of Circle Spinner with Marker";
public override void Run(Window window)
{
class CircleSpinnerTest3 : TestCaseBase
{
public override string TestName => "CircleSpinnerTest3";
- public override string TestDescription => "To test basic operation of Circle Spinner";
+ public override string TestDescription => "To test basic operation of Circle Spinner with AngleRatio";
public override void Run(Window window)
{
Text = "Spinner Test",
LabelFormat = "%d Value",
Style = "circle",
- AngleRatio = 3.0,
+ AngleRatio = 1.0,
Minimum = 0,
- Maximum = 360,
+ Maximum = 100,
Value = 0,
Step = 10,
Interval = 0.5,
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+using ElmSharp.Wearable;
+
+namespace ElmSharp.Test.TC
+{
+ class CircleSpinnerTest4 : TestCaseBase
+ {
+ public override string TestName => "CircleSpinnerTest4";
+ public override string TestDescription => "To test advanced operation of Circle Spinner with AngleRatio";
+
+ CircleSpinner spn1;
+ CircleSpinner spn2;
+
+ public override void Run(Window window)
+ {
+ Log.Debug(TestName, "CircleSpinnerTest run");
+
+ Rect square = window.GetInnerSquare();
+
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+
+ var surface = new CircleSurface(conformant);
+ spn1 = new CircleSpinner(window, surface) {
+ Text = "Spinner Test",
+ LabelFormat = "%d Ratio",
+ Style = "circle",
+ Minimum = 0,
+ Maximum = 100,
+ Value = 0.0,
+ Step = 10,
+ Interval = 0.5,
+ AlignmentX = -1,
+ AlignmentY = 0.5,
+ WeightX = 1,
+ WeightY = 1
+ };
+ spn1.Geometry = new Rect(square.X, square.Y, square.Width, square.Height / 4);
+ spn1.Show();
+
+ spn2 = new CircleSpinner(window, surface) {
+ Text = "Spinner Test",
+ LabelFormat = "%d Value",
+ Style = "circle",
+ MarkerColor = Color.Red,
+ Minimum = 0,
+ Maximum = 100,
+ Value = 0,
+ Interval = 0.5,
+ AlignmentX = -1,
+ AlignmentY = 0.5,
+ WeightX = 1,
+ WeightY = 1
+ };
+ spn2.Geometry = new Rect(square.X, square.Y+ square.Width * 2 / 4, square.Width, square.Height / 4);
+ spn2.Show();
+
+ spn1.Focused += Spn1_Focused;
+ spn2.Focused += Spn2_Focused;
+ spn1.ValueChanged += Spn1_ValueChanged;
+ }
+
+ private void Spn1_ValueChanged(object sender, System.EventArgs e)
+ {
+ spn2.AngleRatio = spn1.Value;
+ }
+
+ private void Spn2_Focused(object sender, System.EventArgs e)
+ {
+ ((IRotaryActionWidget)spn2).Activate();
+ }
+
+ private void Spn1_Focused(object sender, System.EventArgs e)
+ {
+ ((IRotaryActionWidget)spn1).Activate();
+ }
+ }
+}