blob: 59ef81e1da4b5dfc66df7830b3eddf5131ff465c [file] [log] [blame]
Chiao Cheng0a736602012-12-05 12:06:58 -08001/*
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 */
16package com.android.contacts.common.list;
17
Brian Attwell9854e162014-08-21 20:11:13 -070018import com.android.contacts.common.ContactPhotoManager;
19import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest;
20
Chiao Cheng0a736602012-12-05 12:06:58 -080021import android.content.Context;
22import 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 */
29public class ContactTileStarredView extends ContactTileView {
Brian Attwell9854e162014-08-21 20:11:13 -070030
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
Chiao Cheng0a736602012-12-05 12:06:58 -080036 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 }
Brian Attwell9854e162014-08-21 20:11:13 -070050
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 }
Chiao Cheng0a736602012-12-05 12:06:58 -080056}