Exemplo n.º 1
0
        public void PrepareFileUsage(IFileStorageSetupInitiatorActivity activity, IOConnectionInfo ioc, int requestCode, bool alwaysReturnSuccess)
        {
            //check if we need to request the external-storage-permission at runtime
            if (ioc.IsLocalFile())
            {
                bool requiresPermission = !(ioc.Path.StartsWith(activity.Activity.FilesDir.CanonicalPath) ||
                                            ioc.Path.StartsWith(IoUtil.GetInternalDirectory(activity.Activity).CanonicalPath) ||
                                            ioc.Path.StartsWith(IoUtil.GetInternalDirectory(activity.Activity).CanonicalPath));

                var extDirectory = activity.Activity.GetExternalFilesDir(null);
                if ((extDirectory != null) && (ioc.Path.StartsWith(extDirectory.CanonicalPath)))
                {
                    requiresPermission = false;
                }

                if (requiresPermission && (Build.VERSION.SdkInt >= BuildVersionCodes.M))
                {
                    if ((activity.Activity.CheckSelfPermission(Manifest.Permission.WriteExternalStorage) ==
                         Permission.Denied)
                        ||
                        (activity.Activity.CheckSelfPermission(Manifest.Permission.ReadExternalStorage) ==
                         Permission.Denied))

                    {
                        activity.StartFileUsageProcess(ioc, requestCode, alwaysReturnSuccess);
                        return;
                    }
                }
            }
            Intent intent = new Intent();

            activity.IocToIntent(intent, ioc);
            activity.OnImmediateResult(requestCode, (int)FileStorageResults.FileUsagePrepared, intent);
        }
Exemplo n.º 2
0
        public void StartSelectFile(IFileStorageSetupInitiatorActivity activity, bool isForSave, int requestCode,
                                    string protocolId)
        {
            String path = ProtocolId + "://";

            activity.StartSelectFileProcess(IOConnectionInfo.FromPath(path), isForSave, requestCode);
        }
Exemplo n.º 3
0
        public void PrepareFileUsage(IFileStorageSetupInitiatorActivity activity, IOConnectionInfo ioc, int requestCode,
                                     bool alwaysReturnSuccess)
        {
            Intent intent = new Intent();

            activity.IocToIntent(intent, ioc);
            activity.OnImmediateResult(requestCode, (int)FileStorageResults.FileUsagePrepared, intent);
        }
Exemplo n.º 4
0
        public void StartSelectFile(IFileStorageSetupInitiatorActivity activity, bool isForSave, int requestCode, string protocolId)
        {
            Intent intent = new Intent();

            activity.IocToIntent(intent, new IOConnectionInfo {
                Path = protocolId + "://"
            });
            activity.OnImmediateResult(requestCode, (int)FileStorageResults.FileChooserPrepared, intent);
        }
Exemplo n.º 5
0
 public void PrepareFileUsage(IFileStorageSetupInitiatorActivity activity, IOConnectionInfo ioc, int requestCode, Boolean alwaysReturnSuccess)
 {
     try
     {
         _jfs.PrepareFileUsage((IJavaFileStorageFileStorageSetupInitiatorActivity)activity, IocToPath(ioc), requestCode,
                               alwaysReturnSuccess);
     }
     catch (Exception e)
     {
         throw LogAndConvertJavaException(e);
     }
 }
Exemplo n.º 6
0
 public void PrepareFileUsage(IFileStorageSetupInitiatorActivity activity, IOConnectionInfo ioc, int requestCode,
                              bool alwaysReturnSuccess)
 {
     if (IsConnected(ioc.Path))
     {
         Intent intent = new Intent();
         intent.PutExtra(FileStorageSetupDefs.ExtraPath, ioc.Path);
         activity.OnImmediateResult(requestCode, (int)FileStorageResults.FileUsagePrepared, intent);
     }
     else
     {
         activity.StartFileUsageProcess(ioc, requestCode, alwaysReturnSuccess);
     }
 }
Exemplo n.º 7
0
 public void StartSelectFile(IFileStorageSetupInitiatorActivity activity, bool isForSave, int requestCode, string protocolId)
 {
     if (protocolId != "file")
     {
         activity.PerformManualFileSelect(isForSave, requestCode, protocolId);
     }
     else
     {
         Intent intent = new Intent();
         activity.IocToIntent(intent, new IOConnectionInfo()
         {
             Path = protocolId + "://",
         });
         activity.OnImmediateResult(requestCode, (int)FileStorageResults.FileChooserPrepared, intent);
     }
 }
