From 125c90e3514d711e45da84b454e6392e62a5bb2c Mon Sep 17 00:00:00 2001 From: Tonyo Francis Date: Thu, 27 Apr 2017 14:35:32 -0400 Subject: [PATCH] Bug Fixes and Cleanup Version 1.3 --- app/build.gradle | 2 +- app/src/main/res/drawable/screenshot.png | Bin 0 -> 26825 bytes storagegrapher/build.gradle | 6 +- .../com/tonyodev/storagegrapher/Storage.java | 115 ++++-------------- 4 files changed, 26 insertions(+), 97 deletions(-) create mode 100644 app/src/main/res/drawable/screenshot.png diff --git a/app/build.gradle b/app/build.gradle index 677a090..f33cafc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 25 - buildToolsVersion "25.0.2" + buildToolsVersion "25.0.3" defaultConfig { applicationId "com.tonyodev.storagespace" minSdkVersion 16 diff --git a/app/src/main/res/drawable/screenshot.png b/app/src/main/res/drawable/screenshot.png new file mode 100644 index 0000000000000000000000000000000000000000..5c754a2a5314b50fde1f0512bd90dd5ec89d0761 GIT binary patch literal 26825 zcmbTd1y~(T(;zzM;O>&(EwV$1+wx0!W=ilwkwUzVF^PCR^7YF2rhyJF%K4UGY9@{GE_nvQT6edSgTQo&6 z^7Qb!C56f=y?A=6Cy7cE5)aH@_m&E0eLSg~yPwL)<6n8LApd}eveJXArZL+qPY?FN z^$?*vwg2HTa2BN#IaB4QI+LDN&X`RX518^x^-$Qpaj=c?8UMp)sLH-K?&ERHYqPbj zNLDu=PF4NZ`1+ns@3SNbWH~BJK>3qf@kX}aew+g{L^Wcupy}@FQ<$*<>9?ZPa^kvL z4-1PA0mpa9Q0d=Dz1Nzr9rt?&%RSF>Kghq4-)L!cIc8ny85iJy|FUQ zgY$m!)XRddio1^h(vy?oa@%mesl-I1bxOP>fZ^*xyE(Rw*4>UZ98)kf7cW}t#*0qu}@rPrT+tn zQVxzO_S$rowDsH^N|-&+(<2cUkI20Gv~MLx;On1QIi$@@&I!Bu5BZ{)PARjgB=*hl{fpp!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+L0mnpW|9XDqolkNALShV;=ZcnnbYP!CEqbep zUyf^G0z&GSO&|oQJXxV(^oAoJ!5mK&i~4r<35Y8uBrm-+Tu(9?YAz~s*HHzLlyl|5cY{yZ*?{|Xs>MD;r&Fs z?fWJB-yaez06xTEr4mSy(H(V#lPCkdXDY<_FI-pw?KxlMkB3eL3Zh?CA76j2`02)e zJlEAXuQ|IUn2;8oFe?jxe}Be%!{^UlzHtulcm1&7El-oZIrpW%AAMf#GtgF0NN7H& z5ec*9`|2L;Wo3l|eSkmAp#C#8^x&)>gO2A1BX5_2#&?)R6B)N@tQvL=ErD(|79sDp zUN%;071M>}XLTvMviI#SEczs<@AAVW3fJ~jVUrnlzEIrx zaXJaWLIpU@5{N5zor3D`zfZVf*?O4KzP07`Qt=vjwDjiqrO96;=YPY_2h8Q^XiHVn zU0_>gPwt@z)ib0mEGi-uPcU5BBm*Zf`;iQ4hVI!505-DLmKNI`Zf{F!Yp4xs4jOQj z7P1?T+yuN)j4t>zKQ{B!uC^LAa6wv#v`0%a4~E71r|-n#ZNX@wrlw|rG4QVq26vJf z%{X@DJRMy*Myit1RjlU?|3>CQf?vuc&6@eW|e6=ZY^jNfaz>0{VR`rtcKyb4cxCj#FX^w0d$8~z{9k&jwoL!ad1u%|z1s$EwtRj~~DADfpdLI3~& literal 0 HcmV?d00001 diff --git a/storagegrapher/build.gradle b/storagegrapher/build.gradle index c5e2c2c..3e8b1e0 100644 --- a/storagegrapher/build.gradle +++ b/storagegrapher/build.gradle @@ -2,13 +2,13 @@ apply plugin: 'com.android.library' android { compileSdkVersion 25 - buildToolsVersion "25.0.2" + buildToolsVersion "25.0.3" defaultConfig { minSdkVersion 16 targetSdkVersion 25 - versionCode 3 - versionName "1.2" + versionCode 4 + versionName "1.3" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" diff --git a/storagegrapher/src/main/java/com/tonyodev/storagegrapher/Storage.java b/storagegrapher/src/main/java/com/tonyodev/storagegrapher/Storage.java index e7d78e4..de51980 100644 --- a/storagegrapher/src/main/java/com/tonyodev/storagegrapher/Storage.java +++ b/storagegrapher/src/main/java/com/tonyodev/storagegrapher/Storage.java @@ -11,9 +11,11 @@ import android.text.format.Formatter; import java.io.File; +import java.io.IOException; import java.util.Arrays; import java.util.LinkedList; import java.util.List; +import java.util.Queue; /** * Created by tonyofrancis on 4/21/17. @@ -24,33 +26,6 @@ public final class Storage { - /** - * Converts bytes to Gigabytes and returns a formatted string - * @param bytes bytes - *@return formatted string with conversion - */ - public static String bytesToGigabytesString(long bytes) { - return bytesToGigabytes(bytes) + " GB"; - } - - /** - * Converts bytes to Megabytes and returns a formatted string - * @param bytes bytes - *@return formatted string with conversion - */ - public static String bytesToMegabytesString(long bytes) { - return bytesToMegabytes(bytes) + " MB"; - } - - /** - * Converts bytes to Kilobytes and returns a formatted string - * @param bytes bytes - *@return formatted string with conversion - */ - public static String bytesToKilobytesString(long bytes) { - return bytesToKilobytes(bytes) + " KB"; - } - /** * Formats a content size to be in the form of bytes, kilobytes, megabytes, etc. * @param context context @@ -66,18 +41,6 @@ public static String getFormattedStorageAmount(Context context, long bytes) { return Formatter.formatFileSize(context,bytes); } - public static double bytesToGigabytes(long bytes) { - return (double)bytes / (double)1073741824; - } - - public static double bytesToMegabytes(long bytes) { - return (double)bytes / (double)1048576; - } - - public static double bytesToKilobytes(long bytes) { - return (double)bytes / (double)1024; - } - /** * @param volume Storage Volume * @return available bytes on a storage volume @@ -280,7 +243,7 @@ private static boolean isNewSdNameFormat(String name) { int c = (int) name.charAt(i); - if(c == (int)'-') { + if(c == (int)'-' && i == 4) { continue; } @@ -292,22 +255,6 @@ private static boolean isNewSdNameFormat(String name) { return true; } - /** - * @return File - Internal Storage Directory - * */ - @Nullable - public static File getInternalStorageDir() { - - File internalStorage = Environment.getExternalStorageDirectory(); - - if(internalStorage != null && Environment.isExternalStorageEmulated() - && !Environment.isExternalStorageRemovable()) { - return internalStorage; - } - - return getPrimaryStorageDir(); - } - /** * @return File - Application directory. Note: An application * can be install on an external Storage Volume. @@ -388,7 +335,7 @@ public static long getSecondaryAppFilesDirBytes(Context context) { File file = getSecondaryAppFilesDir(context); - if(file == null) { + if(file == null || !file.exists()) { return 0; } @@ -405,9 +352,9 @@ public static long getPrimaryAppFilesDirBytes(Context context) { throw new NullPointerException("Context cannot be null"); } - File file = getPrimaryStorageDir(); + File file = getPrimaryAppFilesDir(context); - if(file == null) { + if(file == null || !file.exists()) { return 0; } @@ -458,21 +405,6 @@ public static StorageVolume getStorageVolume(String path) { usedPercentage,freePercentage); } - /** - * @return Storage Volume for internal storage directory - * */ - @Nullable - public static StorageVolume getInternalStorageVolume() { - - File file = getInternalStorageDir(); - - if(file == null) { - return null; - } - - return getStorageVolume(file); - } - /** * @return Storage Volume for primary storage directory * */ @@ -496,7 +428,7 @@ public static StorageVolume getPrimaryStorageVolume() { public static StorageVolume getSecondaryStorageVolume(Context context) { if(context == null) { - return null; + throw new NullPointerException("Context cannot be null"); } File file = getSecondaryStorageDir(context); @@ -512,19 +444,13 @@ public static StorageVolume getSecondaryStorageVolume(Context context) { * @param context context * @return the size of the application directory in bytes * */ - public static long getAppDirBytes(Context context ){ + public static long getAppDirBytes(Context context){ if(context == null) { throw new NullPointerException("Context cannot be null"); } - File file = getAppDir(context); - - if(file == null) { - return 0; - } - - return getDirectorySize(file); + return getDirectorySize(getAppDir(context)); } /** @@ -535,12 +461,8 @@ public static long getAppDirBytes(Context context ){ * */ public static long getDirectorySize(File file) { - if(file == null) { - throw new NullPointerException("File cannot be null"); - } - - LinkedList queue = new LinkedList<>(); long size = 0; + Queue queue = new LinkedList<>(); queue.add(file); @@ -548,20 +470,27 @@ public static long getDirectorySize(File file) { File f = queue.remove(); - if(f != null) { + if(f != null && file.exists()) { size += f.length(); - if(file.isDirectory()) { + try { + + if(f.isDirectory() && f.getAbsolutePath().equals(f.getCanonicalPath())) { - File[] subFiles = f.listFiles(); + File[] subFiles = f.listFiles(); - if(subFiles != null) { - queue.addAll(Arrays.asList(subFiles)); + if(subFiles != null) { + queue.addAll(Arrays.asList(subFiles)); + } } + + }catch (IOException e ){ + e.printStackTrace(); } } } + return size; } }