Skip to content

Commit 592b9c1

Browse files
committed
show an empty dialog at pressing Properties with multiple items selected
1 parent 1b4ff76 commit 592b9c1

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

app/src/main/java/com/simplemobiletools/filemanager/fragments/ItemsFragment.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ private void displayPropertiesDialog() {
392392
if (itemIndexes.size() == 1) {
393393
showOneItemProperties();
394394
} else {
395-
showMultipleItemProperties();
395+
showMultipleItemProperties(itemIndexes);
396396
}
397397
}
398398

@@ -404,8 +404,12 @@ private void showOneItemProperties() {
404404
new PropertiesDialog(getContext(), item.getPath(), mConfig.getShowHidden());
405405
}
406406

407-
private void showMultipleItemProperties() {
408-
407+
private void showMultipleItemProperties(List<Integer> itemIndexes) {
408+
final List<String> paths = new ArrayList<>(itemIndexes.size());
409+
for (int i : itemIndexes) {
410+
paths.add(mItems.get(i).getPath());
411+
}
412+
new PropertiesDialog(getContext(), paths, mConfig.getShowHidden());
409413
}
410414

411415
private void displayRenameDialog() {

app/src/main/kotlin/com/simplemobiletools/filemanager/dialogs/PropertiesDialog.kt

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ class PropertiesDialog() {
2626
mCountHiddenItems = countHiddenItems
2727
mInflater = LayoutInflater.from(context)
2828
mResources = mContext.resources
29-
30-
val file = File(path)
3129
mPropertyView = mInflater.inflate(R.layout.item_properties, null) as ViewGroup
3230

31+
val file = File(path)
3332
addProperty(R.string.name, file.name)
3433
addProperty(R.string.path, file.parent)
3534
addProperty(R.string.size, getItemSize(file))
@@ -54,6 +53,21 @@ class PropertiesDialog() {
5453
.show()
5554
}
5655

56+
constructor(context: Context, paths: List<String>, countHiddenItems: Boolean = false) : this() {
57+
mContext = context
58+
mCountHiddenItems = countHiddenItems
59+
mInflater = LayoutInflater.from(context)
60+
mResources = mContext.resources
61+
mPropertyView = mInflater.inflate(R.layout.item_properties, null) as ViewGroup
62+
63+
AlertDialog.Builder(context)
64+
.setTitle(mResources.getString(R.string.properties))
65+
.setView(mPropertyView)
66+
.setPositiveButton(R.string.ok, null)
67+
.create()
68+
.show()
69+
}
70+
5771
private fun addProperty(labelId: Int, value: String) {
5872
val view = mInflater.inflate(R.layout.property_item, mPropertyView, false)
5973
view.property_label.text = mResources.getString(labelId)

0 commit comments

Comments
 (0)