1/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.contacts.test.mocks;
18
19import android.graphics.Bitmap;
20import android.net.Uri;
21import android.view.View;
22import android.widget.ImageView;
23
24import com.android.contacts.ContactPhotoManager;
25
26/**
27 * A photo preloader that always uses the "no contact" picture and never executes any real
28 * db queries
29 */
30public class MockContactPhotoManager extends ContactPhotoManager {
31    @Override
32    public void loadThumbnail(ImageView view, long photoId, boolean darkTheme, boolean isCircular,
33            DefaultImageRequest defaultImageRequest, DefaultImageProvider defaultProvider) {
34        defaultProvider.applyDefaultImage(view, -1, darkTheme, null);
35    }
36
37    @Override
38    public void loadPhoto(ImageView view, Uri photoUri, int requestedExtent, boolean darkTheme,
39            boolean isCircular, DefaultImageRequest defaultImageRequest,
40            DefaultImageProvider defaultProvider) {
41        defaultProvider.applyDefaultImage(view, requestedExtent, darkTheme, null);
42    }
43
44    @Override
45    public void removePhoto(ImageView view) {
46        view.setImageDrawable(null);
47    }
48
49    @Override
50    public void cancelPendingRequests(View fragmentRootView) {
51    }
52
53    @Override
54    public void pause() {
55    }
56
57    @Override
58    public void resume() {
59    }
60
61    @Override
62    public void refreshCache() {
63    }
64
65    @Override
66    public void cacheBitmap(Uri photoUri, Bitmap bitmap, byte[] photoBytes) {
67    }
68
69    @Override
70    public void preloadPhotosInBackground() {
71    }
72}
73