From 65fd2492b94274d540dd3142081b79dff45f2176 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Thu, 31 May 2012 18:25:11 -0700 Subject: [PATCH] Minor fixes to file display --- .../astrid/actfm/sync/ActFmSyncService.java | 2 +- .../com/todoroo/astrid/files/FilesControlSet.java | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java index 9e616120b..4a1b4bb65 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java @@ -1149,7 +1149,7 @@ public final class ActFmSyncService { } } catch (JSONException e) { - // Ignored + e.printStackTrace(); } finally { attachments.close(); } diff --git a/astrid/plugin-src/com/todoroo/astrid/files/FilesControlSet.java b/astrid/plugin-src/com/todoroo/astrid/files/FilesControlSet.java index cb0d5ab9b..0078e3714 100644 --- a/astrid/plugin-src/com/todoroo/astrid/files/FilesControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/files/FilesControlSet.java @@ -141,7 +141,7 @@ public class FilesControlSet extends PopupControlSet { } private void setupFileClickListener(View view, final Metadata m) { - String fileType = m.containsNonNullValue(FileMetadata.FILE_TYPE) ? m.getValue(FileMetadata.FILE_TYPE) : FileMetadata.FILE_TYPE_OTHER; + final String fileType = m.containsNonNullValue(FileMetadata.FILE_TYPE) ? m.getValue(FileMetadata.FILE_TYPE) : FileMetadata.FILE_TYPE_OTHER; final String filePath = m.containsNonNullValue(FileMetadata.FILE_PATH) ? m.getValue(FileMetadata.FILE_PATH) : null; if (TextUtils.isEmpty(filePath)) { view.setOnClickListener(new OnClickListener() { @@ -283,13 +283,14 @@ public class FilesControlSet extends PopupControlSet { } } }.start(); + pd.show(); } private void setUpFileRow(Metadata m, View row, LinearLayout parent, LayoutParams lp) { TextView nameView = (TextView) row.findViewById(R.id.file_text); TextView typeView = (TextView) row.findViewById(R.id.file_type); String name = getNameString(m); - String type = getTypeString(m); + String type = getTypeString(name); nameView.setText(name); if (TextUtils.isEmpty(type)) @@ -309,15 +310,7 @@ public class FilesControlSet extends PopupControlSet { } @SuppressWarnings("nls") - private String getTypeString(Metadata metadata) { - String name; - if (metadata.containsNonNullValue(FileMetadata.FILE_PATH)) { - File f = new File(metadata.getValue(FileMetadata.FILE_PATH)); - name = f.getName(); - } else { - name = metadata.getValue(FileMetadata.URL); - } - + private String getTypeString(String name) { int extension = name.lastIndexOf('.'); if (extension < 0 || extension + 1 >= name.length()) return "";