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

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
rookiejava committed Apr 13, 2020
2 parents e18c048 + 0ef3c3e commit 9893c60
Show file tree
Hide file tree
Showing 44 changed files with 658 additions and 1,176 deletions.
2 changes: 2 additions & 0 deletions Tizen.Wearable.CircularUI.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
</dependencies>
</metadata>
<files>
<file src="Tizen.Wearable.CircularUI.targets" target="build" />
<file src="theme\tizen-circular-ui-theme.edj" target="content\theme" />
<file src="src\Tizen.Wearable.CircularUI.Forms\bin\$configuration$\netstandard2.0\Tizen.Wearable.CircularUI.Forms.dll" target="lib\netstandard2.0" />
<file src="src\Tizen.Wearable.CircularUI.Forms\bin\$configuration$\netstandard2.0\Tizen.Wearable.CircularUI.Forms.pdb" target="lib\netstandard2.0" />
<file src="src\Tizen.Wearable.CircularUI.Forms.Renderer\bin\$configuration$\tizen40\Tizen.Wearable.CircularUI.Forms.dll" target="lib\tizen40" />
Expand Down
13 changes: 13 additions & 0 deletions Tizen.Wearable.CircularUI.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<ThemeFileDirectory>$(MSBuildThisFileDirectory)..\content\theme\</ThemeFileDirectory>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'tizen40' ">
<TizenTpkUserIncludeFiles Include="$(ThemeFileDirectory)*.edj">
<TizenTpkSubDir>res</TizenTpkSubDir>
</TizenTpkUserIncludeFiles>
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion sample/ShellExamples/FlyoutExample/AppShell.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:w="clr-namespace:Tizen.Wearable.CircularUI.Forms;assembly=Tizen.Wearable.CircularUI.Forms"
xmlns:local="clr-namespace:FlyoutExample" x:Class="FlyoutExample.AppShell">
<ShellItem Route="Main" Title="Main" Icon="home.png">
<ShellItem Route="Main" Title="{Binding MainTitle, Mode=OneWay}" Icon="home.png">
<ShellContent Route="content" Title="Main" ContentTemplate="{DataTemplate local:SimplePage}"/>
</ShellItem>
<ShellItem Route="Config" Title="Config" Icon="play.png">
Expand Down
37 changes: 29 additions & 8 deletions sample/ShellExamples/FlyoutExample/AppShell.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,48 @@
using Xamarin.Forms;
using System;
using System.ComponentModel;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace FlyoutExample
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class AppShell : Shell
class ShellModel : INotifyPropertyChanged
{
public AppShell()
public static ShellModel Instance = new ShellModel();

public event PropertyChangedEventHandler PropertyChanged;

string _mainTitle = "Main";
public string MainTitle
{
InitializeComponent();
BindingContext = this;
get => _mainTitle;
set
{
_mainTitle = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("MainTitle"));
}
}

public Command OnMenu1 => new Command(() =>
{
DisplayAlert("menu", "Menu1 clicked", "Ok");
Shell.Current.DisplayAlert("menu", "Menu1 clicked", "Ok");
});

public Command OnMenu2 => new Command(() =>
{
DisplayAlert("menu", "Menu2 clicked", "Ok");
Shell.Current.DisplayAlert("menu", "Menu2 clicked", "Ok");
});

}

[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();
BindingContext = ShellModel.Instance;
}

protected override bool OnBackButtonPressed()
{
if (FlyoutIsPresented)
Expand Down
1 change: 1 addition & 0 deletions sample/ShellExamples/FlyoutExample/ConfigPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<Button Text="Change Color" Clicked="Button_Clicked_2"/>
<Button Text="Change Icon BG Color" Clicked="Button_Clicked_3"/>
<Button Text="Change Foreground Color" HeightRequest="100" Clicked="Button_Clicked_4"/>
<Button Text="Change Title" Clicked="Button_Clicked_5"/>
<BoxView HeightRequest="100" Color="Transparent"/>
</StackLayout>
</ScrollView>
Expand Down
6 changes: 6 additions & 0 deletions sample/ShellExamples/FlyoutExample/ConfigPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,11 @@ void Button_Clicked_4(object sender, EventArgs e)
Random rnd = new Random();
Tizen.Wearable.CircularUI.Forms.CircularShell.SetFlyoutForegroundColor(Shell.Current, Color.FromRgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)));
}

void Button_Clicked_5(object sender, EventArgs e)
{
Shell.Current.CurrentItem.Title = "UpdatedTitle";
ShellModel.Instance.MainTitle = "MainUpdated";
}
}
}
2 changes: 1 addition & 1 deletion sample/ShellExamples/FlyoutExample/FlyoutExample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Folder Include="lib\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.4.0.991537" />
<PackageReference Include="Xamarin.Forms" Version="4.6.0.616-pre4" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions sample/ShellExamples/ShellNavigation/ShellNavigation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
</PropertyGroup>

