Add options for settings app.
Change-Id: I6f2c038f096ebb2cc6005e7705b9a6c3465d3152
using System;
using LibTVRefCommonPortable.Utils;
+using System.Collections.Generic;
namespace LibTVRefCommonPortable.DataModels
{
public string AppID { get; set; }
/// <summary>
+ /// A dictionary which has extra data for App Control
+ /// </summary>
+ private Dictionary<string, string> extraData;
+
+ /// <summary>
+ /// A dictionary which has extra data for App Control
+ /// </summary>
+ public Dictionary<string, string> ExtraData
+ {
+ get
+ {
+ if (extraData == null)
+ {
+ extraData = new Dictionary<string, string>();
+ }
+
+ return extraData;
+ }
+ }
+
+ /// <summary>
/// A method which invoke a App Control to the application of the AppID
/// </summary>
/// <returns>a next state after App Control invocation</returns>
public string Execute()
{
string result = "default";
- AppControlUtils.SendLaunchRequest(AppID);
+ if (ExtraData == null)
+ {
+ AppControlUtils.SendLaunchRequest(AppID);
+ }
+ else
+ {
+ AppControlUtils.SendLaunchRequest(AppID, ExtraData);
+ }
return result;
}
public class AppShortcutController
{
/// <summary>
+ /// The app ID of TV reference home application
+ /// </summary>
+ // TODO : change application later
+ public static string TVHomeAppID = "org.tizen.xahome";
+
+ /// <summary>
+ /// The app ID of TV reference apps-tray application
+ /// </summary>
+ public static string TVAppsAppID = "org.tizen.xaapps";
+
+ /// <summary>
+ /// The app ID of TV reference apps-tray application
+ /// </summary>
+ public static string MediaHubAppID = "org.tizen.xamediahub";
+
+ /// <summary>
/// A default app icon for no icon applications.
/// </summary>
private static String DefaultAppIcon = "AppIcon.png";
+
+ private bool IsNonPinnableApps(string appID)
+ {
+ if (appID.CompareTo(TVHomeAppID) == 0 ||
+ appID.CompareTo(TVAppsAppID) == 0 ||
+ appID.CompareTo(MediaHubAppID) == 0)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
/// <summary>
/// A method provides installed app list.
/// The returned app list has only Tizen UI apps not the system app or no display apps.
IconPath = "ic_tizen_home_list_allapps_normal.png",
Action = new AppControlAction
{
- AppID = "org.tizen.xaapps",
+ AppID = TVAppsAppID,
}
};
IconPath = "ic_tizen_home_list_mediahub_normal.png",
Action = new AppControlAction
{
- AppID = "org.tizen.xamediahub",
+ AppID = MediaHubAppID,
}
};
foreach (AppShortcutInfo appShortcutInfo in pinned_apps_info)
{
+ if (IsNonPinnableApps(appShortcutInfo.AppID))
+ {
+ continue;
+ }
+
Dictionary<string, string> appInfo = ApplicationManagerUtils.GetInstalledApplication(appShortcutInfo.AppID);
if (appInfo == null)
foreach (AppShortcutInfo appShortcutInfo in pinned_apps_info)
{
+ if (IsNonPinnableApps(appShortcutInfo.AppID))
+ {
+ continue;
+ }
+
pinnedAppsDictionary.Add(appShortcutInfo.AppID, appShortcutInfo.AppID);
}
* limitations under the License.
*/
+using System.Collections.Generic;
using Xamarin.Forms;
namespace LibTVRefCommonPortable.Utils
}
/// <summary>
+ /// A method makes the package ID's app to be launched.
+ /// </summary>
+ /// <param name="pkgID">A package ID of the targeted application.</param>
+ /// <param name="extraData">A extra data for App Control invoking.</param>
+ public static void SendLaunchRequest(string pkgID, IDictionary<string, string> extraData)
+ {
+ if (DependencyService.Get<IAppControl>() == null)
+ {
+ return;
+ }
+
+ DependencyService.Get<IAppControl>().SendLaunchRequest(pkgID, extraData);
+ }
+
+ /// <summary>
/// A method sends a add pin request App Control to TVApps app.
/// </summary>
public static void SendAddAppRequestToApps()
}
/// <summary>
- /// A method provides sample App Shortcuts.
- /// </summary>
- /// <returns>a App Shortcut list</returns>
- private static List<AppShortcutInfo> GetSampleList()
- {
- var pinnedAppsInfo = new List<AppShortcutInfo>();
-
- pinnedAppsInfo.Add(new AppShortcutInfo()
- {
- AppID = "org.tizen.settings",
- });
-
- pinnedAppsInfo.Add(new AppShortcutInfo()
- {
- AppID = "org.tizen.apps",
- });
-
- pinnedAppsInfo.Add(new AppShortcutInfo()
- {
- AppID = "org.tizen.home",
- });
-
- return pinnedAppsInfo;
- }
-
- /// <summary>
/// A method provides a App Shortcut list.
/// </summary>
/// <returns>A App Shortcut list.</returns>
if (fileSystem.IsFileExist(storagePath) == false)
{
- // TODO : Modify default pinned Apps
DebuggingUtils.Err("Set Default Pinned Apps" + storagePath);
- List<AppShortcutInfo> result = GetSampleList();
+ List<AppShortcutInfo> result = new List<AppShortcutInfo>();
Write(result);
return result;
}
*/
+using System.Collections.Generic;
+
namespace LibTVRefCommonPortable.Utils
{
/// <summary>
void SendLaunchRequest(string pkgID);
/// <summary>
+ /// Sends the launch request
+ /// </summary>
+ /// <param name="AppId"> The app ID to explicitly launch</param>
+ /// <param name="extraData">The extra data for the app control</param>
+ void SendLaunchRequest(string AppId, IDictionary<string, string> extraData);
+
+ /// <summary>
/// A method sends a add pin request App Control to TVApps app.
/// </summary>
void SendAddAppRequestToApps();
using System;
using LibTVRefCommonPortable.Utils;
using Tizen.Applications;
+using System.Collections.Generic;
namespace LibTVRefCommonTizen.Ports
{
}
/// <summary>
+ /// Sends the launch request
+ /// </summary>
+ /// <param name="AppId"> The app ID to explicitly launch</param>
+ /// <param name="extraData">The extra data for the app control</param>
+ public void SendLaunchRequest(string AppId, IDictionary<string, string> extraData)
+ {
+ try
+ {
+ AppControl appControl = new AppControl();
+
+ if (AppId == null || AppId.Length <= 0)
+ {
+ DebuggingUtils.Err("The AppID is null or blank");
+ return;
+ }
+
+ string value;
+
+ appControl.ApplicationId = AppId;
+ foreach (var key in extraData.Keys)
+ {
+ if (extraData.TryGetValue(key, out value))
+ {
+ appControl.ExtraData.Add(key, value);
+ }
+ }
+
+ AppControl.SendLaunchRequest(appControl);
+ }
+ catch (InvalidOperationException)
+ {
+ DebuggingUtils.Err("Failed to create AppControl");
+ }
+ }
+
+ /// <summary>
/// Sends the 'Add PIN apps' operation to TV Apps
/// </summary>
public void SendAddAppRequestToApps()
private void MakeSettingsButtons()
{
string[] ShortCutLabel = { "Brightness", "Contrast", "Color", "Tint" };
- string[] shortCutActionID = { "org.tizen.settings", "org.tizen.settings", "org.tizen.settings", "org.tizen.settings" };
List<ShortcutInfo> TempList = new List<ShortcutInfo>();
{
AppControlAction appControlAction = new AppControlAction()
{
- AppID = shortCutActionID[i]
+ AppID = "org.tizen.settings",
};
+ appControlAction.ExtraData.Add("subview", ShortCutLabel[i].ToLower());
ShortcutInfo shortcutInfo = new SettingShortcutInfo()
{