/// </summary>
/// <param name="appID">A pinned app ID</param>
void OnAppPinnedNotificationReceived(string appID);
+
+ /// <summary>
+ /// A method will be called when the Nativation remote control key is pressed.
+ /// </summary>
+ /// <param name="apkeyNamepID">A pressed remote control key name</param>
+ void OnNavigationKeyPressed(string keyName);
}
}
});
}
+ public void OnNavigationKeyPressed(string keyName)
+ {
+
+ }
}
}
// Grab key events
MainWindow.KeyGrab(ElmSharp.EvasKeyEventArgs.PlatformHomeButtonName, true);
MainWindow.KeyGrab(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName, true);
+ MainWindow.KeyGrab("Up", false);
+ MainWindow.KeyGrab("Down", false);
+ MainWindow.KeyGrab("Left", false);
+ MainWindow.KeyGrab("Right", false);
windowPort.SetKeyGrabExclusively(ElmSharp.EvasKeyEventArgs.PlatformHomeButtonName);
}
notification.OnMenuKeyPressed();
}
}
+ else if (e.KeyName.Equals("Up") || e.KeyName.Equals("Down") || e.KeyName.Equals("Left") || e.KeyName.Equals("Right"))
+ {
+ if (notification != null)
+ {
+ notification.OnNavigationKeyPressed(e.KeyName);
+ }
+ }
}
/// <summary>
PackageManagerPort.UnregisterCallbacks();
MainWindow.KeyUngrab(ElmSharp.EvasKeyEventArgs.PlatformHomeButtonName);
MainWindow.KeyUngrab(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName);
+ MainWindow.KeyUngrab("Up");
+ MainWindow.KeyUngrab("Down");
+ MainWindow.KeyUngrab("Left");
+ MainWindow.KeyUngrab("Right");
}
/// <summary>
/// A method for handling the button when button is changed to move mode
/// </summary>
/// <param name="isMoveMode">A flag indicates whether the button is move mode or not</param>
- public override void ChangeMoveMode(bool isMoveMode)
+ /// <param name="isDefault">A flag indicates whether this method is called by ChangeToDefaultMode method</param>
+ public override void ChangeMoveMode(bool isMoveMode, bool isDefault)
{
}
/// A method for handling the button when button is changed to move mode
/// </summary>
/// <param name="isMoveMode">A flag indicates whether the button is move mode or not</param>
- public abstract void ChangeMoveMode(bool isMoveMode);
+ /// <param name="isDefault">A flag indicates whether this method is called by ChangeToDefaultMode method</param>
+ public abstract void ChangeMoveMode(bool isMoveMode, bool isDefault);
/// <summary>
/// A method for changing the button's LayoutOptions according to parameter
{
InitializeComponent();
- ButtonBox.WidthRequest = SizeUtils.GetWidthSize(236);
- ButtonBox.HeightRequest = SizeUtils.GetHeightSize(240);
+ ButtonBox.WidthRequest = SizeUtils.GetWidthSize(182);
+ ButtonBox.HeightRequest = SizeUtils.GetHeightSize(230);
ButtonTitle.FontSize = SizeUtils.GetFontSize(26);
}
/// A method for handling the button when button is changed to move mode
/// </summary>
/// <param name="isMoveMode">A flag indicates whether the button is move mode or not</param>
- public override void ChangeMoveMode(bool isMoveMode)
+ /// <param name="isDefault">A flag indicates whether this method is called by ChangeToDefaultMode method</param>
+ public override void ChangeMoveMode(bool isMoveMode, bool isDefault)
{
}
Opacity="0" />
<Image x:Name="LeftBtnImg"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0}"
- RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.369565}"
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.326923}"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.156521}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.06044}"
Source="btn_tizen_home_list_move_left_focused.png"
Opacity="0"/>
<Image x:Name="RightBtnImg"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.93956}"
- RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.369565}"
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.326923}"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.156521}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.06044}"
Source="btn_tizen_home_list_move_right_focused.png"
Opacity="0"/>
- <Button x:Name="LeftBtn"
- RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0}"
- RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.369565}"
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.156521}"
- RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.06044}"
- Clicked="OnMoveToLeftClicked"
- Opacity="0"/>
- <Button x:Name="RightBtn"
- RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.93956}"
- RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.369565}"
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.156521}"
- RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.06044}"
- Clicked="OnMoveToRightClicked"
- Opacity="0"/>
</RelativeLayout>
</Controls:PanelButton>
\ No newline at end of file
*/
using System;
-using System.Windows.Input;
using LibTVRefCommonPortable.Utils;
using Xamarin.Forms;
using Tizen.Xamarin.Forms.Extension;
{
InitializeComponent();
- ButtonBox.WidthRequest = SizeUtils.GetWidthSize(236);
- ButtonBox.HeightRequest = SizeUtils.GetHeightSize(240);
+ ButtonBox.WidthRequest = SizeUtils.GetWidthSize(182);
+ ButtonBox.HeightRequest = SizeUtils.GetHeightSize(230);
ButtonTitle.FontSize = SizeUtils.GetFontSize(26);
+ MessagingCenter.Subscribe<App, string>(this, "NavigationKeyPressed", (sender, e) =>
+ {
+ if (isMoveMode && IsEnabled)
+ {
+ OnMoveCommand.Execute(e);
+ }
+ });
+
//InitializeLongTapGesture();
}
DirectionPriorities = new ContextPopupDirectionPriorities(ContextPopupDirection.Down, ContextPopupDirection.Up, ContextPopupDirection.Right, ContextPopupDirection.Left)
};
- popup.Items.Add(new ContextPopupItem("UNPIN"));
popup.Items.Add(new ContextPopupItem("MOVE"));
+ popup.Items.Add(new ContextPopupItem("UNPIN"));
popup.SelectedIndexChanged += (sender, args) =>
{
var ctxPopup = sender as ContextPopup;
if (ctxPopup.SelectedIndex == 0)
{
- OnUnpinCommand.Execute("");
+ OnMoveFinishedCommand.Execute("");
ctxPopup.Dismiss();
}
else if (ctxPopup.SelectedIndex == 1)
{
- OnMoveFinishedCommand.Execute("");
+ OnUnpinCommand.Execute("");
ctxPopup.Dismiss();
}
};
/// A method for handling the button when button is changed to move mode
/// </summary>
/// <param name="moveMode">A flag indicates whether the button is move mode or not</param>
- public override async void ChangeMoveMode(bool moveMode)
+ /// <param name="isDefault">A flag indicates whether this method is called by ChangeToDefaultMode method</param>
+ public override async void ChangeMoveMode(bool moveMode, bool isDefault)
{
#pragma warning disable CS4014
if (moveMode)
LeftBtnImg.FadeTo(0, 300);
await RightBtnImg.FadeTo(0, 300);
}
-
- LeftBtnImg.FadeTo(1, 300);
- await RightBtnImg.FadeTo(1, 300);
}
else
{
isMoveMode = false;
+ if (!isDefault)
+ {
+ View.TranslateTo(SizeUtils.GetWidthSize((int)View.TranslationX), 0, 300);
+ }
+ else
+ {
+ View.TranslateTo(0, 0, 300);
+ }
+ OnFocused(null, null);
LeftBtnImg.FadeTo(0, 300);
- RightBtnImg.FadeTo(0, 300);
+ await RightBtnImg.FadeTo(0, 300);
}
#pragma warning restore CS4014
}
await ButtonImage.ScaleTo(1, 300);
}
}
-
- /// <summary>
- /// A method is called when right navigation button is clicked
- /// </summary>
- /// <param name="sender">The source of the event</param>
- /// <param name="e">The event that is occurred when right navigation button is clicked</param>
- private void OnMoveToRightClicked(object sender, EventArgs e)
- {
- OnMoveCommand.Execute("right");
- }
-
- /// <summary>
- /// A method is called when left navigation button is clicked
- /// </summary>
- /// <param name="sender">The source of the event</param>
- /// <param name="e">The event that is occurred when left navigation button is clicked</param>
- private void OnMoveToLeftClicked(object sender, EventArgs e)
- {
- OnMoveCommand.Execute("left");
- }
}
}
\ No newline at end of file
{
InitializeComponent();
- ButtonBox.WidthRequest = SizeUtils.GetWidthSize(236);
- ButtonBox.HeightRequest = SizeUtils.GetHeightSize(240);
+ ButtonBox.WidthRequest = SizeUtils.GetWidthSize(182);
+ ButtonBox.HeightRequest = SizeUtils.GetHeightSize(230);
ButtonTitle.FontSize = SizeUtils.GetFontSize(26);
}
/// A method for handling the button when button is changed to move mode
/// </summary>
/// <param name="isMoveMode">A flag indicates whether the button is move mode or not</param>
- public override void ChangeMoveMode(bool isMoveMode)
+ /// <param name="isDefault">A flag indicates whether this method is called by ChangeToDefaultMode method</param>
+ public override void ChangeMoveMode(bool isMoveMode, bool isDefault)
{
}
{
InitializeComponent();
- ButtonBox.WidthRequest = SizeUtils.GetWidthSize(236);
- ButtonBox.HeightRequest = SizeUtils.GetHeightSize(240);
+ ButtonBox.WidthRequest = SizeUtils.GetWidthSize(182);
+ ButtonBox.HeightRequest = SizeUtils.GetHeightSize(230);
ButtonTitle.FontSize = SizeUtils.GetFontSize(26);
}
/// A method for handling the button when button is changed to move mode
/// </summary>
/// <param name="isMoveMode">A flag indicates whether the button is move mode or not</param>
- public override void ChangeMoveMode(bool isMoveMode)
+ /// <param name="isDefault">A flag indicates whether this method is called by ChangeToDefaultMode method</param>
+ public override void ChangeMoveMode(bool isMoveMode, bool isDefault)
{
}
/// A method for handling the button when button is changed to move mode
/// </summary>
/// <param name="isMoveMode">A flag indicates whether the button is move mode or not</param>
- public override void ChangeMoveMode(bool isMoveMode)
+ /// <param name="isDefault">A flag indicates whether this method is called by ChangeToDefaultMode method</param>
+ public override void ChangeMoveMode(bool isMoveMode, bool isDefault)
{
}
MessagingCenter.Send<App>(this, "MenuKeyPressed");
}
+ public void OnNavigationKeyPressed(string keyName)
+ {
+ MessagingCenter.Send<App, string>(this, "NavigationKeyPressed", keyName);
+ }
+
/// <summary>
/// A method for handling application installed event
/// </summary>
}
else
{
- PageMainPanel.FadeTo(1, 300);
PageMainPanel.IsVisible = true;
+ PageMainPanel.FadeTo(1, 300);
bounds.Height -= 300;
bounds.Y += 300;
}
- AppsSubPanel.LayoutTo(bounds, 0);
+ AppsSubPanel.LayoutTo(bounds, 300);
});
MessagingCenter.Subscribe<App, TVHomeStatus>(this, App.AppStatus, (sender, arg) =>
/// <returns>Always returns true</returns>
protected override bool OnBackButtonPressed()
{
- ToggleIconified();
-
if (AppsSubPanel.isMoveMode)
{
AppsSubPanel.ChangeToDefaultMode();
}
+ else
+ {
+ ToggleIconified();
+ }
return true;
}
button.OnMoveCommand = new Command<string>((direction) =>
{
int index = ButtonViewList.IndexOf(button.View);
- if (direction.Equals("right"))
+ if (direction.Equals("Right"))
{
MoveItemToRight(index);
}
- else if (direction.Equals("left"))
+ else if (direction.Equals("Left"))
{
MoveItemToLeft(index);
}
OnMoveCommand.Execute(isMoveMode);
ChangeLayoutButtons(isMoveMode);
- button.ChangeMoveMode(isMoveMode);
+ ChangeIsEnabledProperty(button.View);
+ button.ChangeMoveMode(isMoveMode, false);
if (!isMoveMode)
{
+ foreach (var viewItem in ButtonViewList)
+ {
+ viewItem.TranslateTo(SizeUtils.GetWidthSize((int)viewItem.TranslationX), 0, 0);
+ }
OnMoveVMCommand.Execute(ButtonViewList);
}
});
}
}
+ private void ChangeIsEnabledProperty(View selectedBtn)
+ {
+ foreach (var item in PanelButtonStack.Children)
+ {
+ if (item != selectedBtn)
+ {
+ item.IsEnabled = !isMoveMode;
+ }
+ }
+ }
+
/// <summary>
/// A method for changing button's LayoutOptions in SubPanel according to parameter
/// </summary>
{
if (isFocused)
{
+ if (!isMoveMode)
+ {
+ OnFocusedCommand.Execute("");
+ }
+
return;
}
if (isMoveMode)
{
isMoveMode = !isMoveMode;
- OnMoveCommand.Execute(isMoveMode);
- ChangeLayoutButtons(isMoveMode);
foreach (var item in ButtonList)
{
if (item.isMoveMode)
{
- item.ChangeMoveMode(isMoveMode);
- break;
+ ChangeIsEnabledProperty(item.View);
+ item.ChangeMoveMode(isMoveMode, true);
+ }
+ else
+ {
+ item.View.TranslateTo(0, 0, 0);
}
}
+
+ OnMoveCommand.Execute(isMoveMode);
+ ChangeLayoutButtons(isMoveMode);
}
}
View nextItemView = ButtonViewList[nextIndex];
- originItemView.TranslateTo(originItemView.TranslationX + 216, originItemView.TranslationY, 300);
- nextItemView.TranslateTo(nextItemView.TranslationX - 216, 0, 300);
+ int translateX = SizeUtils.GetWidthSize((int)originItemView.TranslationX + 216);
+ int translateY = SizeUtils.GetWidthSize((int)originItemView.TranslationY);
+ originItemView.TranslateTo(translateX, translateY, 300);
+ translateX = SizeUtils.GetWidthSize((int)nextItemView.TranslationX - 216);
+ nextItemView.TranslateTo(translateX, 0, 300);
ButtonViewList[index] = nextItemView;
ButtonViewList[nextIndex] = originItemView;
View prevItemView = ButtonViewList[prevIndex];
- originItemView.TranslateTo(originItemView.TranslationX - 216, originItemView.TranslationY, 300);
- prevItemView.TranslateTo(prevItemView.TranslationX + 216, 0, 300);
+ int translateX = SizeUtils.GetWidthSize((int)originItemView.TranslationX - 216);
+ int translateY = SizeUtils.GetWidthSize((int)originItemView.TranslationY);
+ originItemView.TranslateTo(translateX, translateY, 300);
+ translateX = SizeUtils.GetWidthSize((int)prevItemView.TranslationX + 216);
+ prevItemView.TranslateTo(translateX, 0, 300);
ButtonViewList[index] = prevItemView;
ButtonViewList[prevIndex] = originItemView;