Fixed a bunch more naming issues

pull/14/head
Sam Bosley 13 years ago
parent 0f9d4dc225
commit 8a2d74d505

@ -1127,11 +1127,10 @@ public final class ActFmSyncService {
currentFiles.remove(id); currentFiles.remove(id);
} else { } else {
// Create new file attachment // Create new file attachment
System.err.println("Got name: " + file.getString("name"));
Metadata newAttachment = FileMetadata.createNewFileMetadata(model.getId(), null, Metadata newAttachment = FileMetadata.createNewFileMetadata(model.getId(), null,
file.getString("name"), file.getString("content_type")); file.getString("name"), file.getString("content_type"));
String url = file.getString("url"); String url = file.getString("url");
if (url.contains("?"))
url = url.substring(0, url.lastIndexOf('?'));
newAttachment.setValue(FileMetadata.URL, url); newAttachment.setValue(FileMetadata.URL, url);
newAttachment.setValue(FileMetadata.REMOTE_ID, id); newAttachment.setValue(FileMetadata.REMOTE_ID, id);
metadataService.save(newAttachment); metadataService.save(newAttachment);

@ -203,15 +203,7 @@ public class FilesControlSet extends PopupControlSet {
@Override @Override
public void run() { public void run() {
String urlString = m.getValue(FileMetadata.URL); String urlString = m.getValue(FileMetadata.URL);
String name; String name = m.getValue(FileMetadata.NAME);
if (urlString.endsWith("/"))
urlString = urlString.substring(0, urlString.length() - 1);
int lastComponent = urlString.lastIndexOf('/');
if (lastComponent > 0)
name = urlString.substring(lastComponent + 1);
else
name = urlString;
StringBuilder filePathBuilder = new StringBuilder(); StringBuilder filePathBuilder = new StringBuilder();
filePathBuilder.append(activity.getExternalFilesDir(FileMetadata.FILES_DIRECTORY).toString()) filePathBuilder.append(activity.getExternalFilesDir(FileMetadata.FILES_DIRECTORY).toString())
.append(File.separator) .append(File.separator)
@ -290,7 +282,7 @@ public class FilesControlSet extends PopupControlSet {
TextView nameView = (TextView) row.findViewById(R.id.file_text); TextView nameView = (TextView) row.findViewById(R.id.file_text);
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(name); String type = getTypeString(m.getValue(FileMetadata.NAME));
nameView.setText(name); nameView.setText(name);
if (TextUtils.isEmpty(type)) if (TextUtils.isEmpty(type))

Loading…
Cancel
Save