From 980046427004b28cbdd43bd0bb3807482fd5e3ce Mon Sep 17 00:00:00 2001 From: Doplgangr Date: Mon, 16 Feb 2015 10:18:36 +0800 Subject: [PATCH] Edit FileProvider to more useful name. --- app/src/main/AndroidManifest.xml | 2 +- ...r.java => SecrecyDecrpytFileProvider.java} | 46 +------------------ .../doplgangr/secrecy/Views/FileViewer.java | 6 +-- 3 files changed, 5 insertions(+), 49 deletions(-) rename app/src/main/java/com/doplgangr/secrecy/FileSystem/{OurFileProvider.java => SecrecyDecrpytFileProvider.java} (91%) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 99cf45e..c1c646d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -19,7 +19,7 @@ android:theme="@style/CustomMaterialTheme"> diff --git a/app/src/main/java/com/doplgangr/secrecy/FileSystem/OurFileProvider.java b/app/src/main/java/com/doplgangr/secrecy/FileSystem/SecrecyDecrpytFileProvider.java similarity index 91% rename from app/src/main/java/com/doplgangr/secrecy/FileSystem/OurFileProvider.java rename to app/src/main/java/com/doplgangr/secrecy/FileSystem/SecrecyDecrpytFileProvider.java index bffe670..0be392f 100644 --- a/app/src/main/java/com/doplgangr/secrecy/FileSystem/OurFileProvider.java +++ b/app/src/main/java/com/doplgangr/secrecy/FileSystem/SecrecyDecrpytFileProvider.java @@ -48,7 +48,7 @@ import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT; import static org.xmlpull.v1.XmlPullParser.START_TAG; -public class OurFileProvider extends ContentProvider { +public class SecrecyDecrpytFileProvider extends ContentProvider { public static final String FILE_PROVIDER_AUTHORITY = "com.doplgangr.secrecy.FileSystem.DecryptFileProvider"; @@ -78,50 +78,6 @@ public static Uri getUriForFile(Context context, String authority, File file) { return strategy.getUriForFile(file); } - /** - * @Override public ParcelFileDescriptor openFile(Uri uri, String mode) - * throws FileNotFoundException { - * ParcelFileDescriptor[] pipe=null; - *

- * try { - * pipe=ParcelFileDescriptor.createPipe(); - * new TransferThread(CustomApp.context.getContentResolver().openInputStream(uri), - * new ParcelFileDescriptor.AutoCloseOutputStream(pipe[1])).start(); - * } - * catch (IOException e) { - * Log.e(getClass().getSimpleName(), "Exception opening pipe", e); - * throw new FileNotFoundException("Could not open pipe for: " - * + uri.toString()); - * } - * return(pipe[0]); - * } - * static class TransferThread extends Thread { - * InputStream in; - * OutputStream out; - *

- * TransferThread(InputStream in, OutputStream out) { - * this.in = in; - * this.out = out; - * } - * @Override public void run() { - * byte[] buf = new byte[8192]; - * int len; - *

- * try { - * while ((len = in.read(buf)) > 0) { - * out.write(buf, 0, len); - * } - *

- * in.close(); - * out.flush(); - * out.close(); - * } catch (IOException e) { - * Log.e(getClass().getSimpleName(), - * "Exception transferring file", e); - * } - * } - * } - */ private static PathStrategy getPathStrategy(Context context, String authority) { PathStrategy strat; synchronized (sCache) { diff --git a/app/src/main/java/com/doplgangr/secrecy/Views/FileViewer.java b/app/src/main/java/com/doplgangr/secrecy/Views/FileViewer.java index 9b6f8ce..e0bbb0e 100644 --- a/app/src/main/java/com/doplgangr/secrecy/Views/FileViewer.java +++ b/app/src/main/java/com/doplgangr/secrecy/Views/FileViewer.java @@ -35,7 +35,7 @@ import com.doplgangr.secrecy.FileSystem.Encryption.Vault; import com.doplgangr.secrecy.FileSystem.Files.EncryptedFile; import com.doplgangr.secrecy.FileSystem.Files.SecrecyFile; -import com.doplgangr.secrecy.FileSystem.OurFileProvider; +import com.doplgangr.secrecy.FileSystem.SecrecyDecrpytFileProvider; import com.doplgangr.secrecy.FileSystem.Storage; import com.doplgangr.secrecy.Jobs.AddFileJob; import com.doplgangr.secrecy.Listeners; @@ -75,7 +75,7 @@ void decrypt(EncryptedFile encryptedFile, final Listeners.EmptyListener onFinish if (tempFile.getParentFile().equals(Storage.getTempFolder())) { tempFile = new File(Storage.getTempFolder(), tempFile.getName()); } - Uri uri = OurFileProvider.getUriForFile(context, OurFileProvider.FILE_PROVIDER_AUTHORITY, tempFile); + Uri uri = SecrecyDecrpytFileProvider.getUriForFile(context, SecrecyDecrpytFileProvider.FILE_PROVIDER_AUTHORITY, tempFile); MimeTypeMap myMime = MimeTypeMap.getSingleton(); Intent newIntent = new Intent(android.content.Intent.ACTION_VIEW); String mimeType = myMime.getMimeTypeFromExtension(encryptedFile.getType()); @@ -101,7 +101,7 @@ void sendMultiple(ArrayList args) { if (tempFile != null) { if (tempFile.getParentFile().equals(Storage.getTempFolder())) tempFile = new java.io.File(Storage.getTempFolder(), tempFile.getName()); - uris.add(OurFileProvider.getUriForFile(context, OurFileProvider.FILE_PROVIDER_AUTHORITY, tempFile)); + uris.add(SecrecyDecrpytFileProvider.getUriForFile(context, SecrecyDecrpytFileProvider.FILE_PROVIDER_AUTHORITY, tempFile)); mimes.add(myMime.getMimeTypeFromExtension(arg.encryptedFile.getType())); }