Home | History | Annotate | Download | only in list
      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.list;
     17 
     18 import com.android.contacts.R;
     19 
     20 import android.content.Context;
     21 import android.content.Intent;
     22 import android.util.AttributeSet;
     23 import android.view.View;
     24 import android.widget.ImageButton;
     25 
     26 /**
     27  * A {@link ContactTileSecondaryTargetView} displays the contact's picture overlayed with their name
     28  * in a perfect square like the {@link ContactTileStarredView}. However it adds in an additional
     29  * touch target for a secondary action.
     30  */
     31 public class ContactTileSecondaryTargetView extends ContactTileStarredView {
     32 
     33     private final static String TAG = ContactTileSecondaryTargetView.class.getSimpleName();
     34 
     35     private ImageButton mSecondaryButton;
     36 
     37     public ContactTileSecondaryTargetView(Context context, AttributeSet attrs) {
     38         super(context, attrs);
     39     }
     40 
     41     @Override
     42     protected void onFinishInflate() {
     43         super.onFinishInflate();
     44 
     45         mSecondaryButton = (ImageButton) findViewById(R.id.contact_tile_secondary_button);
     46         mSecondaryButton.setOnClickListener(new OnClickListener() {
     47             @Override
     48             public void onClick(View v) {
     49                 getContext().startActivity(new Intent(Intent.ACTION_VIEW, getLookupUri()));
     50             }
     51         });
     52     }
     53 
     54     @Override
     55     protected boolean isDarkTheme() {
     56         return true;
     57     }
     58 }
     59