display an empty properties dialog on info click
This commit is contained in:
parent
1be4ccb92e
commit
3b9c6971fe
|
@ -313,7 +313,7 @@ public class ItemsFragment extends android.support.v4.app.Fragment
|
|||
MenuItem menuItem = menu.findItem(R.id.cab_rename);
|
||||
menuItem.setVisible(mSelectedItemsCnt == 1);
|
||||
|
||||
menuItem = menu.findItem(R.id.cab_info);
|
||||
menuItem = menu.findItem(R.id.cab_properties);
|
||||
menuItem.setVisible(mSelectedItemsCnt == 1);
|
||||
|
||||
return true;
|
||||
|
@ -325,8 +325,8 @@ public class ItemsFragment extends android.support.v4.app.Fragment
|
|||
case R.id.cab_rename:
|
||||
displayRenameDialog();
|
||||
break;
|
||||
case R.id.cab_info:
|
||||
displayInfoDialog();
|
||||
case R.id.cab_properties:
|
||||
displayPropertiesDialog();
|
||||
break;
|
||||
case R.id.cab_share:
|
||||
shareFiles();
|
||||
|
@ -369,24 +369,33 @@ public class ItemsFragment extends android.support.v4.app.Fragment
|
|||
startActivity(Intent.createChooser(sendIntent, shareTitle));
|
||||
}
|
||||
|
||||
private void displayInfoDialog() {
|
||||
private void displayPropertiesDialog() {
|
||||
final FileDirItem item = getSelectedItem();
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
final int title = (item.getIsDirectory()) ? R.string.directory_properties : R.string.file_properties;
|
||||
|
||||
final View infoView = getActivity().getLayoutInflater().inflate(R.layout.item_info, null);
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
builder.setTitle(getResources().getString(title));
|
||||
builder.setView(infoView);
|
||||
builder.setPositiveButton(R.string.ok, null);
|
||||
builder.create().show();
|
||||
}
|
||||
|
||||
private void displayRenameDialog() {
|
||||
final List<Integer> itemIndexes = getSelectedItemIndexes();
|
||||
if (itemIndexes.isEmpty())
|
||||
final FileDirItem item = getSelectedItem();
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
final int itemIndex = itemIndexes.get(0);
|
||||
final FileDirItem item = mItems.get(itemIndex);
|
||||
final View renameView = getActivity().getLayoutInflater().inflate(R.layout.rename_item, null);
|
||||
final EditText itemName = (EditText) renameView.findViewById(R.id.item_name);
|
||||
itemName.setText(item.getName());
|
||||
|
||||
final int renameString = (item.getIsDirectory()) ? R.string.rename_directory : R.string.rename_file;
|
||||
final int title = (item.getIsDirectory()) ? R.string.rename_directory : R.string.rename_file;
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
builder.setTitle(getResources().getString(renameString));
|
||||
builder.setTitle(getResources().getString(title));
|
||||
builder.setView(renameView);
|
||||
builder.setPositiveButton(R.string.ok, null);
|
||||
builder.setNegativeButton(R.string.cancel, null);
|
||||
|
@ -487,6 +496,15 @@ public class ItemsFragment extends android.support.v4.app.Fragment
|
|||
});
|
||||
}
|
||||
|
||||
private FileDirItem getSelectedItem() {
|
||||
final List<Integer> itemIndexes = getSelectedItemIndexes();
|
||||
if (itemIndexes.isEmpty())
|
||||
return null;
|
||||
|
||||
final int itemIndex = itemIndexes.get(0);
|
||||
return mItems.get(itemIndex);
|
||||
}
|
||||
|
||||
private List<Integer> getSelectedItemIndexes() {
|
||||
final List<Integer> selectedItems = new ArrayList<>();
|
||||
final SparseBooleanArray items = mListView.getCheckedItemPositions();
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
android:id="@+id/dialog_holder"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/activity_margin">
|
||||
|
||||
</LinearLayout>
|
|
@ -2,9 +2,9 @@
|
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/cab_info"
|
||||
android:id="@+id/cab_properties"
|
||||
android:icon="@mipmap/info"
|
||||
android:title="@string/info"
|
||||
android:title="@string/properties"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/cab_rename"
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<string name="delete">Löschen</string>
|
||||
<string name="undo">Rückgängig</string>
|
||||
<string name="rename">Umbenennen</string>
|
||||
<string name="info">Info</string>
|
||||
<string name="properties">Properties</string>
|
||||
<string name="copy">Kopieren</string>
|
||||
<string name="copy_move">Copy/Move</string>
|
||||
<string name="share">Teilen</string>
|
||||
|
@ -34,6 +34,8 @@
|
|||
<string name="initial_breadcrumb">home</string>
|
||||
<string name="ok">OK</string>
|
||||
<string name="cancel">Abbrechen</string>
|
||||
<string name="file_properties">File properties</string>
|
||||
<string name="directory_properties">Directory properties</string>
|
||||
|
||||
<plurals name="items_deleted">
|
||||
<item quantity="one">1 Datei/Ordner gelöscht</item>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<string name="delete">Elimina</string>
|
||||
<string name="undo">Annulla</string>
|
||||
<string name="rename">Rinomina</string>
|
||||
<string name="info">Info</string>
|
||||
<string name="properties">Properties</string>
|
||||
<string name="copy">Copia</string>
|
||||
<string name="copy_move">Copy/Move</string>
|
||||
<string name="share">Condividi</string>
|
||||
|
@ -34,6 +34,8 @@
|
|||
<string name="initial_breadcrumb">home</string>
|
||||
<string name="ok">OK</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="file_properties">File properties</string>
|
||||
<string name="directory_properties">Directory properties</string>
|
||||
|
||||
<plurals name="items_deleted">
|
||||
<item quantity="one">1 elemento eliminato</item>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<string name="delete">削除</string>
|
||||
<string name="undo">元に戻す</string>
|
||||
<string name="rename">名前を変更</string>
|
||||
<string name="info">Info</string>
|
||||
<string name="properties">Properties</string>
|
||||
<string name="copy">コピー</string>
|
||||
<string name="copy_move">Copy/Move</string>
|
||||
<string name="share">Dela</string>
|
||||
|
@ -34,6 +34,8 @@
|
|||
<string name="initial_breadcrumb">ホーム</string>
|
||||
<string name="ok">OK</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="file_properties">File properties</string>
|
||||
<string name="directory_properties">Directory properties</string>
|
||||
|
||||
<plurals name="items_deleted">
|
||||
<item quantity="one">1 アイテムを削除しました</item>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<string name="delete">Ta bort</string>
|
||||
<string name="undo">Ångra</string>
|
||||
<string name="rename">Döp om</string>
|
||||
<string name="info">Info</string>
|
||||
<string name="properties">Properties</string>
|
||||
<string name="copy">Kopiera</string>
|
||||
<string name="copy_move">Copy/Move</string>
|
||||
<string name="share">Dela</string>
|
||||
|
@ -34,6 +34,8 @@
|
|||
<string name="initial_breadcrumb">home</string>
|
||||
<string name="ok">OK</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="file_properties">File properties</string>
|
||||
<string name="directory_properties">Directory properties</string>
|
||||
|
||||
<plurals name="items_deleted">
|
||||
<item quantity="one">1 objekt borttagen</item>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<string name="delete">Delete</string>
|
||||
<string name="undo">Undo</string>
|
||||
<string name="rename">Rename</string>
|
||||
<string name="info">Info</string>
|
||||
<string name="properties">Properties</string>
|
||||
<string name="copy">Copy</string>
|
||||
<string name="copy_move">Copy/Move</string>
|
||||
<string name="share">Share</string>
|
||||
|
@ -34,6 +34,8 @@
|
|||
<string name="initial_breadcrumb">home</string>
|
||||
<string name="ok">OK</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="file_properties">File properties</string>
|
||||
<string name="directory_properties">Directory properties</string>
|
||||
|
||||
<plurals name="items_deleted">
|
||||
<item quantity="one">1 item deleted</item>
|
||||
|
|
Loading…
Reference in New Issue