質問編集履歴

1

修正

2017/06/20 01:55

投稿

quu
quu

スコア8

test CHANGED
File without changes
test CHANGED
@@ -56,6 +56,264 @@
56
56
 
57
57
  }
58
58
 
59
+
60
+
61
+ class UploadedItem : Parcelable {
62
+
63
+
64
+
65
+ override fun equals(obj: Any?): Boolean {
66
+
67
+ return obj is UploadedItem && obj.hashCode() == this.hashCode()
68
+
69
+ }
70
+
71
+
72
+
73
+ override fun hashCode(): Int {
74
+
75
+ return if (localFile != null) localFile!!.absolutePath.hashCode() else uploadId.toInt()
76
+
77
+ }
78
+
79
+
80
+
81
+ val extension: String
82
+
83
+ get() {
84
+
85
+ if (this.type != null) {
86
+
87
+ if (this.type!!.contains("uploadItem")) {
88
+
89
+ if (this.type!!.contains("jpeg")) {
90
+
91
+ return "jpg"
92
+
93
+ } else if (this.type!!.contains("gif")) {
94
+
95
+ return "gif"
96
+
97
+ } else if (this.type!!.contains("png")) {
98
+
99
+ return "png"
100
+
101
+ }
102
+
103
+ }
104
+
105
+ }
106
+
107
+ return "jpg"
108
+
109
+ }
110
+
111
+
112
+
113
+ var uploadId: Long = 0
114
+
115
+ var thumbUrl: String? = null
116
+
117
+ var imageUrl: String? = null
118
+
119
+ var originalUrl: String? = null
120
+
121
+ var type: String? = null
122
+
123
+ var size: Int = 0
124
+
125
+ var width: Int = 0
126
+
127
+ var height: Int = 0
128
+
129
+ var latitude: Double = 0.toDouble()
130
+
131
+ var longitude: Double = 0.toDouble()
132
+
133
+ var altitude: String? = null
134
+
135
+ var comment: String? = null
136
+
137
+ var takenTime: String? = null
138
+
139
+ var uploadTime: String? = null
140
+
141
+ var uploader: User? = null
142
+
143
+ var localFile: File? = null
144
+
145
+
146
+
147
+ constructor(localFile: File) {
148
+
149
+ this.localFile = localFile
150
+
151
+ }
152
+
153
+
154
+
155
+ override fun toString(): String {
156
+
157
+ return "UploadedItem{" +
158
+
159
+ "uploadId=" + uploadId +
160
+
161
+ ", thumbUrl='" + thumbUrl + '\'' +
162
+
163
+ ", imageUrl='" + imageUrl + '\'' +
164
+
165
+ ", originalUrl='" + originalUrl + '\'' +
166
+
167
+ ", type='" + type + '\'' +
168
+
169
+ ", size=" + size +
170
+
171
+ ", width=" + width +
172
+
173
+ ", height=" + height +
174
+
175
+ ", latitude=" + latitude +
176
+
177
+ ", longitude=" + longitude +
178
+
179
+ ", altitude='" + altitude + '\'' +
180
+
181
+ ", comment='" + comment + '\'' +
182
+
183
+ ", takenTime='" + takenTime + '\'' +
184
+
185
+ ", uploadTime='" + uploadTime + '\'' +
186
+
187
+ ", uploader=" + uploader +
188
+
189
+ ", localFile=" + localFile +
190
+
191
+ '}'
192
+
193
+ }
194
+
195
+
196
+
197
+ constructor() {}
198
+
199
+
200
+
201
+ override fun describeContents(): Int {
202
+
203
+ return 0
204
+
205
+ }
206
+
207
+
208
+
209
+ override fun writeToParcel(dest: Parcel, flags: Int) {
210
+
211
+ dest.writeLong(this.uploadId)
212
+
213
+ dest.writeString(this.thumbUrl)
214
+
215
+ dest.writeString(this.imageUrl)
216
+
217
+ dest.writeString(this.originalUrl)
218
+
219
+ dest.writeString(this.type)
220
+
221
+ dest.writeInt(this.size)
222
+
223
+ dest.writeInt(this.width)
224
+
225
+ dest.writeInt(this.height)
226
+
227
+ dest.writeDouble(this.latitude)
228
+
229
+ dest.writeDouble(this.longitude)
230
+
231
+ dest.writeString(this.altitude)
232
+
233
+ dest.writeString(this.comment)
234
+
235
+ dest.writeString(this.takenTime)
236
+
237
+ dest.writeString(this.uploadTime)
238
+
239
+ dest.writeParcelable(this.uploader, flags)
240
+
241
+ dest.writeSerializable(this.localFile)
242
+
243
+ }
244
+
245
+
246
+
247
+ protected constructor(`in`: Parcel) {
248
+
249
+ this.uploadId = `in`.readLong()
250
+
251
+ this.thumbUrl = `in`.readString()
252
+
253
+ this.imageUrl = `in`.readString()
254
+
255
+ this.originalUrl = `in`.readString()
256
+
257
+ this.type = `in`.readString()
258
+
259
+ this.size = `in`.readInt()
260
+
261
+ this.width = `in`.readInt()
262
+
263
+ this.height = `in`.readInt()
264
+
265
+ this.latitude = `in`.readDouble()
266
+
267
+ this.longitude = `in`.readDouble()
268
+
269
+ this.altitude = `in`.readString()
270
+
271
+ this.comment = `in`.readString()
272
+
273
+ this.takenTime = `in`.readString()
274
+
275
+ this.uploadTime = `in`.readString()
276
+
277
+ this.uploader = `in`.readParcelable<User>(User::class.java.getClassLoader())
278
+
279
+ this.localFile = `in`.readSerializable() as? File
280
+
281
+ }
282
+
283
+
284
+
285
+ companion object {
286
+
287
+
288
+
289
+ val TAG = "Upload"
290
+
291
+
292
+
293
+ @JvmField
294
+
295
+ val CREATOR: Parcelable.Creator<UploadedItem> = object : Parcelable.Creator<UploadedItem> {
296
+
297
+ override fun createFromParcel(source: Parcel): UploadedItem {
298
+
299
+ return UploadedItem(source)
300
+
301
+ }
302
+
303
+
304
+
305
+ override fun newArray(size: Int): Array<UploadedItem?> {
306
+
307
+ return arrayOfNulls(size)
308
+
309
+ }
310
+
311
+ }
312
+
313
+ }
314
+
315
+ }
316
+
59
317
  ```
60
318
 
61
319