blob: 37c4a08ae5453bf1ff356128dea77d8d36f92169 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
package org.fox.ttrss;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import android.os.Parcel;
import android.os.Parcelable;
public class Attachment implements Parcelable {
int id;
String content_url;
String content_type;
String title;
String duration;
int post_id;
public Attachment(Parcel in) {
readFromParcel(in);
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeInt(id);
out.writeString(content_url);
out.writeString(content_type);
out.writeString(title);
out.writeString(duration);
out.writeInt(post_id);
}
public String toString() {
if (title != null && title.length() > 0) {
return title;
} else {
try {
URL url = new URL(content_url.trim());
return new File(url.getFile()).getName();
} catch (MalformedURLException e) {
return content_url;
}
}
}
public void readFromParcel(Parcel in) {
id = in.readInt();
content_url = in.readString();
content_type = in.readString();
title = in.readString();
duration = in.readString();
post_id = in.readInt();
}
@SuppressWarnings("rawtypes")
public static final Parcelable.Creator CREATOR =
new Parcelable.Creator() {
public Attachment createFromParcel(Parcel in) {
return new Attachment(in);
}
public Attachment[] newArray(int size) {
return new Attachment[size];
}
};
}
|