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
17package com.android.contacts.detail;
18
19import android.content.Context;
20import android.util.AttributeSet;
21import android.view.ContextMenu.ContextMenuInfo;
22import android.widget.AdapterView;
23import android.widget.LinearLayout;
24import android.widget.ListView;
25
26/**
27 * Custom {@link LinearLayout} which remembers its position in the {@link ListView}. Should be
28 * used for action touch targets in {@link ContactDetailFragment}.
29 */
30/* package */ class ActionsViewContainer extends LinearLayout {
31
32    private ContextMenuInfo mContextMenuInfo;
33
34    public ActionsViewContainer(Context context) {
35        super(context);
36    }
37
38    public ActionsViewContainer(Context context, AttributeSet attrs) {
39        this(context, attrs, 0);
40    }
41
42    public ActionsViewContainer(Context context, AttributeSet attrs, int defStyle) {
43        super(context, attrs, defStyle);
44    }
45
46    public void setPosition(int position) {
47        mContextMenuInfo = new AdapterView.AdapterContextMenuInfo(this, position, -1);
48    }
49
50    @Override
51    public ContextMenuInfo getContextMenuInfo() {
52        return mContextMenuInfo;
53    }
54}