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 package com.android.contacts.common.list; 17 18 import com.android.contacts.common.ContactPhotoManager; 19 import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest; 20 21 import android.content.Context; 22 import android.util.AttributeSet; 23 24 /** 25 * A {@link ContactTileStarredView} displays the contact's picture overlayed with their name 26 * in a square. The actual dimensions are set by 27 * {@link com.android.contacts.common.list.ContactTileAdapter.ContactTileRow}. 28 */ 29 public class ContactTileStarredView extends ContactTileView { 30 31 /** 32 * The photo manager should display the default image/letter at 80% of its normal size. 33 */ 34 private static final float DEFAULT_IMAGE_LETTER_SCALE = 0.8f; 35 36 public ContactTileStarredView(Context context, AttributeSet attrs) { 37 super(context, attrs); 38 } 39 40 @Override 41 protected boolean isDarkTheme() { 42 return false; 43 } 44 45 @Override 46 protected int getApproximateImageSize() { 47 // The picture is the full size of the tile (minus some padding, but we can be generous) 48 return mListener.getApproximateTileWidth(); 49 } 50 51 @Override 52 protected DefaultImageRequest getDefaultImageRequest(String displayName, String lookupKey) { 53 return new DefaultImageRequest(displayName, lookupKey, ContactPhotoManager.TYPE_DEFAULT, 54 DEFAULT_IMAGE_LETTER_SCALE, /* offset = */ 0, /* isCircular = */ true); 55 } 56 } 57