Home | History | Annotate | Download | only in conversation
      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.View;
     23 import android.view.ViewOutlineProvider;
     24 
     25 import com.android.messaging.ui.ContactIconView;
     26 import com.android.messaging.util.Assert;
     27 import com.android.messaging.util.AvatarUriUtil;
     28 import com.android.messaging.util.OsUtil;
     29 
     30 /**
     31  * Shows SIM avatar icon in the SIM switcher / Self-send button.
     32  */
     33 public class SimIconView extends ContactIconView {
     34     public SimIconView(Context context, AttributeSet attrs) {
     35         super(context, attrs);
     36         if (OsUtil.isAtLeastL()) {
     37             setOutlineProvider(new ViewOutlineProvider() {
     38                 @Override
     39                 public void getOutline(View v, Outline outline) {
     40                     outline.setOval(0, 0, v.getWidth(), v.getHeight());
     41                 }
     42             });
     43         }
     44     }
     45 
     46     @Override
     47     protected void maybeInitializeOnClickListener() {
     48         // TODO: SIM icon view shouldn't consume or handle clicks, but it should if
     49         // this is the send button for the only SIM in the device or if MSIM is not supported.
     50     }
     51 }
     52