diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/extensions/long.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/extensions/long.kt deleted file mode 100644 index 3fcceb29..00000000 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/extensions/long.kt +++ /dev/null @@ -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] -} diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/fragments/ItemsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/fragments/ItemsFragment.kt index 0d2f17eb..bc4bf2b5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/fragments/ItemsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/fragments/ItemsFragment.kt @@ -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) {