summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuslan Zakharov <r.zakharov@samsung.com>2017-07-07 13:27:10 +0300
committerRuslan Zakharov <r.zakharov@samsung.com>2017-07-11 17:18:25 +0300
commit83be4c573beab099a6ed919e2e25b06706de1283 (patch)
tree0f61c9d1cfd0a0170779c7a7004313f1fa3e9ce2
parent17b5c41914be0135101271e944c2e398bade849f (diff)
downloadcall-ui-83be4c573beab099a6ed919e2e25b06706de1283.tar.gz
call-ui-83be4c573beab099a6ed919e2e25b06706de1283.tar.bz2
call-ui-83be4c573beab099a6ed919e2e25b06706de1283.zip
TizenRefApp-8628 Implement project skeleton for Call app
Added common Controls and Helpers Change-Id: Ic157409f60bf643d5186f22460ae6ecdabdb32ec
-rw-r--r--CallApp.Tizen/CallApp.Tizen.csproj24
-rw-r--r--CallApp.Tizen/Common/Controls/CustomGrid.xaml8
-rw-r--r--CallApp.Tizen/Common/Controls/CustomGrid.xaml.cs33
-rw-r--r--CallApp.Tizen/Common/Controls/CustomImage.xaml6
-rw-r--r--CallApp.Tizen/Common/Controls/CustomImage.xaml.cs53
-rw-r--r--CallApp.Tizen/Common/Controls/GesturesContainer.xaml6
-rw-r--r--CallApp.Tizen/Common/Controls/GesturesContainer.xaml.cs58
-rw-r--r--CallApp.Tizen/Common/Controls/Renderers/CustomImageRenderer.cs69
-rw-r--r--CallApp.Tizen/Common/Helpers/BaseModel.cs41
-rw-r--r--CallApp.Tizen/Common/Helpers/Logger.cs29
-rw-r--r--CallApp.Tizen/Common/Helpers/PageNavigator.cs42
11 files changed, 369 insertions, 0 deletions
diff --git a/CallApp.Tizen/CallApp.Tizen.csproj b/CallApp.Tizen/CallApp.Tizen.csproj
index 4e5aa62..bd9b357 100644
--- a/CallApp.Tizen/CallApp.Tizen.csproj
+++ b/CallApp.Tizen/CallApp.Tizen.csproj
@@ -52,6 +52,19 @@
<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>
@@ -88,6 +101,17 @@
<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.
diff --git a/CallApp.Tizen/Common/Controls/CustomGrid.xaml b/CallApp.Tizen/Common/Controls/CustomGrid.xaml
new file mode 100644
index 0000000..c088543
--- /dev/null
+++ b/CallApp.Tizen/Common/Controls/CustomGrid.xaml
@@ -0,0 +1,8 @@
+<?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
diff --git a/CallApp.Tizen/Common/Controls/CustomGrid.xaml.cs b/CallApp.Tizen/Common/Controls/CustomGrid.xaml.cs
new file mode 100644
index 0000000..dafc716
--- /dev/null
+++ b/CallApp.Tizen/Common/Controls/CustomGrid.xaml.cs
@@ -0,0 +1,33 @@
+/*
+ * 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();
+ }
+ }
+}
diff --git a/CallApp.Tizen/Common/Controls/CustomImage.xaml b/CallApp.Tizen/Common/Controls/CustomImage.xaml
new file mode 100644
index 0000000..9f3432c
--- /dev/null
+++ b/CallApp.Tizen/Common/Controls/CustomImage.xaml
@@ -0,0 +1,6 @@
+<?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
diff --git a/CallApp.Tizen/Common/Controls/CustomImage.xaml.cs b/CallApp.Tizen/Common/Controls/CustomImage.xaml.cs
new file mode 100644
index 0000000..6a443eb
--- /dev/null
+++ b/CallApp.Tizen/Common/Controls/CustomImage.xaml.cs
@@ -0,0 +1,53 @@
+/*
+ * 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);
+ }
+ }
+ }
+}
diff --git a/CallApp.Tizen/Common/Controls/GesturesContainer.xaml b/CallApp.Tizen/Common/Controls/GesturesContainer.xaml
new file mode 100644
index 0000000..210face
--- /dev/null
+++ b/CallApp.Tizen/Common/Controls/GesturesContainer.xaml
@@ -0,0 +1,6 @@
+<?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
diff --git a/CallApp.Tizen/Common/Controls/GesturesContainer.xaml.cs b/CallApp.Tizen/Common/Controls/GesturesContainer.xaml.cs
new file mode 100644
index 0000000..5a0b303
--- /dev/null
+++ b/CallApp.Tizen/Common/Controls/GesturesContainer.xaml.cs
@@ -0,0 +1,58 @@
+/*
+ * 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);
+ }
+ }
+}
diff --git a/CallApp.Tizen/Common/Controls/Renderers/CustomImageRenderer.cs b/CallApp.Tizen/Common/Controls/Renderers/CustomImageRenderer.cs
new file mode 100644
index 0000000..ec00679
--- /dev/null
+++ b/CallApp.Tizen/Common/Controls/Renderers/CustomImageRenderer.cs
@@ -0,0 +1,69 @@
+/*
+ * 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();
+ }
+ }
+}
diff --git a/CallApp.Tizen/Common/Helpers/BaseModel.cs b/CallApp.Tizen/Common/Helpers/BaseModel.cs
new file mode 100644
index 0000000..137ca91
--- /dev/null
+++ b/CallApp.Tizen/Common/Helpers/BaseModel.cs
@@ -0,0 +1,41 @@
+/*
+ * 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));
+ }
+ }
+}
diff --git a/CallApp.Tizen/Common/Helpers/Logger.cs b/CallApp.Tizen/Common/Helpers/Logger.cs
new file mode 100644
index 0000000..8aa8838
--- /dev/null
+++ b/CallApp.Tizen/Common/Helpers/Logger.cs
@@ -0,0 +1,29 @@
+/*
+ * 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);
+ }
+ }
+}
diff --git a/CallApp.Tizen/Common/Helpers/PageNavigator.cs b/CallApp.Tizen/Common/Helpers/PageNavigator.cs
new file mode 100644
index 0000000..3ccc54f
--- /dev/null
+++ b/CallApp.Tizen/Common/Helpers/PageNavigator.cs
@@ -0,0 +1,42 @@
+/*
+ * 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");
+ }
+ }
+ }
+}