remove Long extension

This commit is contained in:
tibbi 2016-11-20 23:13:27 +01:00
parent d0c424e904
commit 83647b0e8f
2 changed files with 5 additions and 15 deletions

View File

@ -1,12 +0,0 @@
package com.simplemobiletools.filemanager.extensions
import java.text.DecimalFormat
fun Long.formatSize(): String {
if (this <= 0)
return "0 B"
val units = arrayOf("B", "kB", "MB", "GB", "TB")
val digitGroups = (Math.log10(toDouble()) / Math.log10(1024.0)).toInt()
return DecimalFormat("#,##0.#").format(this / Math.pow(1024.0, digitGroups.toDouble())) + " " + units[digitGroups]
}

View File

@ -76,9 +76,11 @@ class ItemsFragment : android.support.v4.app.Fragment(), ItemsAdapter.ItemOperat
val adapter = ItemsAdapter(activity as SimpleActivity, mItems, this) {
itemClicked(it)
}
items_list.adapter = adapter
items_list.addItemDecoration(RecyclerViewDivider(context))
items_list.setOnTouchListener { view, motionEvent -> checkDelete(); false }
items_list.apply {
this@apply.adapter = adapter
addItemDecoration(RecyclerViewDivider(context))
setOnTouchListener { view, motionEvent -> checkDelete(); false }
}
}
fun setListener(listener: ItemInteractionListener) {