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);
        }
Ejemplo n.º 2
0
            public override IInputConnection OnCreateInputConnection(EditorInfo editorInfo)
            {
                var ic = base.OnCreateInputConnection(editorInfo);

                EditorInfoCompat.SetContentMimeTypes(editorInfo, MimeTypes);
                var callback = new OnCommitContentListenerImpl()
                {
                    MimeTypes = MimeTypes, Owner = Owner
                };

                return(InputConnectionCompat.CreateWrapper(ic, editorInfo, callback));
            }
Ejemplo n.º 3
0
        public override IInputConnection OnCreateInputConnection(EditorInfo outAttrs)
        {
            var ic = base.OnCreateInputConnection(outAttrs);

            outAttrs.ImeOptions = outAttrs.ImeOptions | Android.Views.InputMethods.ImeFlags.NoPersonalizedLearning;

            if (ic != null)
            {
                // allow image insertion
                EditorInfoCompat.SetContentMimeTypes(outAttrs, new string[] { "image/gif" });

                ic = InputConnectionCompat.CreateWrapper(ic, outAttrs, this);
            }

            return(ic);
        }