bool IsCommitContentSupported(EditorInfo editorInfo, string mimeType)
        {
            if (editorInfo == null)
            {
                return(false);
            }
            var ic = CurrentInputConnection;

            if (ic == null)
            {
                return(false);
            }

            if (!ValidatePackageName(editorInfo))
            {
                return(false);
            }

            var supportedMimeTypes = EditorInfoCompat.GetContentMimeTypes(editorInfo);

            foreach (var supportedMimeType in supportedMimeTypes)
            {
                if (ClipDescription.CompareMimeTypes(mimeType, supportedMimeType))
                {
                    return(true);
                }
            }
            return(false);
        }
예제 #2
0
파일: Player.cs 프로젝트: Ankhtepot/Hlas
    private void fillClipDescriptions(List <AudioClip> clips)
    {
        float startTime = 0;

        for (int i = 0; i < clips.Count; i++)
        {
            clipDescriptions[i] = new ClipDescription(startTime, startTime + clips[i].length);
            startTime          += clips[i].length;
        }
    }
        bool ProcessDragStarted(DragEvent evt)
        {
            // Determine whether to continue processing drag and drop based on the
            // plain text mime type.
            ClipDescription clipDesc = evt.ClipDescription;

            if (clipDesc != null)
            {
                return(clipDesc.HasMimeType(ClipDescription.MimetypeTextPlain));
            }
            return(false);
        }
예제 #4
0
        //private Context context;

        //public ClipboardService(Context context) {
        //    this.context = context;
        //}

        public void CopyToClipboard(string text)
        {
            //Xamarin.Forms.serDependencyService.Get<ClipboardDemo.IClipboardService>();
            //Android.Content.ClipboardManager clipboard = (ClipboardManager) this.GetSystemService(Context.ClipboardService);

            //ClipboardManager clipboard = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE);
            ClipboardManager clipboardManager = (ClipboardManager)Android.App.Application.Context.GetSystemService(Context.ClipboardService);

            string aaa = clipboardManager.HasPrimaryClip ? "yes" : "no";

            ClipData clip = ClipData.NewHtmlText("Android Clipboard", "", aaa + text);

            clipboardManager.PrimaryClip = clip;
            ClipDescription decr = clipboardManager.PrimaryClip.Description;

            var htmlText = clipboardManager.PrimaryClip.GetItemAt(0).HtmlText;
            //var coercedHtmlText = clipboardManager.PrimaryClip.GetItemAt(0).CoerceToHtmlText;
            //var coercedFormattedStyledText = clipboardManager.PrimaryClip.GetItemAt(0).CoerceToStyledTextFormatted;
        }