質問編集履歴
1
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -27,6 +27,135 @@
|
|
27
27
|
|
28
28
|
override fun writeToParcel(dest: Parcel, flags: Int) {}
|
29
29
|
}
|
30
|
+
|
31
|
+
class UploadedItem : Parcelable {
|
32
|
+
|
33
|
+
override fun equals(obj: Any?): Boolean {
|
34
|
+
return obj is UploadedItem && obj.hashCode() == this.hashCode()
|
35
|
+
}
|
36
|
+
|
37
|
+
override fun hashCode(): Int {
|
38
|
+
return if (localFile != null) localFile!!.absolutePath.hashCode() else uploadId.toInt()
|
39
|
+
}
|
40
|
+
|
41
|
+
val extension: String
|
42
|
+
get() {
|
43
|
+
if (this.type != null) {
|
44
|
+
if (this.type!!.contains("uploadItem")) {
|
45
|
+
if (this.type!!.contains("jpeg")) {
|
46
|
+
return "jpg"
|
47
|
+
} else if (this.type!!.contains("gif")) {
|
48
|
+
return "gif"
|
49
|
+
} else if (this.type!!.contains("png")) {
|
50
|
+
return "png"
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
return "jpg"
|
55
|
+
}
|
56
|
+
|
57
|
+
var uploadId: Long = 0
|
58
|
+
var thumbUrl: String? = null
|
59
|
+
var imageUrl: String? = null
|
60
|
+
var originalUrl: String? = null
|
61
|
+
var type: String? = null
|
62
|
+
var size: Int = 0
|
63
|
+
var width: Int = 0
|
64
|
+
var height: Int = 0
|
65
|
+
var latitude: Double = 0.toDouble()
|
66
|
+
var longitude: Double = 0.toDouble()
|
67
|
+
var altitude: String? = null
|
68
|
+
var comment: String? = null
|
69
|
+
var takenTime: String? = null
|
70
|
+
var uploadTime: String? = null
|
71
|
+
var uploader: User? = null
|
72
|
+
var localFile: File? = null
|
73
|
+
|
74
|
+
constructor(localFile: File) {
|
75
|
+
this.localFile = localFile
|
76
|
+
}
|
77
|
+
|
78
|
+
override fun toString(): String {
|
79
|
+
return "UploadedItem{" +
|
80
|
+
"uploadId=" + uploadId +
|
81
|
+
", thumbUrl='" + thumbUrl + '\'' +
|
82
|
+
", imageUrl='" + imageUrl + '\'' +
|
83
|
+
", originalUrl='" + originalUrl + '\'' +
|
84
|
+
", type='" + type + '\'' +
|
85
|
+
", size=" + size +
|
86
|
+
", width=" + width +
|
87
|
+
", height=" + height +
|
88
|
+
", latitude=" + latitude +
|
89
|
+
", longitude=" + longitude +
|
90
|
+
", altitude='" + altitude + '\'' +
|
91
|
+
", comment='" + comment + '\'' +
|
92
|
+
", takenTime='" + takenTime + '\'' +
|
93
|
+
", uploadTime='" + uploadTime + '\'' +
|
94
|
+
", uploader=" + uploader +
|
95
|
+
", localFile=" + localFile +
|
96
|
+
'}'
|
97
|
+
}
|
98
|
+
|
99
|
+
constructor() {}
|
100
|
+
|
101
|
+
override fun describeContents(): Int {
|
102
|
+
return 0
|
103
|
+
}
|
104
|
+
|
105
|
+
override fun writeToParcel(dest: Parcel, flags: Int) {
|
106
|
+
dest.writeLong(this.uploadId)
|
107
|
+
dest.writeString(this.thumbUrl)
|
108
|
+
dest.writeString(this.imageUrl)
|
109
|
+
dest.writeString(this.originalUrl)
|
110
|
+
dest.writeString(this.type)
|
111
|
+
dest.writeInt(this.size)
|
112
|
+
dest.writeInt(this.width)
|
113
|
+
dest.writeInt(this.height)
|
114
|
+
dest.writeDouble(this.latitude)
|
115
|
+
dest.writeDouble(this.longitude)
|
116
|
+
dest.writeString(this.altitude)
|
117
|
+
dest.writeString(this.comment)
|
118
|
+
dest.writeString(this.takenTime)
|
119
|
+
dest.writeString(this.uploadTime)
|
120
|
+
dest.writeParcelable(this.uploader, flags)
|
121
|
+
dest.writeSerializable(this.localFile)
|
122
|
+
}
|
123
|
+
|
124
|
+
protected constructor(`in`: Parcel) {
|
125
|
+
this.uploadId = `in`.readLong()
|
126
|
+
this.thumbUrl = `in`.readString()
|
127
|
+
this.imageUrl = `in`.readString()
|
128
|
+
this.originalUrl = `in`.readString()
|
129
|
+
this.type = `in`.readString()
|
130
|
+
this.size = `in`.readInt()
|
131
|
+
this.width = `in`.readInt()
|
132
|
+
this.height = `in`.readInt()
|
133
|
+
this.latitude = `in`.readDouble()
|
134
|
+
this.longitude = `in`.readDouble()
|
135
|
+
this.altitude = `in`.readString()
|
136
|
+
this.comment = `in`.readString()
|
137
|
+
this.takenTime = `in`.readString()
|
138
|
+
this.uploadTime = `in`.readString()
|
139
|
+
this.uploader = `in`.readParcelable<User>(User::class.java.getClassLoader())
|
140
|
+
this.localFile = `in`.readSerializable() as? File
|
141
|
+
}
|
142
|
+
|
143
|
+
companion object {
|
144
|
+
|
145
|
+
val TAG = "Upload"
|
146
|
+
|
147
|
+
@JvmField
|
148
|
+
val CREATOR: Parcelable.Creator<UploadedItem> = object : Parcelable.Creator<UploadedItem> {
|
149
|
+
override fun createFromParcel(source: Parcel): UploadedItem {
|
150
|
+
return UploadedItem(source)
|
151
|
+
}
|
152
|
+
|
153
|
+
override fun newArray(size: Int): Array<UploadedItem?> {
|
154
|
+
return arrayOfNulls(size)
|
155
|
+
}
|
156
|
+
}
|
157
|
+
}
|
158
|
+
}
|
30
159
|
```
|
31
160
|
|
32
161
|
constructorに何を記述すべきなのか教えてください。
|