This repository has been archived by the owner on Dec 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add FlatViewCell (#260) * Adds OverlayContent to Application (#262) * Add rotary event manager (#259) * Add rotary event manager * Change internal event to delegate * Remove unused using statements * Change class name to RotaryEventManager * Update using directive * Update CircularUI.cs * Revert "Adds OverlayContent to Application (#262)" This reverts commit 1d10147. Co-authored-by: Jay Cho <[email protected]>
- Loading branch information
1 parent
4b432d4
commit f5a25ec
Showing
13 changed files
with
315 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/Tizen.Wearable.CircularUI.Forms.Renderer/FlatViewCellRenderer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* 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 Tizen.Wearable.CircularUI.Forms; | ||
using Tizen.Wearable.CircularUI.Forms.Renderer; | ||
using Xamarin.Forms; | ||
using Xamarin.Forms.Platform.Tizen; | ||
|
||
[assembly: ExportRenderer(typeof(FlatViewCell), typeof(FlatViewCellRenderer))] | ||
namespace Tizen.Wearable.CircularUI.Forms.Renderer | ||
{ | ||
public class FlatViewCellRenderer : ViewCellRenderer | ||
{ | ||
public FlatViewCellRenderer() | ||
{ | ||
Style = "full_effect_off"; | ||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
src/Tizen.Wearable.CircularUI.Forms.Renderer/RotaryService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* 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 Xamarin.Forms; | ||
using ERotaryEventManager = ElmSharp.Wearable.RotaryEventManager; | ||
using ERotaryEventArgs = ElmSharp.Wearable.RotaryEventArgs; | ||
|
||
[assembly: Dependency(typeof(Tizen.Wearable.CircularUI.Forms.Renderer.RotaryService))] | ||
namespace Tizen.Wearable.CircularUI.Forms.Renderer | ||
{ | ||
public class RotaryService : IRotaryService | ||
{ | ||
EventHandler<RotaryEventArgs> _rotated; | ||
|
||
public event EventHandler<RotaryEventArgs> Rotated | ||
{ | ||
add | ||
{ | ||
if (_rotated == null) | ||
{ | ||
ERotaryEventManager.Rotated += OnRotaryChanged; | ||
} | ||
_rotated += value; | ||
} | ||
remove | ||
{ | ||
_rotated -= value; | ||
if (_rotated == null) | ||
{ | ||
ERotaryEventManager.Rotated -= OnRotaryChanged; | ||
} | ||
} | ||
} | ||
|
||
void OnRotaryChanged(ERotaryEventArgs args) | ||
{ | ||
_rotated?.Invoke(this, new RotaryEventArgs() { IsClockwise = args.IsClockwise }); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* 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 Xamarin.Forms; | ||
|
||
namespace Tizen.Wearable.CircularUI.Forms | ||
{ | ||
/// <summary> | ||
/// FlatViewCell contains a developer-defined Xamarin.Forms.View. | ||
/// It has no fish-eye effect while ViewCell has fish-eye effect. | ||
/// </summary> | ||
/// <since_tizen> 6 </since_tizen> | ||
public class FlatViewCell : ViewCell | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System; | ||
|
||
namespace Tizen.Wearable.CircularUI.Forms | ||
{ | ||
interface IRotaryService | ||
{ | ||
event EventHandler<RotaryEventArgs> Rotated; | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* 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 Xamarin.Forms; | ||
|
||
namespace Tizen.Wearable.CircularUI.Forms | ||
{ | ||
/// <summary> | ||
/// The RotaryEventManager provides an event for the global rotary event for wearable devices. | ||
/// </summary> | ||
/// <since_tizen> 4 </since_tizen> | ||
/// <example> | ||
/// <code> | ||
/// RotaryEventManager.Rotated += (s, e) => | ||
/// { | ||
/// Console.WriteLine($"Rotated! Rotated direction: ${e.IsClockwise}"); | ||
/// }; | ||
/// </code> | ||
/// </example> | ||
public static class RotaryEventManager | ||
{ | ||
static IRotaryService ProxyService { get; } = DependencyService.Get<IRotaryService>(); | ||
|
||
/// <summary> | ||
/// Rotated will be triggered when the rotatable device's Bezel is rotated. | ||
/// </summary> | ||
public static event EventHandler<RotaryEventArgs> Rotated | ||
{ | ||
add | ||
{ | ||
ProxyService.Rotated += value; | ||
} | ||
remove | ||
{ | ||
ProxyService.Rotated -= value; | ||
} | ||
} | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
test/WearableUIGallery/WearableUIGallery/TC/TCCircleListViewNoItemEffect.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<w:CirclePage | ||
x:Class="WearableUIGallery.TC.TCCircleListViewNoItemEffect" | ||
xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:local="clr-namespace:WearableUIGallery.TC" | ||
xmlns:sys="clr-namespace:System;assembly=netstandard" | ||
xmlns:w="clr-namespace:Tizen.Wearable.CircularUI.Forms;assembly=Tizen.Wearable.CircularUI.Forms" | ||
RotaryFocusObject="{x:Reference mylist}"> | ||
<w:CirclePage.Resources> | ||
<DataTemplate x:Key="FlatItem"> | ||
<w:FlatViewCell> | ||
<Grid> | ||
<BoxView HeightRequest="200" BackgroundColor="Blue"/> | ||
<Label Text="Flat ViewCell" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"/> | ||
</Grid> | ||
</w:FlatViewCell> | ||
</DataTemplate> | ||
<DataTemplate x:Key="NormalItem"> | ||
<TextCell Text="{Binding .}" /> | ||
</DataTemplate> | ||
<local:MyItemSelector x:Key="myItemSelector" | ||
FlatItemTemplate="{StaticResource FlatItem}" | ||
NormalItemTemplate="{StaticResource NormalItem}" /> | ||
</w:CirclePage.Resources> | ||
<w:CirclePage.Content> | ||
<w:CircleListView x:Name="mylist" ItemTapped="OnItemTapped" ItemTemplate="{StaticResource myItemSelector}"> | ||
<w:CircleListView.ItemsSource> | ||
<x:Array Type="{x:Type sys:String}"> | ||
<x:String>Item 1</x:String> | ||
<x:String>Item 2</x:String> | ||
<x:String>Item 3</x:String> | ||
<x:String>Item 4</x:String> | ||
<x:String>Item 5</x:String> | ||
</x:Array> | ||
</w:CircleListView.ItemsSource> | ||
<w:CircleListView.Header> | ||
<x:String>Header</x:String> | ||
</w:CircleListView.Header> | ||
<w:CircleListView.Footer> | ||
<x:String>Footer</x:String> | ||
</w:CircleListView.Footer> | ||
<w:CircleListView.HeaderTemplate> | ||
<DataTemplate> | ||
<Label | ||
w:CircleListView.CancelEffect="True" | ||
HeightRequest="120" | ||
FontAttributes="Bold" | ||
FontSize="Large" | ||
HorizontalTextAlignment="Center" | ||
VerticalTextAlignment="Center" | ||
Text="{Binding .}" | ||
TextColor="Red" /> | ||
</DataTemplate> | ||
</w:CircleListView.HeaderTemplate> | ||
<w:CircleListView.FooterTemplate> | ||
<DataTemplate> | ||
<Label | ||
w:CircleListView.CancelEffect="True" | ||
HeightRequest="120" | ||
FontAttributes="Bold" | ||
FontSize="Large" | ||
HorizontalTextAlignment="Center" | ||
VerticalTextAlignment="Center" | ||
Text="{Binding .}" | ||
TextColor="Blue" /> | ||
</DataTemplate> | ||
</w:CircleListView.FooterTemplate> | ||
</w:CircleListView> | ||
</w:CirclePage.Content> | ||
</w:CirclePage> |
Oops, something went wrong.