From c4d988bba2eeac1cb5253d3210a831cbe10120c0 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Tue, 21 Jun 2016 14:29:36 +0200 Subject: [PATCH] Add comment + update function --- .../org/linphone/tools/CodecDownloader.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/java/impl/org/linphone/tools/CodecDownloader.java b/java/impl/org/linphone/tools/CodecDownloader.java index d65e84592..29e984a8a 100644 --- a/java/impl/org/linphone/tools/CodecDownloader.java +++ b/java/impl/org/linphone/tools/CodecDownloader.java @@ -56,7 +56,7 @@ interface CodecDownloadAction{ * @author Erwan Croze */ public class CodecDownloader implements CodecDownloadListener,CodecDownloadAction{ - private static String fileDirection; + private static String fileDirection = null; private static String nameLib; private static String urlDownload; private static String nameFileDownload; @@ -72,9 +72,7 @@ public class CodecDownloader implements CodecDownloadListener,CodecDownloadActio return licenseMessage; } - static public void setFileDirection(String s) { - fileDirection = s; - } + static public void setFileDirection(String s) { fileDirection = s; } static public void setNameLib(String s) { nameLib = s; @@ -92,11 +90,23 @@ public class CodecDownloader implements CodecDownloadListener,CodecDownloadActio urlDownload = s; } - static public boolean codecExist(Context ctxt) { - if (ctxt == null) return false; - return new File(ctxt.getFilesDir()+"/" + nameLib).exists(); + /** + * Indicates whether the lib exists + * Requirements : fileDirection and nameLib init + * @return file exists ? + */ + static public boolean codecExist() { + return new File(fileDirection+"/" + nameLib).exists(); } + /** + * Try to download codec + * Requirements : + * fileDirection + * nameFileDownload + * urlDownload + * nameLib + */ public void downloadCodec() { Thread thread = new Thread(new Runnable() {