TizenRefApp-8941 Change Reject panel height relative to its content height 77/142877/6
authorRuslan Zakharov <r.zakharov@samsung.com>
Mon, 7 Aug 2017 11:29:25 +0000 (14:29 +0300)
committerRuslan Zakharov <r.zakharov@samsung.com>
Tue, 15 Aug 2017 10:06:20 +0000 (13:06 +0300)
Changed MaxHeight property of panel to its content height

Change-Id: I561828a5ece0c62500bc8f372f3f4fb18381c63e

CallApp.Tizen/Call/Controls/RejectCallPanel.xaml.cs

index 8f1aa3f..1518fde 100644 (file)
@@ -38,6 +38,7 @@ namespace CallApp.Tizen.Call.Controls
         public event OnSlideEventHandler OnSlideEvent = delegate { };
 
         private double _lastHeight = 0.0;
+        private double _maxOpenedHeight = 0.0;
 
         public RejectCallPanel()
         {
@@ -87,23 +88,23 @@ namespace CallApp.Tizen.Call.Controls
         }
 
         /// <summary>
-        /// Max height of panel
+        /// The max height of panel in the opened state
         /// </summary>
-        public static readonly BindableProperty MaxHeightProperty = BindableProperty.Create(
-            "MaxHeight",
+        public static readonly BindableProperty MaxOpenedHeightProperty = BindableProperty.Create(
+            "MaxOpenedHeight",
             typeof(double),
             typeof(RejectCallPanel),
-            150.0);
+            0.0);
 
-        public double MaxHeight
+        public double MaxOpenedHeight
         {
             get
             {
-                return (double)GetValue(MaxHeightProperty);
+                return (double)GetValue(MaxOpenedHeightProperty);
             }
             set
             {
-                SetValue(MaxHeightProperty, value);
+                SetValue(MaxOpenedHeightProperty, value);
             }
         }
 
@@ -150,13 +151,24 @@ namespace CallApp.Tizen.Call.Controls
             {
                 case GestureStatus.Started:
                     _lastHeight = Height;
+                    double contentHeight = Content.Height + Height;
+
+                    if (MaxOpenedHeight.Equals(0.0) || MaxOpenedHeight > contentHeight)
+                    {
+                        _maxOpenedHeight = contentHeight;
+                    }
+                    else
+                    {
+                        _maxOpenedHeight = MaxOpenedHeight;
+                    }
+
                     break;
 
                 case GestureStatus.Running:
                     {
                         double panelHeight = GetNewHeight(e.TotalY);
 
-                        if (panelHeight > DefaultHeight && panelHeight < MaxHeight)
+                        if (panelHeight > DefaultHeight && panelHeight < _maxOpenedHeight)
                         {
                             HeightRequest = panelHeight;
                         }
@@ -168,12 +180,12 @@ namespace CallApp.Tizen.Call.Controls
                 case GestureStatus.Completed:
                     {
                         double panelHeight = Height;
-                        double halfMaxHeight = MaxHeight / 2;
+                        double halfMaxHeight = _maxOpenedHeight / 2;
 
                         if (panelHeight >= halfMaxHeight)
                         {
                             IsOpen = true;
-                            HeightRequest = MaxHeight;
+                            HeightRequest = _maxOpenedHeight;
                         }
                         else
                         {