using Tizen.Applications;
using LibTVRefCommonPortable.Utils;
using LibTVRefCommonTizen.Ports;
-
+using Tizen.Xamarin.Forms.Extension.Renderer;
namespace TVHome.TizenTV
{
global::Xamarin.Forms.DependencyService.Register<ApplicationManagerPort>();
global::Xamarin.Forms.DependencyService.Register<FileSystemPort>();
global::Xamarin.Forms.DependencyService.Register<WindowPort>();
+ TizenFormsExtension.Init();
global::Xamarin.Forms.Platform.Tizen.Forms.Init(app);
app.Run(args);
}
"ElmSharp": "1.1.0-beta-018",
"Microsoft.NETCore.App": "1.1.0",
"Tizen.Library": "1.0.0-pre3",
+ "Tizen.Xamarin.Forms.Extension": "2.3.4-r214-001",
"Xamarin.Forms": "2.3.4.214-pre5",
"Xamarin.Forms.Platform.Tizen": "2.3.4-r214-002"
},
public override void ChangeLayoutOptions(bool isMoveMode)
{
}
+
+ /// <summary>
+ /// A method for showing context popup
+ /// </summary>
+ public override void ShowContextPopup()
+ {
+ }
}
}
public abstract class PanelButton : ViewCell
{
public bool isMoveMode;
+ public bool isFocused;
/// <summary>
/// A Command will be executed the button is focused.
/// </summary>
/// </summary>
public ICommand OnMoveCommand { get; set; }
+ /// <summary>
+ /// A Command will be executed when the button moving is finished
+ /// </summary>
+ public ICommand OnMoveFinishedCommand { get; set; }
+
/// <summary>
/// A Command will be executed the button is unpinned.
/// </summary>
/// </summary>
/// <param name="isMoveMode">A flag indicates whether the SubPanel is MoveMode or not</param>
public abstract void ChangeLayoutOptions(bool isMoveMode);
+
+ /// <summary>
+ /// A method for showing context popup
+ /// </summary>
+ public abstract void ShowContextPopup();
}
}
View.TranslateTo(0, 0, 0);
}
+
+ /// <summary>
+ /// A method for showing context popup
+ /// </summary>
+ public override void ShowContextPopup()
+ {
+ }
}
}
using System.Windows.Input;
using LibTVRefCommonPortable.Utils;
using Xamarin.Forms;
+using Tizen.Xamarin.Forms.Extension;
namespace TVHome.Controls
{
public SubPanelButton()
{
InitializeComponent();
+ //InitializeLongTapGesture();
}
+ /*
+ private void InitializeLongTapGesture()
+ {
+ var longTapGesture = new LongTapGestureRecognizer
+ {
+ Timeout = 0.5
+ };
+ longTapGesture.TapCompleted += (sender, args) =>
+ {
+ ShowContextPopup();
+ };
+
+ View.GestureRecognizers.Add(longTapGesture);
+ }
+ */
+ /// <summary>
+ /// A method for showing Context popup
+ /// </summary>
+ public override void ShowContextPopup()
+ {
+ if (isPopupShowing)
+ {
+ return;
+ }
+
+ ContextPopup popup = new ContextPopup
+ {
+ IsAutoHidingEnabled = true,
+ Orientation = ContextPopupOrientation.Vertical,
+ DirectionPriorities = new ContextPopupDirectionPriorities(ContextPopupDirection.Down, ContextPopupDirection.Up, ContextPopupDirection.Right, ContextPopupDirection.Left)
+ };
+
+ popup.Items.Add(new ContextPopupItem("UNPIN"));
+ popup.Items.Add(new ContextPopupItem("MOVE"));
+
+ popup.SelectedIndexChanged += (sender, args) =>
+ {
+ var ctxPopup = sender as ContextPopup;
+ if (ctxPopup.SelectedIndex == 0)
+ {
+ OnUnpinCommand.Execute("");
+ ctxPopup.Dismiss();
+ }
+ else if (ctxPopup.SelectedIndex == 1)
+ {
+ OnMoveFinishedCommand.Execute("");
+ ctxPopup.Dismiss();
+ }
+ };
+
+ popup.Dismissed += (sender, args) =>
+ {
+ isPopupShowing = false;
+ };
+
+ popup.Show(View);
+ isPopupShowing = true;
+ }
+
/// <summary>
/// Handles Button Clicked event
/// <param name="e">The event that is occurred when button is clicked</param>
public override async void OnClicked(object sender, EventArgs e)
{
- if (OnClickedCommand != null)
+ if (!isMoveMode)
{
- OnClickedCommand.Execute("");
- }
+ if (OnClickedCommand != null)
+ {
+ OnClickedCommand.Execute("");
+ }
- await View.FadeTo(0.99, 300);
+ await View.FadeTo(0.99, 300);
+ }
+ else
+ {
+ OnMoveFinishedCommand.Execute("");
+ }
}
/// <summary>
/// <param name="e">The event that is occurred when button is focused</param>
public override async void OnFocused(object sender, FocusEventArgs e)
{
+ isFocused = true;
+ if (isMoveMode)
+ {
+ return;
+ }
+
if (OnFocusedCommand != null)
{
OnFocusedCommand.Execute("");
/// <param name="e">The event that is occurred when button is unfocused</param>
public override async void OnUnfocused(object sender, FocusEventArgs e)
{
+ isFocused = false;
+
if (!isMoveMode)
{
#pragma warning disable CS4014
View.TranslateTo(0, 0, 0);
}
+
+ /// <summary>
+ /// A method for showing Context popup
+ /// </summary>
+ public override void ShowContextPopup()
+ {
+ }
}
}
\ No newline at end of file
public override void ChangeLayoutOptions(bool isMoveMode)
{
}
+
+ /// <summary>
+ /// A method for showing Context popup
+ /// </summary>
+ public override void ShowContextPopup()
+ {
+ }
}
}
* limitations under the License.
*/
using System;
+using Tizen.Xamarin.Forms.Extension;
using Xamarin.Forms;
namespace TVHome.Controls
public override void ChangeLayoutOptions(bool isMoveMode)
{
}
+
+ /// <summary>
+ /// A method for showing Context popup
+ /// </summary>
+ public override void ShowContextPopup()
+ {
+ ContextPopup popup = new ContextPopup
+ {
+ IsAutoHidingEnabled = true,
+ Orientation = ContextPopupOrientation.Vertical,
+ DirectionPriorities = new ContextPopupDirectionPriorities(ContextPopupDirection.Down, ContextPopupDirection.Up, ContextPopupDirection.Right, ContextPopupDirection.Left)
+ };
+
+ popup.Items.Add(new ContextPopupItem("REMOVE"));
+ popup.Items.Add(new ContextPopupItem("CLEAR ALL"));
+
+ popup.SelectedIndexChanged += (sender, args) =>
+ {
+ var ctxPopup = sender as ContextPopup;
+ if (ctxPopup.SelectedIndex == 0)
+ {
+ OnMoveFinishedCommand.Execute("");
+ ctxPopup.Dismiss();
+ }
+ else if (ctxPopup.SelectedIndex == 1)
+ {
+ OnUnpinCommand.Execute("");
+ ctxPopup.Dismiss();
+ }
+ };
+
+ popup.Show(View);
+ }
}
}
\ No newline at end of file
public void OnMenuKeyPressed()
{
DebuggingUtils.Dbg("\" Menu Key \" ");
- MenuKeyListener.Invoke(this, new TVHomeEventArgs()
- {
- arg = "",
- });
+ /* MenuKeyListener.Invoke(this, new TVHomeEventArgs()
+ {
+ arg = "",
+ });*/
+ MessagingCenter.Send<App>(this, "MenuKeyPressed");
}
/// <summary>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
+ <Reference Include="Tizen.Xamarin.Forms.Extension, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Tizen.Xamarin.Forms.Extension.2.3.4-r214-001\lib\portable-win+net45+wp80+win81+wpa81\Tizen.Xamarin.Forms.Extension.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
<Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.3.4.214-pre5\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Core.dll</HintPath>
<Private>True</Private>
protected override bool OnBackButtonPressed()
{
ToggleIconified();
+
+ if (AppsSubPanel.isMoveMode)
+ {
+ AppsSubPanel.ChangeToDefaultMode();
+ }
return true;
}
}
ButtonList = new List<PanelButton>();
ButtonViewList = new List<View>();
PropertyChanged += OnItemsSourcePropertyChanged;
+
+ MessagingCenter.Subscribe<App>(this, "MenuKeyPressed", (sender) =>
+ {
+ if (isFocused)
+ {
+ foreach (var item in ButtonList)
+ {
+ if (item.isFocused)
+ {
+ item.ShowContextPopup();
+ }
+ }
+ }
+ });
}
/// <summary>
/// A event handler for handling property changed event
MoveItemToLeft(index);
}
});
+
+ button.OnMoveFinishedCommand = new Command(() =>
+ {
+ // TODO : This is triggered by LongTap event.
+ isMoveMode = !isMoveMode;
+
+ OnMoveCommand.Execute(isMoveMode);
+
+ ChangeLayoutButtons(isMoveMode);
+ button.ChangeMoveMode(isMoveMode);
+
+ if (!isMoveMode)
+ {
+ OnMoveVMCommand.Execute(ButtonViewList);
+ }
+ });
}
ButtonList.Add(button);
}
});
button.OnClickedCommand = new Command(() =>
{
- if (!(item is AppShortcutInfo))
- {
- item.DoAction();
- return;
- }
-
- // TODO : This is triggered by LongTap event.
- isMoveMode = !isMoveMode;
-
- OnMoveCommand.Execute(isMoveMode);
-
- ChangeLayoutButtons(isMoveMode);
- button.ChangeMoveMode(isMoveMode);
-
- if (!isMoveMode)
- {
- OnMoveVMCommand.Execute(ButtonViewList);
- }
+ item.DoAction();
});
button.OnUnpinCommand = new Command(() =>
{
await this.FadeTo(0.99, 300);
}
+ public void ChangeToDefaultMode()
+ {
+ if (isMoveMode)
+ {
+ isMoveMode = !isMoveMode;
+ OnMoveCommand.Execute(isMoveMode);
+ ChangeLayoutButtons(isMoveMode);
+
+ foreach (var item in ButtonList)
+ {
+ if (item.isMoveMode)
+ {
+ item.ChangeMoveMode(isMoveMode);
+ break;
+ }
+ }
+ }
+ }
+
/// <summary>
/// A method for moving the selected item to right
/// </summary>
<?xml version="1.0" encoding="utf-8"?>\r
<packages>\r
+ <package id="Tizen.Xamarin.Forms.Extension" version="2.3.4-r214-001" targetFramework="portable45-net45+win8+wp8+wpa81" />\r
<package id="Xamarin.Forms" version="2.3.4.214-pre5" targetFramework="portable45-net45+win8+wp8+wpa81" />\r
</packages>
\ No newline at end of file