Add exit popup
authorcskim <charles0.kim@samsung.com>
Wed, 15 Mar 2017 08:28:18 +0000 (17:28 +0900)
committerChulSeung Kim <charles0.kim@samsung.com>
Thu, 8 Jun 2017 09:34:46 +0000 (18:34 +0900)
Change-Id: Ifb10e75077ac5651bb38eb9c8bb93e42a13ef706

LibTVRefCommonPortable/Utils/AppControlUtils.cs
LibTVRefCommonPortable/Utils/IAppControl.cs
TVApps/TVApps.TizenTV/Renderer/CustomButtonRenderer.cs
TVApps/TVApps/Controls/AppItemCell.xaml
TVApps/TVApps/Controls/AppItemCell.xaml.cs
TVApps/TVApps/Controls/AppListView.xaml
TVApps/TVApps/Controls/AppListView.xaml.cs
TVApps/TVApps/ViewModels/AppsHolder.cs
TVApps/TVApps/Views/MainPage.xaml.cs
TVHome/TVHome.TizenTV/bin/Debug/TVHome.TizenTV.tpk

index 304262f4188fe388c6462f296818520886bc0409..0021379a18f076368a7546a567c65724b951b1f1 100644 (file)
  * limitations under the License.
  */
 
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
+using LibTVRefCommonPortable.Utils;
 using Xamarin.Forms;
 
 namespace LibTVRefCommmonPortable.Utils
index d1b53ba2ba22bb4c3199f344247da01fb72f5fdb..8ea2ad01d1955841086857a3bd8e50f883bccb06 100644 (file)
@@ -1,8 +1,19 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+/*
+ * Copyright (c) 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.
+ */
+
 
 namespace LibTVRefCommmonPortable.Utils
 {
index 60c87faca28e1fbccbda4e6356b4663b3032dbd5..dd918bdfc0a2b7621f0f3101cace105afd703770 100644 (file)
@@ -28,7 +28,6 @@ namespace TVApps.TizenTV.Renderer
     {
         protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Button> args)
         {
-            DebuggingPort.D("OnElementChanged");
             base.OnElementChanged(args);
 
             if (Control == null ||
@@ -44,8 +43,6 @@ namespace TVApps.TizenTV.Renderer
 
             Control.Pressed += KeyDown;
             Control.Released += KeyUp;
-
-            DebuggingPort.D("OnElementChanged - REGISTERED");
         }
 
         private void KeyUp(object sender, EventArgs e)
index 84e12d8409db71e8480397b51dab32eb3f47d2a9..4e7f7640bdbb6b743ee3d951d48571b78483d74d 100755 (executable)
@@ -2,74 +2,74 @@
 <ViewCell xmlns="http://xamarin.com/schemas/2014/forms"
           xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
           x:Class="TVApps.Controls.AppItemCell">
-    <RelativeLayout BackgroundColor="#000000"
-               HeightRequest="266"
-               WidthRequest="240">
-        <Image x:Name="ButtonImage"
-               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.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.1583}"
-               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.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.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.3}"
-               Source="ic_tizen_apps_launcher_pinmark.png"
+  <RelativeLayout BackgroundColor="#000000"
+             HeightRequest="266"
+             WidthRequest="240">
+    <Image x:Name="ButtonImage"
+           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.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.1583}"
+           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.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.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}">
+      <Grid.RowDefinitions>
+        <RowDefinition Height="6*" />
+        <RowDefinition Height="18*" />
+        <RowDefinition Height="8*" />
+      </Grid.RowDefinitions>
+      <Grid.ColumnDefinitions>
+        <ColumnDefinition Width="*" />
+        <ColumnDefinition Width="18" />
+        <ColumnDefinition Width="Auto" />
+        <ColumnDefinition Width="18" />
+        <ColumnDefinition Width="*" />
+      </Grid.ColumnDefinitions>
+      <Grid.RowSpacing>0</Grid.RowSpacing>
+      <Grid.ColumnSpacing>10</Grid.ColumnSpacing>
+      <Image x:Name="PinnedIcon"
+             Grid.Row="1"
+             Grid.Column="1"
+             Source="ic_tizen_apps_launcher_checkmark.png"
+             Opacity="0"/>
+      <Label x:Name="ButtonTitle"
+             Grid.Row="0"
+             Grid.RowSpan="3"
+             Grid.Column="2"
+             Opacity="1"
+             FontSize="56"
+             TextColor="White"
+             LineBreakMode="TailTruncation"
+             HorizontalTextAlignment="Center"
+             Text="{Binding CurrentStateDescription.Label}" />
+      <BoxView Grid.Row="1"
+               Grid.Column="3"
                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}">
