Polish the files control set

pull/14/head
Sam Bosley 12 years ago
parent 487128e6f2
commit 3cd115b92f

@ -21,7 +21,6 @@ import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.net.Uri; import android.net.Uri;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@ -49,6 +48,7 @@ import com.todoroo.astrid.data.RemoteModel;
import com.todoroo.astrid.data.SyncFlags; import com.todoroo.astrid.data.SyncFlags;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.data.TaskAttachment; import com.todoroo.astrid.data.TaskAttachment;
import com.todoroo.astrid.service.ThemeService;
import com.todoroo.astrid.ui.PopupControlSet; import com.todoroo.astrid.ui.PopupControlSet;
import com.todoroo.astrid.utility.Constants; import com.todoroo.astrid.utility.Constants;
@ -61,22 +61,28 @@ public class FilesControlSet extends PopupControlSet {
private final LinearLayout fileDisplayList; private final LinearLayout fileDisplayList;
private LinearLayout fileList; private LinearLayout fileList;
private final LayoutInflater inflater; private final LayoutInflater inflater;
private final ImageView image;
public FilesControlSet(Activity activity, int viewLayout, int displayViewLayout, int title) { public FilesControlSet(Activity activity, int viewLayout, int displayViewLayout, int title) {
super(activity, viewLayout, displayViewLayout, title); super(activity, viewLayout, displayViewLayout, title);
DependencyInjectionService.getInstance().inject(this); DependencyInjectionService.getInstance().inject(this);
fileDisplayList = (LinearLayout) getDisplayView().findViewById(R.id.files_list); fileDisplayList = (LinearLayout) getDisplayView().findViewById(R.id.files_list);
image = (ImageView) getDisplayView().findViewById(R.id.display_row_icon);
inflater = (LayoutInflater) activity.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); inflater = (LayoutInflater) activity.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
} }
@Override @Override
protected void refreshDisplayView() { protected void refreshDisplayView() {
fileDisplayList.removeAllViews(); fileDisplayList.removeAllViews();
if (files != null && files.size() > 0) {
image.setImageResource(ThemeService.getTaskEditDrawable(R.drawable.tea_icn_edit, R.drawable.tea_icn_edit_lightblue));
} else {
image.setImageResource(R.drawable.tea_icn_edit_gray);
}
for (final TaskAttachment m : files) { for (final TaskAttachment m : files) {
View fileRow = inflater.inflate(R.layout.file_display_row, null); View fileRow = inflater.inflate(R.layout.file_display_row, null);
LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); LayoutParams lp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
lp.gravity = Gravity.RIGHT;
setUpFileRow(m, fileRow, fileDisplayList, lp); setUpFileRow(m, fileRow, fileDisplayList, lp);
} }
} }
@ -402,6 +408,7 @@ public class FilesControlSet extends PopupControlSet {
private void setUpFileRow(TaskAttachment m, View row, LinearLayout parent, LayoutParams lp) { private void setUpFileRow(TaskAttachment m, View row, LinearLayout parent, LayoutParams lp) {
TextView nameView = (TextView) row.findViewById(R.id.file_text); TextView nameView = (TextView) row.findViewById(R.id.file_text);
nameView.setTextColor(themeColor);
TextView typeView = (TextView) row.findViewById(R.id.file_type); TextView typeView = (TextView) row.findViewById(R.id.file_type);
String name = getNameString(m); String name = getNameString(m);
String type = getTypeString(m.getValue(TaskAttachment.NAME)); String type = getTypeString(m.getValue(TaskAttachment.NAME));

@ -18,20 +18,17 @@
android:paddingLeft="10dip" android:paddingLeft="10dip"
android:paddingRight="10dip" android:paddingRight="10dip"
android:gravity="center_vertical"> android:gravity="center_vertical">
<ImageView android:id="@+id/display_row_icon"
<TextView
android:id="@+id/display_row_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dip" android:layout_marginRight="10dip"
style="@style/TextAppearance.GEN_EditLabel" /> android:layout_width="20dip"
android:layout_height="20dip"
android:scaleType="fitCenter"/>
<LinearLayout <LinearLayout
android:id="@+id/files_list" android:id="@+id/files_list"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:gravity="right" android:gravity="left"
android:paddingLeft="10dip"
android:paddingTop="5dip" android:paddingTop="5dip"
android:paddingBottom="5dip" android:paddingBottom="5dip"
android:orientation="vertical"/> android:orientation="vertical"/>

@ -5,14 +5,14 @@
** See the file "LICENSE" for the full license governing this code. ** See the file "LICENSE" for the full license governing this code.
--> -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" > android:orientation="horizontal" >
<TextView <TextView
android:id="@+id/file_text" android:id="@+id/file_text"
android:layout_width="wrap_content" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:maxLines="1" android:maxLines="1"

@ -18,9 +18,10 @@
android:layout_marginBottom="5dip" android:layout_marginBottom="5dip"
android:layout_marginLeft="10dip" android:layout_marginLeft="10dip"
android:paddingRight="5dip" android:paddingRight="5dip"
android:paddingLeft="3dip"
android:layout_weight="1" android:layout_weight="1"
android:textAppearance="@style/TextAppearance.EditRowDisplay" android:textAppearance="@style/TextAppearance.EditRowDisplay"
android:gravity="right|center_vertical"/> android:gravity="left|center_vertical"/>
<TextView <TextView
android:id="@+id/file_type" android:id="@+id/file_type"
android:minWidth="37dip" android:minWidth="37dip"

Loading…
Cancel
Save