public FileStorageAdapter(FileStorageSelectionActivity context)
            {
                _context = context;
                //show all supported protocols:
                foreach (IFileStorage fs in App.Kp2a.FileStorages)
                {
                    _displayedProtocolIds.AddRange(fs.SupportedProtocols);
                }

                //this is there for legacy reasons, new protocol is onedrive
                _displayedProtocolIds.Remove("skydrive");

                //onedrive was replaced by onedrive2 in a later implementation, but we still have the previous implementation to open existing connections (without the need to re-authenticate etc.)
                _displayedProtocolIds.Remove("onedrive");



                //special handling for local files:
                if (!Util.IsKitKatOrLater)
                {
                    //put file:// to the top
                    _displayedProtocolIds.Remove("file");
                    _displayedProtocolIds.Insert(0, "file");

                    //remove "content" (covered by androidget)
                    //On KitKat, content is handled by AndroidContentStorage taking advantage
                    //of persistable permissions and ACTION_OPEN/CREATE_DOCUMENT
                    _displayedProtocolIds.Remove("content");
                }
                else
                {
                    _displayedProtocolIds.Remove("file");
                }


                //starting with Android 11, we don't show the Third party app option. Due to restricted permissions,
                //this no longer works.
                if ((int)Build.VERSION.SdkInt < 30)
                {
                    if (context.Intent.GetBooleanExtra(AllowThirdPartyAppGet, false))
                    {
                        _displayedProtocolIds.Add("androidget");
                    }
                }
                if (context.Intent.GetBooleanExtra(AllowThirdPartyAppSend, false))
                {
                    _displayedProtocolIds.Add("androidsend");
                }
#if NoNet
                _displayedProtocolIds.Add("kp2a");
#endif
                _displayedProtocolIds = _displayedProtocolIds.GroupBy(p => App.Kp2a.GetStorageMainTypeDisplayName(p))
                                        .Select(g => string.Join(",", g)).ToList();
            }
Exemple #2
0
            public FileStorageAdapter(FileStorageSelectionActivity context)
            {
                _context = context;
                //show all supported protocols:
                foreach (IFileStorage fs in App.Kp2a.FileStorages)
                {
                    _displayedProtocolIds.AddRange(fs.SupportedProtocols);
                }

                //this is there for legacy reasons, new protocol is onedrive
                _displayedProtocolIds.Remove("skydrive");

                //special handling for local files:
                if (!Util.IsKitKatOrLater)
                {
                    //put file:// to the top
                    _displayedProtocolIds.Remove("file");
                    _displayedProtocolIds.Insert(0, "file");

                    //remove "content" (covered by androidget)
                    //On KitKat, content is handled by AndroidContentStorage taking advantage
                    //of persistable permissions and ACTION_OPEN/CREATE_DOCUMENT
                    _displayedProtocolIds.Remove("content");
                }
                else
                {
                    _displayedProtocolIds.Remove("file");
                }


                if (context.Intent.GetBooleanExtra(AllowThirdPartyAppGet, false))
                {
                    _displayedProtocolIds.Add("androidget");
                }
                if (context.Intent.GetBooleanExtra(AllowThirdPartyAppSend, false))
                {
                    _displayedProtocolIds.Add("androidsend");
                }
#if NoNet
                _displayedProtocolIds.Add("kp2a");
#endif
            }
            public FileStorageAdapter(FileStorageSelectionActivity context)
            {
                _context = context;
                //show all supported protocols:
                foreach (IFileStorage fs in App.Kp2a.FileStorages)
                    _protocolIds.AddRange(fs.SupportedProtocols);

                //special handling for local files:
                if (!Util.IsKitKatOrLater)
                {
                    //put file:// to the top
                    _protocolIds.Remove("file");
                    _protocolIds.Insert(0, "file");

                    //remove "content" (covered by androidget)
                    //On KitKat, content is handled by AndroidContentStorage taking advantage
                    //of persistable permissions and ACTION_OPEN/CREATE_DOCUMENT
                    _protocolIds.Remove("content");

                }
                else
                {
                    _protocolIds.Remove("file");
                }

                if (context.Intent.GetBooleanExtra(AllowThirdPartyAppGet, false))
                    _protocolIds.Add("androidget");
                if (context.Intent.GetBooleanExtra(AllowThirdPartyAppSend, false))
                    _protocolIds.Add("androidsend");
                #if NoNet
                _protocolIds.Add("kp2a");
                #endif
            }