-            <Grid.RowDefinitions>
-                <RowDefinition Height="6*" />
-                <RowDefinition Height="18*" />
-                <RowDefinition Height="8*" />
-            </Grid.RowDefinitions>
-            <Grid.ColumnDefinitions>
-                <ColumnDefinition Width="*" />
-                <ColumnDefinition Width="18" />
-                <ColumnDefinition Width="Auto" />
-                <ColumnDefinition Width="18" />
-                <ColumnDefinition Width="*" />
-            </Grid.ColumnDefinitions>
-            <Grid.RowSpacing>0</Grid.RowSpacing>
-            <Grid.ColumnSpacing>10</Grid.ColumnSpacing>
-            <Image x:Name="PinnedIcon"
-                   Grid.Row="1"
-                   Grid.Column="1"
-                   Source="ic_tizen_apps_launcher_checkmark.png"
-                   Opacity="0"/>
-            <Label x:Name="ButtonTitle"
-                   Grid.Row="0"
-                   Grid.RowSpan="3"
-                   Grid.Column="2"
-                   Opacity="1"
-                   FontSize="56"
-                   TextColor="White"
-                   LineBreakMode="TailTruncation"
-                   HorizontalTextAlignment="Center"
-                   Text="{Binding CurrentStateDescription.Label}" />
-            <BoxView Grid.Row="1"
-                     Grid.Column="3"
-                     Opacity="0" />
-        </Grid>
-        <Button x:Name = "ButtonFocusArea"
-                RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"
-                RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
-                Focused="OnFocused"
-                Unfocused="OnUnFocused"
-                Clicked="OnClicked"
-                Opacity="0" />
-    </RelativeLayout>
+    </Grid>
+    <Button x:Name = "ButtonFocusArea"
+            RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"
+            RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
+            Focused="OnFocused"
+            Unfocused="OnUnFocused"
+            Clicked="OnClicked"
+            Opacity="0" />
+  </RelativeLayout>
 </ViewCell>
 
