Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

Adds MediaView #170

Merged
merged 1 commit into from
Mar 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Tizen.Wearable.CircularUI.Test.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WearableUIGallery", "test\W
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WearableUIGallery.Tizen.Wearable", "test\WearableUIGallery\WearableUIGallery.Tizen.Wearable\WearableUIGallery.Tizen.Wearable.csproj", "{BACCF137-6E0F-4A33-AEC9-5EAF95C0E892}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CircularUI", "src\Tizen.Wearable.CircularUI.Forms\Tizen.Wearable.CircularUI.Forms.csproj", "{571EFE9E-B539-4FF7-8E28-A6F451C64652}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Wearable.CircularUI.Forms", "src\Tizen.Wearable.CircularUI.Forms\Tizen.Wearable.CircularUI.Forms.csproj", "{571EFE9E-B539-4FF7-8E28-A6F451C64652}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CircularUI.Tizen", "src\Tizen.Wearable.CircularUI.Forms.Renderer\Tizen.Wearable.CircularUI.Forms.Renderer.csproj", "{8B32EE6A-0ADD-4E64-80E9-B2375690CC70}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Wearable.CircularUI.Forms.Renderer", "src\Tizen.Wearable.CircularUI.Forms.Renderer\Tizen.Wearable.CircularUI.Forms.Renderer.csproj", "{8B32EE6A-0ADD-4E64-80E9-B2375690CC70}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleTextWatchface", "test\SimpleTextWatchface\SimpleTextWatchface.csproj", "{1998035F-ECAF-493E-8226-E7EB33D0C982}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleTextWatchface", "test\SimpleTextWatchface\SimpleTextWatchface.csproj", "{1998035F-ECAF-493E-8226-E7EB33D0C982}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sample", "sample", "{E00DD78A-32EC-4AFA-BC81-EEFF9A80E7E8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{9F1AB8B9-03B0-40A7-AB49-522B741F570A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -43,6 +47,11 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{4B3ADEDC-D646-4C8A-B6AD-F2A07F2A0ACC} = {9F1AB8B9-03B0-40A7-AB49-522B741F570A}
{BACCF137-6E0F-4A33-AEC9-5EAF95C0E892} = {9F1AB8B9-03B0-40A7-AB49-522B741F570A}
{1998035F-ECAF-493E-8226-E7EB33D0C982} = {E00DD78A-32EC-4AFA-BC81-EEFF9A80E7E8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3736C77A-08ED-442D-ADE1-5779254463ED}
EndGlobalSection
Expand Down
5 changes: 5 additions & 0 deletions src/Tizen.Wearable.CircularUI.Forms.Renderer/CircularUI.cs
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using ElmSharp;

namespace Tizen.Wearable.CircularUI.Forms.Renderer
{
public static class FormsCircularUI
{
public static readonly string Tag = "CircularUI";

public static bool IsInitialized { get; private set; }

public static void Init()
{
if (IsInitialized) return;
Expand Down
25 changes: 25 additions & 0 deletions src/Tizen.Wearable.CircularUI.Forms.Renderer/IMediaViewProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
*
* 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 MMView = Tizen.Multimedia.MediaView;

namespace Tizen.Wearable.CircularUI.Forms
{
public interface IMediaViewProvider
{
MMView GetMediaView();
}
}
131 changes: 131 additions & 0 deletions src/Tizen.Wearable.CircularUI.Forms.Renderer/LayoutCanvas.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/*
* Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
*
* 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 System;
using ElmSharp;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using Xamarin.Forms.Platform.Tizen.Native;

namespace Tizen.Wearable.CircularUI.Forms
{
public class LayoutCanvas : ElmSharp.Layout, IContainable<EvasObject>
{
/// <summary>
/// The list of Views.
/// </summary>
readonly ObservableCollection<EvasObject> _children = new ObservableCollection<EvasObject>();
Xamarin.Forms.Platform.Tizen.Native.Box _box;


/// <summary>
/// Initializes a new instance of the <see cref="Xamarin.Forms.Platform.Tizen.Native.Canvas"/> class.
/// </summary>
/// <remarks>Canvas doesn't support replacing its children, this will be ignored.</remarks>
/// <param name="parent">Parent of this instance.</param>
public LayoutCanvas(EvasObject parent) : base(parent)
{
SetTheme("layout", "elm_widget", "default");
_box = new Xamarin.Forms.Platform.Tizen.Native.Box(parent);
SetContent(_box);

_children.CollectionChanged += (o, e) =>
{
if (e.Action == NotifyCollectionChangedAction.Add)
{
foreach (var v in e.NewItems)
{
var view = v as EvasObject;
if (null != view)
{
OnAdd(view);
}
}
}
else if (e.Action == NotifyCollectionChangedAction.Remove)
{
foreach (var v in e.OldItems)
{
if (v is EvasObject view)
{
OnRemove(view);
}
}
}
else if (e.Action == NotifyCollectionChangedAction.Reset)
{
OnRemoveAll();
}
};
}

public event EventHandler<LayoutEventArgs> LayoutUpdated
{
add { _box.LayoutUpdated += value; }
remove { _box.LayoutUpdated -= value; }
}

/// <summary>
/// Gets list of native elements that are placed in the canvas.
/// </summary>
public new IList<EvasObject> Children
{
get
{
return _children;
}
}

/// <summary>
/// Provides destruction for native element and contained elements.
/// </summary>
protected override void OnUnrealize()
{
foreach (var child in _children)
{
child.Unrealize();
}

base.OnUnrealize();
}

/// <summary>
/// Adds a new child to a container.
/// </summary>
/// <param name="view">Native element which will be added</param>
void OnAdd(EvasObject view)
{
_box.PackEnd(view);
}

/// <summary>
/// Removes a child from a container.
/// </summary>
/// <param name="view">Child element to be removed from canvas</param>
void OnRemove(EvasObject view)
{
_box.UnPack(view);
}

/// <summary>
/// Removes all children from a canvas.
/// </summary>
void OnRemoveAll()
{
_box.UnPackAll();
}
}
}
Loading