Yorke Lee | 2644d94 | 2013-10-28 11:05:43 -0700 | [diff] [blame] | 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.common.test.mocks; |
| 18 | |
| 19 | import android.graphics.Bitmap; |
| 20 | import android.net.Uri; |
Brian Attwell | b92b637 | 2014-07-21 23:39:35 -0700 | [diff] [blame] | 21 | import android.view.View; |
Yorke Lee | 2644d94 | 2013-10-28 11:05:43 -0700 | [diff] [blame] | 22 | import android.widget.ImageView; |
| 23 | |
| 24 | import com.android.contacts.common.ContactPhotoManager; |
| 25 | |
| 26 | /** |
| 27 | * A photo preloader that always uses the "no contact" picture and never executes any real |
| 28 | * db queries |
| 29 | */ |
| 30 | public class MockContactPhotoManager extends ContactPhotoManager { |
| 31 | @Override |
Yorke Lee | c4a2a23 | 2014-04-28 17:53:42 -0700 | [diff] [blame] | 32 | public void loadThumbnail(ImageView view, long photoId, boolean darkTheme, boolean isCircular, |
Yorke Lee | 9df5e19 | 2014-02-12 14:58:25 -0800 | [diff] [blame] | 33 | DefaultImageRequest defaultImageRequest, DefaultImageProvider defaultProvider) { |
| 34 | defaultProvider.applyDefaultImage(view, -1, darkTheme, null); |
Yorke Lee | 2644d94 | 2013-10-28 11:05:43 -0700 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | @Override |
| 38 | public void loadPhoto(ImageView view, Uri photoUri, int requestedExtent, boolean darkTheme, |
Yorke Lee | c4a2a23 | 2014-04-28 17:53:42 -0700 | [diff] [blame] | 39 | boolean isCircular, DefaultImageRequest defaultImageRequest, |
| 40 | DefaultImageProvider defaultProvider) { |
Yorke Lee | 9df5e19 | 2014-02-12 14:58:25 -0800 | [diff] [blame] | 41 | defaultProvider.applyDefaultImage(view, requestedExtent, darkTheme, null); |
Yorke Lee | 2644d94 | 2013-10-28 11:05:43 -0700 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | @Override |
| 45 | public void removePhoto(ImageView view) { |
| 46 | view.setImageDrawable(null); |
| 47 | } |
| 48 | |
| 49 | @Override |
Brian Attwell | b92b637 | 2014-07-21 23:39:35 -0700 | [diff] [blame] | 50 | public void cancelPendingRequests(View fragmentRootView) { |
Tyler Gunn | 232df2f | 2014-04-15 15:30:58 -0700 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | @Override |
Yorke Lee | 2644d94 | 2013-10-28 11:05:43 -0700 | [diff] [blame] | 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 | } |