forked from mirror/monocles_chat
fix calculation of media size [Christian Schneppe]
This commit is contained in:
parent
418e3bfe5f
commit
743e55244c
3 changed files with 3 additions and 12 deletions
|
@ -373,10 +373,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
|
|||
protected Void doInBackground(Void... params) {
|
||||
try {
|
||||
totalMemory = FileBackend.getDiskSize();
|
||||
mediaUsage = FileBackend.getDirectorySize(new File(getAppMediaDirectory(activity, FileBackend.AUDIOS)))
|
||||
+ FileBackend.getDirectorySize(new File(getAppMediaDirectory(activity, FileBackend.FILES)))
|
||||
+ FileBackend.getDirectorySize(new File(getAppMediaDirectory(activity, FileBackend.IMAGES)))
|
||||
+ FileBackend.getDirectorySize(new File(getAppMediaDirectory(activity, FileBackend.VIDEOS)));
|
||||
mediaUsage = FileBackend.getDirectorySize(new File(getAppMediaDirectory(activity, null)));
|
||||
relativeUsage = ((double) mediaUsage / (double) totalMemory);
|
||||
try {
|
||||
percentUsage = String.format(Locale.getDefault(),"%.2f", relativeUsage * 100) + " %";
|
||||
|
|
|
@ -141,10 +141,7 @@ public class MemoryManagementActivity extends XmppActivity {
|
|||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
totalMemory = UIHelper.filesizeToString(FileBackend.getDiskSize());
|
||||
mediaUsage = UIHelper.filesizeToString(FileBackend.getDirectorySize(new File(getAppMediaDirectory(mContext, IMAGES)))
|
||||
+ FileBackend.getDirectorySize(new File(getAppMediaDirectory(mContext, AUDIOS)))
|
||||
+ FileBackend.getDirectorySize(new File(getAppMediaDirectory(mContext, VIDEOS)))
|
||||
+ FileBackend.getDirectorySize(new File(getAppMediaDirectory(mContext, FILES))));
|
||||
mediaUsage = UIHelper.filesizeToString(FileBackend.getDirectorySize(new File(getAppMediaDirectory(mContext, null))));
|
||||
picturesUsage = UIHelper.filesizeToString(FileBackend.getDirectorySize(new File(getConversationsDirectory(mContext, IMAGES).getAbsolutePath())));
|
||||
videosUsage = UIHelper.filesizeToString(FileBackend.getDirectorySize(new File(getConversationsDirectory(mContext, VIDEOS).getAbsolutePath())));
|
||||
filesUsage = UIHelper.filesizeToString(FileBackend.getDirectorySize(new File(getConversationsDirectory(mContext, FILES).getAbsolutePath())));
|
||||
|
|
|
@ -57,10 +57,7 @@ public class MemoryManagementPref extends Preference {
|
|||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
totalMemory = UIHelper.filesizeToString(FileBackend.getDiskSize());
|
||||
mediaUsage = UIHelper.filesizeToString(FileBackend.getDirectorySize(new File(getAppMediaDirectory(mContext, FileBackend.AUDIOS)))
|
||||
+ FileBackend.getDirectorySize(new File(getAppMediaDirectory(mContext, FileBackend.FILES)))
|
||||
+ FileBackend.getDirectorySize(new File(getAppMediaDirectory(mContext, FileBackend.IMAGES)))
|
||||
+ FileBackend.getDirectorySize(new File(getAppMediaDirectory(mContext, FileBackend.VIDEOS))));
|
||||
mediaUsage = UIHelper.filesizeToString(FileBackend.getDirectorySize(new File(getAppMediaDirectory(mContext, null))));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue