<ItemGroup>
<Compile Include="CallApp.cs" />
<Compile Include="CallApp.Tizen.cs" />
+ <Compile Include="Common\Controls\CustomGrid.xaml.cs">
+ <DependentUpon>CustomGrid.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Common\Controls\CustomImage.xaml.cs">
+ <DependentUpon>CustomImage.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Common\Controls\GesturesContainer.xaml.cs">
+ <DependentUpon>GesturesContainer.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Common\Controls\Renderers\CustomImageRenderer.cs" />
+ <Compile Include="Common\Helpers\BaseModel.cs" />
+ <Compile Include="Common\Helpers\Logger.cs" />
+ <Compile Include="Common\Helpers\PageNavigator.cs" />
<Compile Include="loc\loc.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<LastGenOutput>loc.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Common\Controls\CustomGrid.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="Common\Controls\CustomImage.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="Common\Controls\GesturesContainer.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<Grid xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="CallApp.Tizen.Common.Controls.CustomGrid"
+ ColumnSpacing="0"
+ RowSpacing="0">
+
+</Grid>
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright 2017 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 Xamarin.Forms;
+
+namespace CallApp.Tizen.Common.Controls
+{
+ /// <summary>
+ /// Extension of Xamarin Grid, with support:
+ /// Without Column spacing by default
+ /// Without Row spacing by default
+ /// </summary>
+ public partial class CustomGrid : Grid
+ {
+ public CustomGrid()
+ {
+ InitializeComponent();
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<Image xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="CallApp.Tizen.Common.Controls.CustomImage">
+
+</Image>
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright 2017 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 Xamarin.Forms;
+
+namespace CallApp.Tizen.Common.Controls
+{
+ /// <summary>
+ /// Extension of Xamarin Image, with support:
+ /// Color blending
+ /// </summary>
+ public partial class CustomImage : Image
+ {
+ public CustomImage()
+ {
+ InitializeComponent();
+ }
+
+ /// <summary>
+ /// Color for blending
+ /// </summary>
+ public static readonly BindableProperty BlendingColorProperty = BindableProperty.Create(
+ "BlendingColor",
+ typeof(Color),
+ typeof(CustomImage),
+ Color.White);
+
+ public Color BlendingColor
+ {
+ get
+ {
+ return (Color)GetValue(BlendingColorProperty);
+ }
+ set
+ {
+ SetValue(BlendingColorProperty, value);
+ }
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="CallApp.Tizen.Common.Controls.GesturesContainer">
+
+</ContentView>
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright 2017 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 System;
+using Xamarin.Forms;
+
+namespace CallApp.Tizen.Common.Controls
+{
+ /// <summary>
+ /// Container that performs freeform gestures. Can be wrapped around UI element
+ /// This class is workaround, until is not fixed http://suprem.sec.samsung.net/jira/browse/TCAPI-2519
+ /// </summary>
+ public partial class GesturesContainer : ContentView
+ {
+ /// <summary>
+ /// Event that is raised when the pan gesture changes
+ /// </summary>
+ public event EventHandler<PanUpdatedEventArgs> PanUpdated = delegate { };
+
+ private readonly PanGestureRecognizer _pan = new PanGestureRecognizer();
+
+ public GesturesContainer()
+ {
+ InitializeComponent();
+
+ // Need to use last event during loading control. At this case it's a SizeChanged event
+ SizeChanged += OnSizeChanged;
+ _pan.PanUpdated += OnPanUpdated;
+ }
+
+ private void OnSizeChanged(object sender, EventArgs e)
+ {
+ if (!GestureRecognizers.Contains(_pan))
+ {
+ // TODO: May contain various gesture recognizers
+ GestureRecognizers.Add(_pan);
+ }
+ }
+
+ private void OnPanUpdated(object sender, PanUpdatedEventArgs e)
+ {
+ PanUpdated(sender, e);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright 2017 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 CallApp.Tizen.Common.Controls;
+using CallApp.Tizen.Common.Controls.Renderers;
+using System.ComponentModel;
+using Xamarin.Forms;
+using Xamarin.Forms.Platform.Tizen;
+
+[assembly: ExportRenderer(typeof(CustomImage), typeof(CustomImageRenderer))]
+namespace CallApp.Tizen.Common.Controls.Renderers
+{
+ /// <summary>
+ /// A renderer for CustomImage
+ /// </summary>
+ class CustomImageRenderer : ImageRenderer
+ {
+ /// <summary>
+ /// <see cref="ImageRenderer.OnElementChanged(ElementChangedEventArgs{Image})" />
+ /// </summary>
+ protected override void OnElementChanged(ElementChangedEventArgs<Image> e)
+ {
+ base.OnElementChanged(e);
+
+ if (Control == null || Element == null)
+ {
+ return;
+ }
+
+ applyBlendingColor();
+ }
+
+ /// <summary>
+ /// <see cref="ImageRenderer.OnElementPropertyChanged(object, PropertyChangedEventArgs)" />
+ /// </summary>
+ protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
+ {
+ base.OnElementPropertyChanged(sender, e);
+
+ // TODO: This is not working, seems a bug
+ /*
+ if (e.PropertyName == CustomImage.BlendingColorProperty.PropertyName)
+ {
+ applyBlendingColor();
+ }
+ */
+
+ applyBlendingColor();
+ }
+
+ private void applyBlendingColor()
+ {
+ Control.Color = ((CustomImage)Element).BlendingColor.ToNative();
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright 2017 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 System.ComponentModel;
+using System.Runtime.CompilerServices;
+
+namespace CallApp.Tizen.Common.Helpers
+{
+ /// <summary>
+ /// Base class for ViewModels or Models, implements INotifyPropertyChanged interface
+ /// </summary>
+ public class BaseModel : INotifyPropertyChanged
+ {
+ /// <summary>
+ /// Property changed event
+ /// </summary>
+ public event PropertyChangedEventHandler PropertyChanged = delegate { };
+
+ /// <summary>
+ /// Raise PropertyChanged event
+ /// </summary>
+ /// <param name="propertyName">Changed property name</param>
+ protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright 2017 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 System;
+using System.Runtime.CompilerServices;
+
+namespace CallApp.Tizen.Common.Helpers
+{
+ static class Logger
+ {
+ public static void Debug(string message, [CallerFilePath] string file = "", [CallerMemberName] string method = "")
+ {
+ Console.WriteLine("{0}, {1}, {2}", file, method, message);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright 2017 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 Xamarin.Forms;
+
+namespace CallApp.Tizen.Common.Helpers
+{
+ /// <summary>
+ /// Helper with navigation logics through pages
+ /// </summary>
+ class PageNavigator
+ {
+ /// <summary>
+ /// Navigate to new page in modal state
+ /// </summary>
+ /// <param name="page">Page to navigate</param>
+ public static void NavigateModal(Page page)
+ {
+ if (Application.Current.MainPage != null)
+ {
+ Application.Current.MainPage.Navigation.PushModalAsync(page);
+ }
+ else
+ {
+ Logger.Debug("Application.Current.MainPage is null");
+ }
+ }
+ }
+}