show an empty dialog at pressing Properties with multiple items selected

This commit is contained in:
tibbi 2016-10-16 22:19:48 +02:00
parent 1b4ff76566
commit 592b9c1f70
2 changed files with 23 additions and 5 deletions

View file

@ -392,7 +392,7 @@ public class ItemsFragment extends android.support.v4.app.Fragment
if (itemIndexes.size() == 1) {
showOneItemProperties();
} else {
showMultipleItemProperties();
showMultipleItemProperties(itemIndexes);
}
}
@ -404,8 +404,12 @@ public class ItemsFragment extends android.support.v4.app.Fragment
new PropertiesDialog(getContext(), item.getPath(), mConfig.getShowHidden());
}
private void showMultipleItemProperties() {
private void showMultipleItemProperties(List<Integer> itemIndexes) {
final List<String> paths = new ArrayList<>(itemIndexes.size());
for (int i : itemIndexes) {
paths.add(mItems.get(i).getPath());
}
new PropertiesDialog(getContext(), paths, mConfig.getShowHidden());
}
private void displayRenameDialog() {

View file

@ -26,10 +26,9 @@ class PropertiesDialog() {
mCountHiddenItems = countHiddenItems
mInflater = LayoutInflater.from(context)
mResources = mContext.resources
val file = File(path)
mPropertyView = mInflater.inflate(R.layout.item_properties, null) as ViewGroup
val file = File(path)
addProperty(R.string.name, file.name)
addProperty(R.string.path, file.parent)
addProperty(R.string.size, getItemSize(file))
@ -54,6 +53,21 @@ class PropertiesDialog() {
.show()
}
constructor(context: Context, paths: List<String>, countHiddenItems: Boolean = false) : this() {
mContext = context
mCountHiddenItems = countHiddenItems
mInflater = LayoutInflater.from(context)
mResources = mContext.resources
mPropertyView = mInflater.inflate(R.layout.item_properties, null) as ViewGroup
AlertDialog.Builder(context)
.setTitle(mResources.getString(R.string.properties))
.setView(mPropertyView)
.setPositiveButton(R.string.ok, null)
.create()
.show()
}
private fun addProperty(labelId: Int, value: String) {
val view = mInflater.inflate(R.layout.property_item, mPropertyView, false)
view.property_label.text = mResources.getString(labelId)