public bool IsRemovable { get; set; }
[XmlIgnore]
+ public bool IsVisible { get; set; } = true;
+
+ [XmlIgnore]
+ public bool IsDim { get; set; }
+
+ [XmlIgnore]
+ public bool IsShowOptions { get; set; }
+
+ [XmlIgnore]
public DateTime Installed { get; set; }
[XmlIgnore]
IsPinned = value;
OnPropertyChanged("IsPinned");
}
+
+ public void SetVisible(bool value)
+ {
+ IsVisible = value;
+ OnPropertyChanged("IsVisible");
+ }
+
+ public void SetDim(bool value)
+ {
+ IsDim = value;
+ OnPropertyChanged("IsDim");
+ }
+
+ public void ShowOptions()
+ {
+ IsShowOptions = true;
+ OnPropertyChanged("IsShowOptions");
+ }
+
+ public void HideOptions()
+ {
+ IsShowOptions = false;
+ OnPropertyChanged("IsShowOptions");
+ }
}
}
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TVApps.Controls.AppItemCell">
<RelativeLayout BackgroundColor="#000000"
- HeightRequest="266"
+ HeightRequest="342"
WidthRequest="240">
<Image x:Name="ButtonImage"
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.6833}"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.4795}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.6833}"
- RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.1}"
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.2923}"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.1583}"
+ IsVisible="{Binding IsVisible}"
Source="{Binding CurrentStateDescription.IconPath}" />
<Image x:Name="DimImage"
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.6833}"
- RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.6833}"
- RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.1}"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonImage, Property=Height, Factor=1}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonImage, Property=Width, Factor=1}"
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.2923}"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.1583}"
Source="img_tizen_apps_list_dimmed_check.png"
Opacity="0"
Scale="0" />
<Image x:Name="CheckImage"
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.4}"
- RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.4}"
- RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.2417}"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonImage, Property=Height, Factor=0.5853}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonImage, Property=Width, Factor=0.5853}"
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.3918}"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.3}"
Source="ic_tizen_apps_launcher_pinmark.png"
Opacity="0" />
<Grid x:Name="TextArea"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.1333}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
- RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.7744}">
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.8245}">
<Grid.RowDefinitions>
<RowDefinition Height="6*" />
<RowDefinition Height="18*" />
Grid.Column="3"
Opacity="0" />
</Grid>
+
+ <!-- This BoxView is temporary code for Long Press test -->
+ <BoxView x:Name="ItemDim"
+ Color="Black"
+ Opacity="0.5"
+ IsVisible="{Binding IsDim}"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" />
+
<Button x:Name = "ButtonFocusArea"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
set { SetValue(IsCheckedProperty, value); }
}
+ public static readonly BindableProperty IsShowOptionsProperty = BindableProperty.Create("IsShowOptions", typeof(bool), typeof(AppItemCell), default(bool));
+ public bool IsShowOptions
+ {
+ get { return (bool)GetValue(IsShowOptionsProperty); }
+ set { SetValue(IsShowOptionsProperty, value); }
+ }
+
public AppItemCell()
{
InitializeComponent();
return;
}
+ else if (e.PropertyName.CompareTo("IsShowOptions") == 0)
+ {
+ if (IsShowOptions)
+ {
+ ButtonImage.TranslateTo(0, -50, 100);
+ TextArea.TranslateTo(0, -50, 100);
+ TextArea.FadeTo(0.0, 100);
+ }
+ else
+ {
+ ButtonImage.TranslateTo(0, 0, 100);
+ TextArea.TranslateTo(0, 0, 100);
+ TextArea.FadeTo(0.99, 100);
+ }
+ }
}
private void ButtonTitle_PropertyChanged(object sender, PropertyChangedEventArgs e)
x:Class="TVApps.Controls.AppListView"
HorizontalOptions="Fill"
Orientation="Horizontal">
- <Grid x:Name="AppListGrid"
- HorizontalOptions="Start"
- Padding="58,0,58,0">
- <Grid.RowDefinitions>
- <RowDefinition Height="133*" />
- <RowDefinition Height="8*" />
- <RowDefinition Height="133*" />
- </Grid.RowDefinitions>
- <Grid.RowSpacing>0</Grid.RowSpacing>
- <Grid.ColumnSpacing>0</Grid.ColumnSpacing>
+
+ <RelativeLayout x:Name="AppListGrid"
+ HorizontalOptions="Start"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0}"
+ RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0}"
+ Padding="58, 0, 58, 0">
<StackLayout x:Name="AppUpperList"
- Grid.Row="0"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.4772}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0}"
+ RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0}"
Orientation="Horizontal"
HorizontalOptions="Start"
Spacing="16"/>
<StackLayout x:Name="AppLowerList"
- Grid.Row="2"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.4772}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=AppUpperList, Property=Height, Factor=1, Constant=20}"
+ RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0}"
Orientation="Horizontal"
HorizontalOptions="Start"
Spacing="16"/>
- </Grid>
+
+ </RelativeLayout>
</ScrollView>
viewCell.View.BindingContext = item;
viewCell.SetBinding(AppItemCell.IsPinnedProperty, new Binding("BindingContext.IsPinned", source: viewCell.View));
viewCell.SetBinding(AppItemCell.IsCheckedProperty, new Binding("BindingContext.IsChecked", source: viewCell.View));
+ viewCell.SetBinding(AppItemCell.IsShowOptionsProperty, new Binding("BindingContext.IsShowOptions", source: viewCell.View));
viewCell.OnClickedCommand = new Command(() =>
{
item.DoAction();
};
item.StateDescriptions.Add(AppsStatus.Delete.ToString().ToLower(), deleteStateDescription);
+
+ var longPressStateDescription = new StateDescription()
+ {
+ Label = item.CurrentStateDescription.Label,
+ IconPath = item.CurrentStateDescription.IconPath,
+ Action = new CommandAction()
+ {
+ NextStateDescription = AppsStatus.LongPress.ToString().ToLower(),
+ Command = new Command<string>((key) =>
+ {
+ LongPressApp(key);
+ }),
+ CommandParameter = item.AppID
+ }
+ };
+ item.StateDescriptions.Add(AppsStatus.LongPress.ToString().ToLower(), longPressStateDescription);
}
InstalledApps = installedApps.ToList();
}
}
+ private void LongPressApp(string AppID)
+ {
+ // TODO:
+ DebuggingUtils.Dbg(" +++++ long press app : " + AppID);
+ }
+
public void UpdateStateDescription(AppsStatus status)
{
string tag = status.ToString().ToLower();
UpdatePinnedApps();
}
}
+
+ public void HideLongPressedApp(string appId)
+ {
+ InstalledApps = new List<AppShortcutInfo>(InstalledApps);
+ AppShortcutInfo longPressedApp = InstalledApps.Find(app => app.AppID.Equals(appId));
+ if (longPressedApp != null)
+ {
+ DebuggingUtils.Dbg("Hide the app icon : " + longPressedApp.AppID);
+ longPressedApp.SetVisible(false);
+ }
+ }
+
+ public void ShowLongPressedApp(string appId)
+ {
+ InstalledApps = new List<AppShortcutInfo>(InstalledApps);
+ AppShortcutInfo longPressedApp = InstalledApps.Find(app => app.AppID.Equals(appId));
+ if (longPressedApp != null)
+ {
+ DebuggingUtils.Dbg("Show the app icon : " + longPressedApp.AppID);
+ longPressedApp.SetVisible(true);
+ }
+ }
+
+ public void SetAppItemDim(string appId)
+ {
+ InstalledApps = new List<AppShortcutInfo>(InstalledApps);
+ foreach(AppShortcutInfo app in InstalledApps)
+ {
+ if (!app.AppID.Equals(appId))
+ {
+ app.SetDim(true);
+ }
+ }
+ }
+
+ public void UnsetAppItemDim(string appId)
+ {
+ InstalledApps = new List<AppShortcutInfo>(InstalledApps);
+ foreach(AppShortcutInfo app in InstalledApps)
+ {
+ if (!app.AppID.Equals(appId))
+ {
+ app.SetDim(false);
+ }
+ }
+ }
+
+ public void ShowLongPressOption(string appId)
+ {
+ InstalledApps = new List<AppShortcutInfo>(InstalledApps);
+ AppShortcutInfo longPressedApp = InstalledApps.Find(app => app.AppID.Equals(appId));
+ if (longPressedApp != null)
+ {
+ longPressedApp.ShowOptions();
+ }
+ }
+
+ public void HideLongPressOption(string appId)
+ {
+ InstalledApps = new List<AppShortcutInfo>(InstalledApps);
+ AppShortcutInfo longPressedApp = InstalledApps.Find(app => app.AppID.Equals(appId));
+ if (longPressedApp != null)
+ {
+ longPressedApp.HideOptions();
+ }
+ }
}
}
Default = 0,
Pin,
Delete,
+ LongPress,
};
public enum SortingOptions
public Command ButtonPinOkCommand { get; set; }
public Command ButtonPinCancelCommand { get; set; }
+ //This command is temporary for option menu test
+ public Command SetLongPressCommand { get; set; }
+ //This command is temporary for option menu test
+ public Command UnSetLongPressCommand { get; set; }
+
public AppsStatus CurrentStatus { get; private set; }
private SortingOptions SortingOption
ChangeCurrentStatus(AppsStatus.Default);
});
+ SetLongPressCommand = new Command((appId) =>
+ {
+ DebuggingUtils.Dbg(" === Set LongPress AppID : " + appId);
+
+ // 1. ItemCell will be dimmed
+ appsHolder.SetAppItemDim((string) appId);
+
+ // 2. The selected icon on apps list will be moved
+ appsHolder.ShowLongPressOption((string)appId);
+ // 3. The option menu will be shown
+
+ });
+
+ UnSetLongPressCommand = new Command((appId) =>
+ {
+ DebuggingUtils.Dbg(" === Unset LongPress AppID : " + appId);
+
+ // 1. The option menu will be hidden
+ // 2. The selected icon will be moved
+ appsHolder.HideLongPressOption((string)appId);
+
+ // 3. ItemCell will be changed to normal
+ appsHolder.UnsetAppItemDim((string) appId);
+ });
+
App.SetBackKeyListener((s, e) =>
{
// TODO : check concurrency
<Grid>
<Grid.RowDefinitions>
- <RowDefinition Height="145*" />
- <RowDefinition Height="5*" />
- <RowDefinition Height="274*" />
+ <RowDefinition Height="95*" />
+ <RowDefinition Height="329*" />
<RowDefinition Height="52*" />
<RowDefinition Height="64*" />
</Grid.RowDefinitions>
Text="APPS" />
<Grid Grid.Row="0">
-
<Grid.RowDefinitions>
<RowDefinition Height="37*" />
<RowDefinition Height="34*" />
<ColumnDefinition Width="50*" />
</Grid.ColumnDefinitions>
+ <!-- This StackLayout is temporary code for Long Press test -->
+ <Button Grid.Row="0" Grid.Column="1"
+ Text="Set LongPress"
+ FontSize="30"
+ Style="{StaticResource button}"
+ Command="{Binding SetLongPressCommand}"
+ CommandParameter="org.tizen.example.TVHome.TizenTV"
+ VerticalOptions="FillAndExpand"
+ HorizontalOptions="FillAndExpand"/>
+ <Button Grid.Row="2" Grid.Column="1"
+ Text="UnSet LongPress"
+ FontSize="30"
+ Style="{StaticResource button}"
+ Command="{Binding UnSetLongPressCommand}"
+ CommandParameter="org.tizen.example.TVHome.TizenTV"
+ VerticalOptions="FillAndExpand"
+ HorizontalOptions="FillAndExpand"/>
+
<StackLayout Grid.Row="1" Grid.Column="1"
VerticalOptions="FillAndExpand"
HorizontalOptions="StartAndExpand"
Orientation="Horizontal">
-
<Image Source="ic_tizen_apps_additional_back.png"
WidthRequest="40"
HeightRequest="40"
VerticalOptions="Center"/>
-
<Label x:Name="BackKeyInfo"
Style="{StaticResource backKeyInfoText}"
Margin="6, 0, 0, 0"
HorizontalOptions="End"
HorizontalTextAlignment="Start"/>
</StackLayout>
-
</Grid>
<Controls:AppListView x:Name="AppList"
- Grid.Row="2"
+ Grid.Row="1"
ItemsSource="{Binding InstalledAppList}">
<Controls:AppListView.ItemTemplate>
<DataTemplate>
</Controls:AppListView.ItemTemplate>
</Controls:AppListView>
- <Views:FooterNormalStatus Grid.Row="4"
+ <Views:FooterNormalStatus Grid.Row="3"
x:Name="FooterNormal"
IsVisible="true" />
- <Views:FooterPinStatus Grid.Row="4"
+ <Views:FooterPinStatus Grid.Row="3"
x:Name="FooterPin"
IsVisible="false" />
- <Views:FooterDeleteStatus Grid.Row="4"
+ <Views:FooterDeleteStatus Grid.Row="3"
x:Name="FooterDelete"
IsVisible="false" />
</Grid>
FooterDelete.IsVisible = true;
BackKeyInfo.Text = "Back";
break;
+ case AppsStatus.LongPress:
+ FooterNormal.IsVisible = true;
+ FooterPin.IsVisible = false;
+ FooterDelete.IsVisible = false;
+ BackKeyInfo.Text = "Back";
+ break;
}
AppList.InitializeFocus();