From 02f7e1222c0b23aaf4b628c57bb59d378e4d1de2 Mon Sep 17 00:00:00 2001 From: Praveen Gattu Date: Fri, 24 Jun 2016 14:46:40 +0530 Subject: [PATCH] Fixed Filter related issues. Change-Id: Iba194a0e503ea8241598e8f4204e7fc5c48b556c Signed-off-by: Praveen Gattu --- .../Tizen.Content.MediaContent/ContentDatabase.cs | 6 +++--- .../Tizen.Content.MediaContent/ContentFilter.cs | 23 ++++++++++++++++++---- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Tizen.Content/Tizen.Content.MediaContent/ContentDatabase.cs b/Tizen.Content/Tizen.Content.MediaContent/ContentDatabase.cs index ec232f9..f25dc13 100644 --- a/Tizen.Content/Tizen.Content.MediaContent/ContentDatabase.cs +++ b/Tizen.Content/Tizen.Content.MediaContent/ContentDatabase.cs @@ -245,7 +245,7 @@ namespace Tizen.Content.MediaContent throw MediaContentErrorFactory.CreateException(res, "Failed to get the content collection"); } if (_handle != IntPtr.Zero) - contentCollection = new MediaFolder(_handle); + contentCollection = new PlayList(_handle); } else if (typeof(T) == typeof(Album)) { @@ -256,7 +256,7 @@ namespace Tizen.Content.MediaContent throw MediaContentErrorFactory.CreateException(res, "Failed to get the content collection"); } if (_handle != IntPtr.Zero) - contentCollection = new Storage(_handle); + contentCollection = new Album(_handle); } else if (typeof(T) == typeof(Tag)) { @@ -267,7 +267,7 @@ namespace Tizen.Content.MediaContent throw MediaContentErrorFactory.CreateException(res, "Failed to get the content collection"); } if (_handle != IntPtr.Zero) - contentCollection = new Storage(_handle); + contentCollection = new Tag(_handle); } return (T)contentCollection; } diff --git a/Tizen.Content/Tizen.Content.MediaContent/ContentFilter.cs b/Tizen.Content/Tizen.Content.MediaContent/ContentFilter.cs index 367244e..9fb8633 100644 --- a/Tizen.Content/Tizen.Content.MediaContent/ContentFilter.cs +++ b/Tizen.Content/Tizen.Content.MediaContent/ContentFilter.cs @@ -60,6 +60,9 @@ namespace Tizen.Content.MediaContent { private IntPtr _filterHandle; private bool _disposedValue = false; + private ContentOrder _order = ContentOrder.Asc; + private string _orderKey = "MEDIA_ID"; + private ContentCollation _collationType = ContentCollation.Default; internal IntPtr Handle { get @@ -81,7 +84,7 @@ namespace Tizen.Content.MediaContent res = (MediaContentError)Interop.Filter.GetOffset(_filterHandle, out offset, out count); if (res != MediaContentError.None) { - Log.Warn(MediaContentErrorFactory.LogTag, "Failed to Setoffset"); + Log.Warn(MediaContentErrorFactory.LogTag, "Failed to Get offset"); } return offset; } @@ -104,6 +107,7 @@ namespace Tizen.Content.MediaContent { throw MediaContentErrorFactory.CreateException(res, "Failed to Create Filter handle."); } + res = (MediaContentError)Interop.Filter.SetOrder(_filterHandle,(int) _order, _orderKey, (int) _collationType); } /// /// The number of items to be searched with respect to the offset @@ -126,7 +130,7 @@ namespace Tizen.Content.MediaContent { //TOD: check if we can convert this as method to club offset and count. MediaContentError res; - res = (MediaContentError)Interop.Filter.SetOffset(_filterHandle, value, this.Count); + res = (MediaContentError)Interop.Filter.SetOffset(_filterHandle, this.Offset, value); if (res != MediaContentError.None) { throw MediaContentErrorFactory.CreateException(res, "Failed to Setoffset/Count"); @@ -151,6 +155,10 @@ namespace Tizen.Content.MediaContent { Log.Warn(MediaContentErrorFactory.LogTag, "Failed to GetOrder"); } + if ( orderKey.Length == 0) + { + orderKey = _orderKey; + } return (ContentOrder)orderType; } set @@ -182,10 +190,11 @@ namespace Tizen.Content.MediaContent { Log.Warn(MediaContentErrorFactory.LogTag, "Failed to GetOrder"); } - return (ContentCollation)collatetType; + return (ContentCollation)collatetType; } set { + _collationType = value; //TOD: check if we can convert this as method to club offset and count. MediaContentError res; res = (MediaContentError)Interop.Filter.SetOrder(_filterHandle, (int)this.Order, this.OrderKey, (int)value); @@ -208,6 +217,7 @@ namespace Tizen.Content.MediaContent MediaContentError res; int collatetType; res = (MediaContentError)Interop.Filter.GetCondition(_filterHandle, out conditionVal, out collatetType); + _collationType = (ContentCollation)collatetType; if (res != MediaContentError.None) { Log.Warn(MediaContentErrorFactory.LogTag, "Failed to GetCondition"); @@ -218,7 +228,7 @@ namespace Tizen.Content.MediaContent { //TOD: check if we can convert this as method to club offset and count. MediaContentError res; - res = (MediaContentError)Interop.Filter.SetCondition(_filterHandle, value, (int)this.CollationType); + res = (MediaContentError)Interop.Filter.SetCondition(_filterHandle, value, (int) _collationType); if (res != MediaContentError.None) { throw MediaContentErrorFactory.CreateException(res, "Failed to SetCondition"); @@ -273,10 +283,15 @@ namespace Tizen.Content.MediaContent { Log.Warn(MediaContentErrorFactory.LogTag, "Failed to GetOrder"); } + if (orderKey.Length == 0) + { + orderKey = _orderKey; + } return orderKey; } set { + _orderKey = value; //TOD: check if we can convert this as method to club offset and count. MediaContentError res; res = (MediaContentError)Interop.Filter.SetOrder(_filterHandle, (int)this.Order, value, (int)this.CollationType); -- 2.7.4