// TODO: Invoke from somewhere public static void RevokeSubscriptions() { foreach (var i in OnGetImage.GetInvocationList()) { OnGetImage -= (Action <Texture2D>)i; } }
/// <summary> /// Gets tree node icon /// </summary> /// <param name="node">Tree node</param> /// <param name="data">Source data</param> private string GetNodeIconMarkup(UniTreeNode node, DataRow data) { string imagePath = null; string iconClass = null; // Get image path from data if (!string.IsNullOrEmpty(ProviderObject.ImageColumn)) { imagePath = ValidationHelper.GetString(data[ProviderObject.ImageColumn], null); } // Get icon class from data if (!string.IsNullOrEmpty(ProviderObject.IconClassColumn)) { iconClass = ValidationHelper.GetString(data[ProviderObject.IconClassColumn], null); } // Get image or icon from external event if (OnGetImage != null) { // Set node as event argument var args = new UniTreeImageArgs { TreeNode = node }; OnGetImage.StartEvent(args); // Get image or icon class if (string.IsNullOrEmpty(imagePath) && !string.IsNullOrEmpty(args.ImagePath)) { imagePath = args.ImagePath; } else if (string.IsNullOrEmpty(iconClass) && !string.IsNullOrEmpty(args.IconClass)) { iconClass = args.IconClass; } } // If no definition found, use default image path if (string.IsNullOrEmpty(imagePath) && string.IsNullOrEmpty(iconClass)) { // Image path has higher priority if (!string.IsNullOrEmpty(DefaultImagePath)) { imagePath = DefaultImagePath; } else if (!string.IsNullOrEmpty(DefaultIconClass)) { iconClass = DefaultIconClass; } } return(UIHelper.GetAccessibleImageMarkup(Page, iconClass, imagePath, size: FontIconSizeEnum.Standard)); }
public void ExtractData() { AndroidJavaClass UnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject currentActivity = UnityPlayer.GetStatic <AndroidJavaObject>("currentActivity"); AndroidJavaObject intent = currentActivity.Call <AndroidJavaObject>("getIntent"); //can be used to extract data from notification or deep linking string path = string.Empty; AndroidJavaObject externalIntent = new AndroidJavaObject("com.example.externalintent.ExternalIntent"); path = externalIntent.Call <string>("getRealPathFromURI", new object[] { currentActivity }); string action = intent.Call <string>("getAction"); // If the app opened using the MAIN action, the app was opened using the icon // and this is not a notification or deep link action if (action == "android.intent.action.MAIN") { Debug.Log(TAG + " : Recognised android.intent.action.MAIN"); return; } // If there is no path data in the intent, we ignore it if (string.IsNullOrEmpty(path)) { Debug.Log(TAG + " : No action path recognised"); return; } // If the path data is the same as the previously detected one, we ignore it if (m_LastPath.Equals(path)) { Debug.Log(TAG + " : Action path repeat. Ignoring."); return; } Debug.Log(TAG + " : Action Path: " + path); // If the path points to a cached image if (path.Contains("external_files") || path.Contains("external/file")) { Debug.Log(TAG + " : Cached image detected in action"); GetCachedImage(path, res => { if (res != null) { OnGetImage?.Invoke(res); } else { OnGetImage?.Invoke(null); } }); } // Else we get the image from the remote URL else { Runner.New(GetOnlineImage(path, tex => { if (tex != null) { OnGetImage?.Invoke(tex); } else { OnGetImage?.Invoke(null); } })).Run(); } m_LastPath = path; }