<ItemGroup>
<Folder Include="lib\"/>
<Folder Include="res\"/>
<Folder Include="lib\" />
<Folder Include="res\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.4.0.991537" />
<PackageReference Include="Xamarin.Forms" Version="4.6.0.616-pre4" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion sample/ShellExamples/Xaminals/Xaminals/Xaminals.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.4.0.991537" />
<PackageReference Include="Xamarin.Forms" Version="4.6.0.616-pre4" />
</ItemGroup>
<ItemGroup>
<Folder Include="Views\" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ void UpdateValueType()
if (Element.ValueType == DateTimeType.Date)
{
Control.Style = "datepicker/circle";
Control.Format = "%d/%b/%Y";
}
else if (Element.ValueType == DateTimeType.Time)
{
Expand Down
38 changes: 38 additions & 0 deletions src/Tizen.Wearable.CircularUI.Forms.Renderer/CircularUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,33 @@
*/
using System.ComponentModel;
using System.Diagnostics;
using ElmSharp;
using Tizen.Applications;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Tizen;
using XForms = Xamarin.Forms.Forms;

namespace Tizen.Wearable.CircularUI.Forms.Renderer
{
using Xamarin.Forms.PlatformConfiguration;

public class InitOptions
{
public CoreApplication Context { get; set; }

public string GoogleMapsAPIKey { get; set; }

public InitOptions(CoreApplication application)
{
Context = application;
}

public InitOptions(CoreApplication application, string googleMapsAPIKey)
{
Context = application;
GoogleMapsAPIKey = googleMapsAPIKey;
}
}

public static class FormsCircularUI
{
Expand All @@ -37,6 +57,7 @@ public static void Init()

public static void Init(string apiKey)
{

if (!string.IsNullOrEmpty(apiKey))
{
GoogleMaps.Init(apiKey);
Expand All @@ -49,6 +70,23 @@ public static void Init(string apiKey)
Init();
}

public static void Init(CoreApplication context)
{
var resPath = context?.DirectoryInfo?.Resource;
if (!string.IsNullOrEmpty(resPath))
ThemeLoader.Initialize(resPath);

Init();
}

public static void Init(InitOptions options)
{
var resPath = options.Context?.DirectoryInfo?.Resource;
if (!string.IsNullOrEmpty(resPath))
ThemeLoader.Initialize(resPath);

Init(options.GoogleMapsAPIKey);

public static void AddAppPropertyChangedHandler(this Application application)
{
UpdateOverlayContent();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* 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 Tizen.Wearable.CircularUI.Forms;
using Tizen.Wearable.CircularUI.Forms.Renderer;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Tizen;
using Xamarin.Forms.Platform.Tizen.Native;
using XForms = Xamarin.Forms.Forms;
using XFLayout = Xamarin.Forms.Layout;
using EButton = ElmSharp.Button;
using EColor = ElmSharp.Color;
using System.ComponentModel;

[assembly: ExportRenderer(typeof(ContentButton), typeof(ContentButtonRenderer))]

namespace Tizen.Wearable.CircularUI.Forms.Renderer
{
public class ContentButtonRenderer : LayoutRenderer
{
EButton _button;

ContentButton Button => Element as ContentButton;

protected override void OnElementChanged(ElementChangedEventArgs<XFLayout> e)
{
base.OnElementChanged(e);
Initialize();
}

void Initialize()
{
if (_button == null)
{
_button = new EButton(XForms.NativeParent);
_button.BackgroundColor = EColor.Transparent;
_button.SetPartColor("effect", EColor.Transparent);
_button.SetPartColor("effect_pressed", EColor.Transparent);
_button.Show();

_button.Pressed += OnPressed;
_button.Released += OnReleased;
_button.Clicked += OnClicked;

Control.PackEnd(_button);
}
}

protected override void UpdateLayout()
{
base.UpdateLayout();

_button.Geometry = Control.Geometry;
_button.RaiseTop();
}

void OnPressed(object sender, EventArgs args)
{
Button?.SendPressed();
}

void OnReleased(object sender, EventArgs args)
{
Button?.SendReleased();
}

void OnClicked(object sender, EventArgs args)
{
Button?.SendClicked();
}
}
}
25 changes: 0 additions & 25 deletions src/Tizen.Wearable.CircularUI.Forms.Renderer/IMediaViewProvider.cs

This file was deleted.

Loading

0 comments on commit 9893c60

Please sign in to comment.