• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2015 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.messaging.ui.conversation;
17 
18 import android.content.Context;
19 import android.graphics.Outline;
20 import android.net.Uri;
21 import android.util.AttributeSet;
22 import android.view.MotionEvent;
23 import android.view.View;
24 import android.view.ViewOutlineProvider;
25 
26 import com.android.messaging.ui.ContactIconView;
27 import com.android.messaging.util.Assert;
28 import com.android.messaging.util.AvatarUriUtil;
29 import com.android.messaging.util.OsUtil;
30 
31 /**
32  * Shows SIM avatar icon in the SIM switcher / Self-send button.
33  */
34 public class SimIconView extends ContactIconView {
SimIconView(Context context, AttributeSet attrs)35     public SimIconView(Context context, AttributeSet attrs) {
36         super(context, attrs);
37         if (OsUtil.isAtLeastL()) {
38             setOutlineProvider(new ViewOutlineProvider() {
39                 @Override
40                 public void getOutline(View v, Outline outline) {
41                     outline.setOval(0, 0, v.getWidth(), v.getHeight());
42                 }
43             });
44         }
45     }
46 
47     @Override
onTouchEvent(MotionEvent event)48     public boolean onTouchEvent(MotionEvent event) {
49         if (isClickable()) {
50             return super.onTouchEvent(event);
51         }
52         return true;
53     }
54 
55     @Override
maybeInitializeOnClickListener()56     protected void maybeInitializeOnClickListener() {
57         // TODO: SIM icon view shouldn't consume or handle clicks, but it should if
58         // this is the send button for the only SIM in the device or if MSIM is not supported.
59     }
60 }
61