index 1d8cd43bbfe7526eb89531f26f6c7f7628afd756..ce94da4835cf66cc9217b7ee224a3dc4dd22543e 100755 (executable)
@@ -55,7 +55,6 @@ namespace TVApps.Controls
 
         private void AppItemCell_PropertyChanged(object sender, PropertyChangedEventArgs e)
         {
-            DebuggingUtils.Dbg(e.PropertyName);
             if (e.PropertyName.CompareTo("IsPinned") == 0)
             {
                 if (IsPinned)
index 82ad28e547396ca23ee5c34bfb2437acbfbc83bd..e44fc054630551f38d635ede1a3b40136c43b005 100755 (executable)
@@ -6,27 +6,27 @@
             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>
+  <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>
 
-        <StackLayout x:Name="AppUpperList"
-                     Grid.Row="0"
-                     Orientation="Horizontal"
-                     HorizontalOptions="Start"
-                     Spacing="16"/>
+    <StackLayout x:Name="AppUpperList"
+                 Grid.Row="0"
+                 Orientation="Horizontal"
+                 HorizontalOptions="Start"
+                 Spacing="16"/>
 
-        <StackLayout x:Name="AppLowerList"
-                     Grid.Row="2"
-                     Orientation="Horizontal"
-                     HorizontalOptions="Start"
-                     Spacing="16"/>
-    </Grid>
+    <StackLayout x:Name="AppLowerList"
+                 Grid.Row="2"
+                 Orientation="Horizontal"
+                 HorizontalOptions="Start"
+                 Spacing="16"/>
+  </Grid>
 </ScrollView>
index 24bcef88aacb72b6994d29365a197720cc591a56..bd2338fe5bc946620d6cbf0fed684a0366f5a3a0 100644 (file)
@@ -49,6 +49,20 @@ namespace TVApps.Controls
 
         private int AppCount;
 
+        public bool IsFirstItemFocused
+        {
+            get
+            {
+                if (AppUpperList.Children.Count <= 0)
+                {
+                    return true;
+                }
+
+                return AppUpperList.Children[0].IsFocused;
+            }
+        }
+
+
         public AppListView()
         {
             InitializeComponent();
index 4d6574c9b2d1e26b0100209d6e8a851d69bbefa1..f0ed2331d9ffa535c5746626d973fc20964e9ab9 100644 (file)
@@ -59,7 +59,6 @@ namespace TVApps.ViewModels
 
         private async void SetApps()
         {
-            DebuggingUtils.Dbg(">GetInstalledApps - Start");
             PinnedApps = TVHomeImpl.GetInstance.AppShortcutControllerInstance.GetPinnedAppsAppIDs();
             var installedApps = await TVHomeImpl.GetInstance.AppShortcutControllerInstance.GetInstalledApps();
 
@@ -110,8 +109,6 @@ namespace TVApps.ViewModels
 
             InstalledApps = installedApps.ToList();
             SortApps(SortingOption);
-
-            DebuggingUtils.Dbg("<GetInstalledApps - End");
         }
 
         private void PinToggle(string key)
index 245257074e79216e17a5fdddc42715e087eb06bc..603a96d93b8273016112ecfb486a06e15d8bdb6d 100644 (file)
@@ -20,6 +20,8 @@ using Xamarin.Forms;
 using TVApps.ViewModels;
 using System.ComponentModel;
 using LibTVRefCommmonPortable.Utils;
+using System.Threading;
+using System.Threading.Tasks;
 
 namespace TVApps.Views
 {
@@ -76,5 +78,41 @@ namespace TVApps.Views
                 SetCurrntStatus(CurrentStatus);
             }
         }
+
+        // TODO : Remove this if focus issue is solved!!!
+        static bool isBackKeyUsed = false;
+
+        private async Task<bool> OnBackKeyPressedAtMain()
+        {
+            // TODO : Remove isBackKeyUsed if focus issue is solved!!!
+            if (!AppList.IsFirstItemFocused &&
+                isBackKeyUsed == false)
+            {
+                isBackKeyUsed = true;
+                DebuggingUtils.Dbg("OnBackKeyPressedAtMain - focus move");
+                AppList.InitializeFocus();
+                return true;
+            }
+
+            var answer = await DisplayAlert("QUIT", "Do you want to quit?", "YES", "NO");
+            if (answer)
+            {
+                DebuggingUtils.Dbg("OnBackKeyPressedAtMain - Yes");
+                // TODO : app screen inconized.
+                await this.Navigation.PopAsync();
+                return true;
+            }
+            return true;
+        }
+
+        protected override bool OnBackButtonPressed()
+        {
+            DebuggingUtils.Dbg("OnBackButtonPressed");
+            SynchronizationContext.Current.Post(async (o) =>
+            {
+                await OnBackKeyPressedAtMain();
+            }, "");
+            return true;
+        }
     }
 }
index 87de22b8bb55f73bc4689693513181e62988a661..53e732b7c880eb8c1b212f0f57e09e67d0610745 100644 (file)
Binary files a/TVHome/TVHome.TizenTV/bin/Debug/TVHome.TizenTV.tpk and b/TVHome/TVHome.TizenTV/bin/Debug/TVHome.TizenTV.tpk differ