display property placeholders on the dialog

This commit is contained in:
tibbi 2016-09-06 20:42:42 +02:00
parent 3b9c6971fe
commit 3aaa5308ed
5 changed files with 134 additions and 18 deletions

View File

@ -0,0 +1,36 @@
package com.simplemobiletools.filemanager.dialogs;
import android.app.Dialog;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.view.View;
import com.simplemobiletools.filemanager.R;
import com.simplemobiletools.filemanager.models.FileDirItem;
public class PropertiesDialog extends DialogFragment {
private static FileDirItem mItem;
public static PropertiesDialog newInstance(FileDirItem item) {
mItem = item;
return new PropertiesDialog();
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final int title = (mItem.getIsDirectory()) ? R.string.directory_properties : R.string.file_properties;
final View infoView = getActivity().getLayoutInflater().inflate(R.layout.item_properties, null);
if (mItem.getIsDirectory()) {
infoView.findViewById(R.id.properties_files_count_label).setVisibility(View.VISIBLE);
infoView.findViewById(R.id.properties_files_count).setVisibility(View.VISIBLE);
}
final AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setTitle(getResources().getString(title));
builder.setView(infoView);
builder.setPositiveButton(R.string.ok, null);
return builder.create();
}
}

View File

@ -36,6 +36,7 @@ import com.simplemobiletools.filemanager.R;
import com.simplemobiletools.filemanager.Utils;
import com.simplemobiletools.filemanager.adapters.ItemsAdapter;
import com.simplemobiletools.filemanager.asynctasks.CopyTask;
import com.simplemobiletools.filemanager.dialogs.PropertiesDialog;
import com.simplemobiletools.filemanager.dialogs.SelectFolderDialog;
import com.simplemobiletools.filemanager.models.FileDirItem;
@ -374,14 +375,8 @@ public class ItemsFragment extends android.support.v4.app.Fragment
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();
PropertiesDialog dialog = PropertiesDialog.newInstance(item);
dialog.show(getFragmentManager(), "properties");
}
private void displayRenameDialog() {

View File

@ -1,10 +0,0 @@
<?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>

View File

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/properties_holder"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin">
<TextView
android:id="@+id/properties_name_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/name"
android:textSize="@dimen/details_text_size"/>
<TextView
android:id="@+id/properties_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/small_margin"
android:textColor="@android:color/black"/>
<TextView
android:id="@+id/properties_path_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_margin"
android:text="@string/path"
android:textSize="@dimen/details_text_size"/>
<TextView
android:id="@+id/properties_path"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/small_margin"
android:textColor="@android:color/black"/>
<TextView
android:id="@+id/properties_size_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_margin"
android:text="@string/size"
android:textSize="@dimen/details_text_size"/>
<TextView
android:id="@+id/properties_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/small_margin"
android:textColor="@android:color/black"/>
<TextView
android:id="@+id/properties_last_modified_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_margin"
android:text="@string/last_modified"
android:textSize="@dimen/details_text_size"/>
<TextView
android:id="@+id/properties_last_modified"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/small_margin"
android:textColor="@android:color/black"/>
<TextView
android:id="@+id/properties_files_count_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_margin"
android:text="@string/files_count"
android:textSize="@dimen/details_text_size"
android:visibility="gone"/>
<TextView
android:id="@+id/properties_files_count"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/small_margin"
android:textColor="@android:color/black"
android:visibility="gone"/>
</LinearLayout>

View File

@ -34,8 +34,15 @@
<string name="initial_breadcrumb">home</string>
<string name="ok">OK</string>
<string name="cancel">Cancel</string>
<!-- File and directory properties -->
<string name="file_properties">File properties</string>
<string name="directory_properties">Directory properties</string>
<string name="name">Name</string>
<string name="path">Path</string>
<string name="size">Size</string>
<string name="last_modified">Last modified</string>
<string name="files_count">Files inside</string>
<plurals name="items_deleted">
<item quantity="one">1 item deleted</item>