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 17 package com.android.contacts.tests.mocks; 18 19 import android.graphics.Bitmap; 20 import android.net.Uri; 21 import android.widget.ImageView; 22 23 import com.android.contacts.common.ContactPhotoManager; 24 25 /** 26 * A photo preloader that always uses the "no contact" picture and never executes any real 27 * db queries 28 */ 29 public class MockContactPhotoManager extends ContactPhotoManager { 30 @Override 31 public void loadThumbnail(ImageView view, long photoId, boolean darkTheme, 32 DefaultImageProvider defaultProvider) { 33 defaultProvider.applyDefaultImage(view, -1, darkTheme); 34 } 35 36 @Override 37 public void loadPhoto(ImageView view, Uri photoUri, int requestedExtent, boolean darkTheme, 38 DefaultImageProvider defaultProvider) { 39 defaultProvider.applyDefaultImage(view, requestedExtent, darkTheme); 40 } 41 42 @Override 43 public void removePhoto(ImageView view) { 44 view.setImageDrawable(null); 45 } 46 47 @Override 48 public void pause() { 49 } 50 51 @Override 52 public void resume() { 53 } 54 55 @Override 56 public void refreshCache() { 57 } 58 59 @Override 60 public void cacheBitmap(Uri photoUri, Bitmap bitmap, byte[] photoBytes) { 61 } 62 63 @Override 64 public void preloadPhotosInBackground() { 65 } 66 } 67