Exemplo n.º 8
0
 public void PrepareFileUsage(IFileStorageSetupInitiatorActivity activity, IOConnectionInfo ioc, int requestCode, bool alwaysReturnSuccess)
 {
     //we try to prepare the file usage by the underlying file storage but if the ioc is cached, set the flag to ignore errors
     _cachedStorage.PrepareFileUsage(activity, ioc, requestCode, alwaysReturnSuccess || IsCached(ioc));
 }
Exemplo n.º 9
0
 public void PrepareFileUsage(IFileStorageSetupInitiatorActivity activity, IOConnectionInfo ioc, int requestCode, Boolean alwaysReturnSuccess)
 {
     try
     {
         _jfs.PrepareFileUsage((IJavaFileStorageFileStorageSetupInitiatorActivity) activity, IocToPath(ioc), requestCode,
                               alwaysReturnSuccess);
     }
     catch (Exception e)
     {
         throw LogAndConvertJavaException(e);
     }
 }
Exemplo n.º 10
0
 public void StartSelectFile(IFileStorageSetupInitiatorActivity activity, bool isForSave, int requestCode, string protocolId)
 {
     _cachedStorage.StartSelectFile(activity, isForSave, requestCode, protocolId);
 }
Exemplo n.º 11
0
 public void PrepareFileUsage(IFileStorageSetupInitiatorActivity activity, IOConnectionInfo ioc, int requestCode, bool alwaysReturnSuccess)
 {
     //we try to prepare the file usage by the underlying file storage but if the ioc is cached, set the flag to ignore errors
     _cachedStorage.PrepareFileUsage(activity, ioc, requestCode, alwaysReturnSuccess || IsCached(ioc));
 }
Exemplo n.º 12
0
 public void StartSelectFile(IFileStorageSetupInitiatorActivity activity, bool isForSave, int requestCode, string protocolId)
 {
     activity.PerformManualFileSelect(isForSave, requestCode, "ftp");
 }
Exemplo n.º 13
0
 public virtual void StartSelectFile(IFileStorageSetupInitiatorActivity activity, bool isForSave, int requestCode, string protocolId)
 {
     Kp2aLog.Log("StartSelectFile " + protocolId);
     _jfs.StartSelectFile((IJavaFileStorageFileStorageSetupInitiatorActivity)activity, isForSave, requestCode);
 }
 public void StartSelectFile(IFileStorageSetupInitiatorActivity activity, bool isForSave, int requestCode, string protocolId)
 {
     throw new NotImplementedException();
 }
 public void PrepareFileUsage(IFileStorageSetupInitiatorActivity activity, IOConnectionInfo ioc, int requestCode,
                              bool alwaysReturnSuccess)
 {
     throw new NotImplementedException();
 }
 public override void StartSelectFile(IFileStorageSetupInitiatorActivity activity, bool isForSave, int requestCode,
                                      string protocolId)
 {
     //need to override so we can loop the protocolId through
     activity.PerformManualFileSelect(isForSave, requestCode, protocolId);
 }
Exemplo n.º 17
0
        public void PrepareFileUsage(IFileStorageSetupInitiatorActivity activity, IOConnectionInfo ioc, int requestCode,
		                             bool alwaysReturnSuccess)
        {
            Intent intent = new Intent();
            activity.IocToIntent(intent, ioc);
            activity.OnImmediateResult(requestCode, (int)FileStorageResults.FileUsagePrepared, intent);
        }
 public void StartSelectFile(IFileStorageSetupInitiatorActivity activity, bool isForSave, int requestCode, string protocolId)
 {
     _baseStorage.StartSelectFile(activity, isForSave, requestCode, protocolId);
 }
Exemplo n.º 19
0
 public void StartSelectFile(IFileStorageSetupInitiatorActivity activity, bool isForSave, int requestCode, string protocolId)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 20
0
        public void PrepareFileUsage(IFileStorageSetupInitiatorActivity activity, IOConnectionInfo ioc, int requestCode,
		                             bool alwaysReturnSuccess)
        {
            throw new NotImplementedException();
        }
Exemplo n.º 21
0
 public void StartSelectFile(IFileStorageSetupInitiatorActivity activity, bool isForSave, int requestCode, string protocolId)
 {
     Intent intent = new Intent();
     activity.IocToIntent(intent, new IOConnectionInfo { Path = protocolId + "://" });
     activity.OnImmediateResult(requestCode, (int)FileStorageResults.FileChooserPrepared, intent);
 }
Exemplo n.º 22
0
 public void StartSelectFile(IFileStorageSetupInitiatorActivity activity, bool isForSave, int requestCode, string protocolId)
 {
     Kp2aLog.Log("StartSelectFile " + protocolId);
     _jfs.StartSelectFile((IJavaFileStorageFileStorageSetupInitiatorActivity) activity, isForSave, requestCode);
 }