Skip to content

Commit 3aaa530

Browse files
committed
display property placeholders on the dialog
1 parent 3b9c697 commit 3aaa530

File tree

5 files changed

+134
-18
lines changed

5 files changed

+134
-18
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.simplemobiletools.filemanager.dialogs;
2+
3+
import android.app.Dialog;
4+
import android.os.Bundle;
5+
import android.support.v4.app.DialogFragment;
6+
import android.support.v7.app.AlertDialog;
7+
import android.view.View;
8+
9+
import com.simplemobiletools.filemanager.R;
10+
import com.simplemobiletools.filemanager.models.FileDirItem;
11+
12+
public class PropertiesDialog extends DialogFragment {
13+
private static FileDirItem mItem;
14+
15+
public static PropertiesDialog newInstance(FileDirItem item) {
16+
mItem = item;
17+
return new PropertiesDialog();
18+
}
19+
20+
@Override
21+
public Dialog onCreateDialog(Bundle savedInstanceState) {
22+
final int title = (mItem.getIsDirectory()) ? R.string.directory_properties : R.string.file_properties;
23+
24+
final View infoView = getActivity().getLayoutInflater().inflate(R.layout.item_properties, null);
25+
if (mItem.getIsDirectory()) {
26+
infoView.findViewById(R.id.properties_files_count_label).setVisibility(View.VISIBLE);
27+
infoView.findViewById(R.id.properties_files_count).setVisibility(View.VISIBLE);
28+
}
29+
final AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
30+
builder.setTitle(getResources().getString(title));
31+
builder.setView(infoView);
32+
builder.setPositiveButton(R.string.ok, null);
33+
34+
return builder.create();
35+
}
36+
}

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import com.simplemobiletools.filemanager.Utils;
3737
import com.simplemobiletools.filemanager.adapters.ItemsAdapter;
3838
import com.simplemobiletools.filemanager.asynctasks.CopyTask;
39+
import com.simplemobiletools.filemanager.dialogs.PropertiesDialog;
3940
import com.simplemobiletools.filemanager.dialogs.SelectFolderDialog;
4041
import com.simplemobiletools.filemanager.models.FileDirItem;
4142

@@ -374,14 +375,8 @@ private void displayPropertiesDialog() {
374375
if (item == null)
375376
return;
376377

377-
final int title = (item.getIsDirectory()) ? R.string.directory_properties : R.string.file_properties;
378-
379-
final View infoView = getActivity().getLayoutInflater().inflate(R.layout.item_info, null);
380-
final AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
381-
builder.setTitle(getResources().getString(title));
382-
builder.setView(infoView);
383-
builder.setPositiveButton(R.string.ok, null);
384-
builder.create().show();
378+
PropertiesDialog dialog = PropertiesDialog.newInstance(item);
379+
dialog.show(getFragmentManager(), "properties");
385380
}
386381

387382
private void displayRenameDialog() {

app/src/main/res/layout/item_info.xml

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout
3+
android:id="@+id/properties_holder"
4+
xmlns:android="http://schemas.android.com/apk/res/android"
5+
android:layout_width="match_parent"
6+
android:layout_height="match_parent"
7+
android:orientation="vertical"
8+
android:paddingLeft="@dimen/activity_margin"
9+
android:paddingRight="@dimen/activity_margin"
10+
android:paddingTop="@dimen/activity_margin">
11+
12+
<TextView
13+
android:id="@+id/properties_name_label"
14+
android:layout_width="match_parent"
15+
android:layout_height="wrap_content"
16+
android:text="@string/name"
17+
android:textSize="@dimen/details_text_size"/>
18+
19+
<TextView
20+
android:id="@+id/properties_name"
21+
android:layout_width="match_parent"
22+
android:layout_height="wrap_content"
23+
android:padding="@dimen/small_margin"
24+
android:textColor="@android:color/black"/>
25+
26+
<TextView
27+
android:id="@+id/properties_path_label"
28+
android:layout_width="match_parent"
29+
android:layout_height="wrap_content"
30+
android:layout_marginTop="@dimen/activity_margin"
31+
android:text="@string/path"
32+
android:textSize="@dimen/details_text_size"/>
33+
34+
<TextView
35+
android:id="@+id/properties_path"
36+
android:layout_width="match_parent"
37+
android:layout_height="wrap_content"
38+
android:padding="@dimen/small_margin"
39+
android:textColor="@android:color/black"/>
40+
41+
<TextView
42+
android:id="@+id/properties_size_label"
43+
android:layout_width="match_parent"
44+
android:layout_height="wrap_content"
45+
android:layout_marginTop="@dimen/activity_margin"
46+
android:text="@string/size"
47+
android:textSize="@dimen/details_text_size"/>
48+
49+
<TextView
50+
android:id="@+id/properties_size"
51+
android:layout_width="match_parent"
52+
android:layout_height="wrap_content"
53+
android:padding="@dimen/small_margin"
54+
android:textColor="@android:color/black"/>
55+
56+
<TextView
57+
android:id="@+id/properties_last_modified_label"
58+
android:layout_width="match_parent"
59+
android:layout_height="wrap_content"
60+
android:layout_marginTop="@dimen/activity_margin"
61+
android:text="@string/last_modified"
62+
android:textSize="@dimen/details_text_size"/>
63+
64+
<TextView
65+
android:id="@+id/properties_last_modified"
66+
android:layout_width="match_parent"
67+
android:layout_height="wrap_content"
68+
android:padding="@dimen/small_margin"
69+
android:textColor="@android:color/black"/>
70+
71+
<TextView
72+
android:id="@+id/properties_files_count_label"
73+
android:layout_width="match_parent"
74+
android:layout_height="wrap_content"
75+
android:layout_marginTop="@dimen/activity_margin"
76+
android:text="@string/files_count"
77+
android:textSize="@dimen/details_text_size"
78+
android:visibility="gone"/>
79+
80+
<TextView
81+
android:id="@+id/properties_files_count"
82+
android:layout_width="match_parent"
83+
android:layout_height="wrap_content"
84+
android:padding="@dimen/small_margin"
85+
android:textColor="@android:color/black"
86+
android:visibility="gone"/>
87+
88+
</LinearLayout>

app/src/main/res/values/strings.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,15 @@
3434
<string name="initial_breadcrumb">home</string>
3535
<string name="ok">OK</string>
3636
<string name="cancel">Cancel</string>
37+
38+
<!-- File and directory properties -->
3739
<string name="file_properties">File properties</string>
3840
<string name="directory_properties">Directory properties</string>
41+
<string name="name">Name</string>
42+
<string name="path">Path</string>
43+
<string name="size">Size</string>
44+
<string name="last_modified">Last modified</string>
45+
<string name="files_count">Files inside</string>
3946

4047
<plurals name="items_deleted">
4148
<item quantity="one">1 item deleted</item>

0 commit comments

Comments
 (0)