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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.gallery3d.picasasource;
import com.android.gallery3d.app.GalleryApp;
import com.android.gallery3d.data.MediaObject;
import com.android.gallery3d.data.MediaSet;
import com.android.gallery3d.data.MediaSource;
import com.android.gallery3d.data.Path;
import com.android.gallery3d.data.PathMatcher;
import android.content.Context;
import android.os.ParcelFileDescriptor;
import java.io.FileNotFoundException;
public class PicasaSource extends MediaSource {
private static final String TAG = "PicasaSource";
private static final int NO_MATCH = -1;
private static final int IMAGE_MEDIA_ID = 1;
private static final int PICASA_ALBUMSET = 0;
private static final int MAP_BATCH_COUNT = 100;
private GalleryApp mApplication;
private PathMatcher mMatcher;
public static final Path ALBUM_PATH = Path.fromString("/picasa/all");
public PicasaSource(GalleryApp application) {
super("picasa");
mApplication = application;
mMatcher = new PathMatcher();
mMatcher.add("/picasa/all", PICASA_ALBUMSET);
mMatcher.add("/picasa/image", PICASA_ALBUMSET);
mMatcher.add("/picasa/video", PICASA_ALBUMSET);
}
private static class EmptyAlbumSet extends MediaSet {
public EmptyAlbumSet(Path path, long version) {
super(path, version);
}
@Override
public String getName() {
return "picasa";
}
@Override
public long reload() {
return mDataVersion;
}
}
@Override
public MediaObject createMediaObject(Path path) {
switch (mMatcher.match(path)) {
case PICASA_ALBUMSET:
return new EmptyAlbumSet(path, MediaObject.nextVersionNumber());
default:
throw new RuntimeException("bad path: " + path);
}
}
public static boolean isPicasaImage(MediaObject object) {
return false;
}
public static String getImageTitle(MediaObject image) {
throw new UnsupportedOperationException();
}
public static int getImageSize(MediaObject image) {
throw new UnsupportedOperationException();
}
public static String getContentType(MediaObject image) {
throw new UnsupportedOperationException();
}
public static long getDateTaken(MediaObject image) {
throw new UnsupportedOperationException();
}
public static double getLatitude(MediaObject image) {
throw new UnsupportedOperationException();
}
public static double getLongitude(MediaObject image) {
throw new UnsupportedOperationException();
}
public static int getRotation(MediaObject image) {
throw new UnsupportedOperationException();
}
public static ParcelFileDescriptor openFile(Context context, MediaObject image, String mode)
throws FileNotFoundException {
throw new UnsupportedOperationException();
}
public static void initialize(Context context) {/*do nothing*/}
public static void requestSync(Context context) {/*do nothing*/}
public static void onPackageAdded(Context context, String packageName) {/*do nothing*/}
public static void onPackageRemoved(Context context, String packageName) {/*do nothing*/}
}
|