--- /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.Call.View.Controls.Dialer"
+ x:Name="This"
+ xmlns:CallControls="clr-namespace:CallApp.Tizen.Call.View.Controls"
+ xmlns:Extension="clr-namespace:Tizen.Xamarin.Forms.Extension;assembly=Tizen.Xamarin.Forms.Extension"
+ xmlns:TizenUtilityControls="clr-namespace:Tizen.Utility.Controls"
+ IsVisible="False">
+
+ <StackLayout>
+ <Label Margin="32,24,0,0" HorizontalOptions="Start" TextColor="{StaticResource DefaultTextColor}"
+ FontSize="27" Text="{Binding StatusText, Source={x:Reference This}}" />
+
+ <TizenUtilityControls:CustomEntry x:Name="xEntry" VerticalOptions="CenterAndExpand"
+ KeyboardType="None" HorizontalTextAlignment="Center"
+ TextColor="{StaticResource DefaultTextColor}" FontSize="56" />
+
+ <ContentView HeightRequest="80">
+ <Image HeightRequest="44" Source="keypad_predictive_arrow.png">
+ <Image.GestureRecognizers>
+ <Extension:LongTapGestureRecognizer TapStarted="OnClose" />
+ </Image.GestureRecognizers>
+ </Image>
+ </ContentView>
+
+ <CallControls:Keypad x:Name="xKeypad" />
+ </StackLayout>
+</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.Call.View.Controls
+{
+ /// <summary>
+ /// Presents handling of Keypad
+ /// </summary>
+ public partial class Dialer : ContentView
+ {
+ public Dialer()
+ {
+ InitializeComponent();
+
+ xKeypad.KeyPush = new Command(OnKeyPushed);
+ }
+
+ /// <summary>
+ /// Gets or sets a status text
+ /// </summary>
+ public static readonly BindableProperty StatusTextProperty = BindableProperty.Create(
+ "StatusText",
+ typeof(string),
+ typeof(Dialer),
+ string.Empty);
+
+ public string StatusText
+ {
+ get
+ {
+ return (string)GetValue(StatusTextProperty);
+ }
+
+ set
+ {
+ SetValue(StatusTextProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value that indicates whether the dialer is currently opened
+ /// </summary>
+ public static readonly BindableProperty IsOpenProperty = BindableProperty.Create(
+ "IsOpen",
+ typeof(bool),
+ typeof(Dialer),
+ false,
+ propertyChanged: OnIsOpenChanged);
+
+ public bool IsOpen
+ {
+ get
+ {
+ return (bool)GetValue(IsOpenProperty);
+ }
+
+ set
+ {
+ SetValue(IsOpenProperty, value);
+ }
+ }
+
+ private void OnKeyPushed(object obj)
+ {
+ xEntry.Text = xEntry.Text.Insert(xEntry.CursorPosition, obj.ToString());
+ }
+
+ private static void OnIsOpenChanged(BindableObject bindable, object oldValue, object newValue)
+ {
+ if (bindable is Dialer self)
+ {
+ self.IsVisible = (bool)newValue;
+ }
+ }
+
+ private void OnClose(object sender, EventArgs e)
+ {
+ IsOpen = false;
+ }
+ }
+}
{
InitializeComponent();
}
+
+ /// <summary>
+ /// Gets or sets a command to invoke when key is pushed
+ /// </summary>
+ public static readonly BindableProperty KeyPushProperty = BindableProperty.Create(
+ "KeyPush",
+ typeof(Command),
+ typeof(Keypad),
+ null);
+
+ public Command KeyPush
+ {
+ get
+ {
+ return (Command)GetValue(KeyPushProperty);
+ }
+
+ set
+ {
+ SetValue(KeyPushProperty, value);
+ }
+ }
}
}
<Compile Include="Call\View\Controls\CallHandlingPanel.xaml.cs">
<DependentUpon>CallHandlingPanel.xaml</DependentUpon>
</Compile>
+ <Compile Include="Call\View\Controls\Dialer.xaml.cs">
+ <DependentUpon>Dialer.xaml</DependentUpon>
+ </Compile>
<Compile Include="Call\View\Controls\Keypad.xaml.cs">
<DependentUpon>Keypad.xaml</DependentUpon>
</Compile>
<Compile Include="Common\Themes\CommonTheme.xaml.cs">
<DependentUpon>CommonTheme.xaml</DependentUpon>
</Compile>
+ <Compile Include="Tizen.Utility\Controls\CustomContentView.xaml.cs">
+ <DependentUpon>CustomContentView.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Tizen.Utility\Controls\CustomEntry.xaml.cs">
+ <DependentUpon>CustomEntry.xaml</DependentUpon>
+ </Compile>
<Compile Include="Tizen.Utility\Controls\CustomGrid.xaml.cs">
<DependentUpon>CustomGrid.xaml</DependentUpon>
</Compile>
<Compile Include="Tizen.Utility\Controls\GesturesContainer.xaml.cs">
<DependentUpon>GesturesContainer.xaml</DependentUpon>
</Compile>
+ <Compile Include="Tizen.Utility\Controls\Renderers\CustomEntryRenderer.cs" />
<Compile Include="Tizen.Utility\Controls\Renderers\CustomImageRenderer.cs" />
<Compile Include="Tizen.Utility\Converters\TypeToNameConverter.cs" />
<Compile Include="Tizen.Utility\Converters\IsStringEmptyConverter.cs" />
<Folder Include="lib\" />
</ItemGroup>
<ItemGroup>
+ <Content Include="res\Call ID\348x348\call_photo_id.png" />
<Content Include="res\Call ID\348x348\call_photo_id_emergency.png" />
<Content Include="res\call_active_ic_call.png" />
<Content Include="res\call_btn_addcall.png" />
<Content Include="res\keypad_number_09.png" />
<Content Include="res\keypad_number_asterisk.png" />
<Content Include="res\keypad_number_sharp.png" />
+ <Content Include="res\keypad_predictive_arrow.png" />
<Content Include="shared\res\icon.png" />
</ItemGroup>
<ItemGroup>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Tizen.Utility\Controls\CustomContentView.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Call\View\Controls\Dialer.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Tizen.Utility\Controls\CustomEntry.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"?>
+<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="Tizen.Utility.Controls.CustomContentView"
+ xmlns:Extension="clr-namespace:Tizen.Xamarin.Forms.Extension;assembly=Tizen.Xamarin.Forms.Extension">
+
+ <ContentView.GestureRecognizers>
+ <Extension:LongTapGestureRecognizer TapStarted="OnTap" />
+ </ContentView.GestureRecognizers>
+</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 Tizen.Utility.Controls
+{
+ /// <summary>
+ /// Extension of Xamarin ContentView, with support:
+ /// Command pattern
+ /// </summary>
+ public partial class CustomContentView : ContentView
+ {
+ public CustomContentView()
+ {
+ InitializeComponent();
+ }
+
+ /// <summary>
+ /// Gets or sets the command to invoke when this control is tapped
+ /// </summary>
+ public static readonly BindableProperty CommandProperty = BindableProperty.Create(
+ "Command",
+ typeof(Command),
+ typeof(CustomContentView),
+ null,
+ propertyChanged: OnCommandChanged);
+
+ public Command Command
+ {
+ get
+ {
+ return (Command)GetValue(CommandProperty);
+ }
+
+ set
+ {
+ SetValue(CommandProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the parameter to pass to the Command property
+ /// </summary>
+ public static readonly BindableProperty CommandParameterProperty = BindableProperty.Create(
+ "CommandParameter",
+ typeof(string),
+ typeof(CustomContentView),
+ string.Empty);
+
+ public string CommandParameter
+ {
+ get
+ {
+ return (string)GetValue(CommandParameterProperty);
+ }
+
+ set
+ {
+ SetValue(CommandParameterProperty, value);
+ }
+ }
+
+ protected virtual void OnTap(object sender, EventArgs e)
+ {
+ if (Command != null && Command.CanExecute(CommandParameter))
+ {
+ Command.Execute(CommandParameter);
+ }
+ }
+
+ private static void OnCommandChanged(BindableObject bindable, object oldValue, object newValue)
+ {
+ if (bindable is CustomContentView self)
+ {
+ if (oldValue is Command oldCommand)
+ {
+ oldCommand.CanExecuteChanged -= OnCommandCanExecuteChanged;
+ }
+
+ if (newValue is Command newCommand)
+ {
+ self.IsEnabled = newCommand.CanExecute(self.CommandParameter);
+
+ newCommand.CanExecuteChanged += OnCommandCanExecuteChanged;
+ }
+ }
+ }
+
+ private static void OnCommandCanExecuteChanged(object sender, EventArgs e)
+ {
+ if (sender is CustomContentView self)
+ {
+ self.IsEnabled = self.Command.CanExecute(self.CommandParameter);
+ }
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<Entry xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="Tizen.Utility.Controls.CustomEntry">
+
+</Entry>
\ 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;
+using Native = Xamarin.Forms.Platform.Tizen.Native;
+
+namespace Tizen.Utility.Controls
+{
+ /// <summary>
+ /// Extension of Xamarin Entry, with support:
+ /// Keyboard type
+ /// Cursor position
+ /// </summary>
+ public partial class CustomEntry : Entry
+ {
+ public CustomEntry()
+ {
+ InitializeComponent();
+ }
+
+ /// <summary>
+ /// Gets or sets the keyboard type
+ /// </summary>
+ public static readonly BindableProperty KeyboardTypeProperty = BindableProperty.Create(
+ "KeyboardType",
+ typeof(Native.Keyboard),
+ typeof(CustomEntry),
+ Native.Keyboard.Normal);
+
+ public Native.Keyboard KeyboardType
+ {
+ get
+ {
+ return (Native.Keyboard)GetValue(KeyboardTypeProperty);
+ }
+
+ set
+ {
+ SetValue(KeyboardTypeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the cursor position
+ /// </summary>
+ public static readonly BindableProperty CursorPositionProperty = BindableProperty.Create(
+ "CursorPosition",
+ typeof(int),
+ typeof(CustomEntry),
+ 0);
+
+ public int CursorPosition
+ {
+ get
+ {
+ return (int)GetValue(CursorPositionProperty);
+ }
+
+ set
+ {
+ SetValue(CursorPositionProperty, value);
+ }
+ }
+ }
+}
{
InitializeComponent();
+ _pan.PanUpdated += OnPanUpdated;
+
// Need to use last event during loading control. At this case it's a SizeChanged event
SizeChanged += OnSizeChanged;
- _pan.PanUpdated += OnPanUpdated;
+ }
+
+ private void OnPanUpdated(object sender, PanUpdatedEventArgs e)
+ {
+ PanUpdated(sender, e);
}
private void OnSizeChanged(object sender, EventArgs e)
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 System;
+using System.ComponentModel;
+using Tizen.Utility.Controls;
+using Tizen.Utility.Controls.Renderers;
+using Xamarin.Forms;
+using Xamarin.Forms.Platform.Tizen;
+using Native = Xamarin.Forms.Platform.Tizen.Native;
+
+[assembly: ExportRenderer(typeof(CustomEntry), typeof(CustomEntryRenderer))]
+namespace Tizen.Utility.Controls.Renderers
+{
+ /// <summary>
+ /// A renderer for CustomEntry
+ /// </summary>
+ public class CustomEntryRenderer : EntryRenderer
+ {
+ private CustomEntry xamarinEntry = null;
+ private Native.Entry nativeEntry = null;
+
+ protected override void Dispose(bool disposing)
+ {
+ if (nativeEntry != null)
+ {
+ nativeEntry.CursorChanged -= OnCursorChanged;
+ nativeEntry = null;
+ }
+
+ base.Dispose(disposing);
+ }
+
+ /// <summary cref="EntryRenderer.OnElementChanged(ElementChangedEventArgs{Entry})" />
+ protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
+ {
+ base.OnElementChanged(e);
+
+ if (xamarinEntry == null)
+ {
+ xamarinEntry = (CustomEntry)Element;
+ }
+
+ if (nativeEntry == null)
+ {
+ nativeEntry = Control;
+ nativeEntry.Keyboard = xamarinEntry.KeyboardType;
+ nativeEntry.CursorChanged += OnCursorChanged;
+ }
+ }
+
+ /// <summary cref="EntryRenderer.OnElementPropertyChanged(object, PropertyChangedEventArgs)" />
+ protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
+ {
+ base.OnElementPropertyChanged(sender, e);
+
+ // TODO: This is not working, seems a bug - http://suprem.sec.samsung.net/jira/browse/TCAPI-2528
+ /*
+ if (e.PropertyName == CustomEntry.KeyboardTypeProperty.PropertyName)
+ {
+ nativeEntry.Keyboard = xamarinEntry.KeyboardType;
+ }
+ */
+
+ nativeEntry.Keyboard = xamarinEntry.KeyboardType;
+ }
+
+ private void OnCursorChanged(object sender, EventArgs e)
+ {
+ xamarinEntry.CursorPosition = nativeEntry.CursorPosition;
+ }
+ }
+}