1194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy/*
2194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy * Copyright (C) 2011 The Android Open Source Project
3194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy *
4194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy * Licensed under the Apache License, Version 2.0 (the "License");
5194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy * you may not use this file except in compliance with the License.
6194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy * You may obtain a copy of the License at
7194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy *
8194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy *      http://www.apache.org/licenses/LICENSE-2.0
9194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy *
10194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy * Unless required by applicable law or agreed to in writing, software
11194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy * distributed under the License is distributed on an "AS IS" BASIS,
12194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy * See the License for the specific language governing permissions and
14194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy * limitations under the License.
15194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy */
16194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy
17194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedypackage com.android.ex.chips.recipientchip;
18194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy
19194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedyimport android.graphics.Canvas;
20194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedyimport android.graphics.Paint;
21194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedyimport android.graphics.Rect;
22194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedyimport android.text.style.ReplacementSpan;
23194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy
24194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedyimport com.android.ex.chips.RecipientEntry;
25194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy
26194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy/**
27194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy * RecipientChip defines a span that contains information relevant to a
28194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy * particular recipient.
29194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy */
30194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedypublic class InvisibleRecipientChip extends ReplacementSpan implements DrawableRecipientChip {
31194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    private final SimpleRecipientChip mDelegate;
32194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy
33194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    public InvisibleRecipientChip(final RecipientEntry entry) {
34194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy        super();
35194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy
36194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy        mDelegate = new SimpleRecipientChip(entry);
37194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    }
38194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy
39194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    @Override
40194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    public void setSelected(final boolean selected) {
41194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy        mDelegate.setSelected(selected);
42194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    }
43194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy
44194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    @Override
45194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    public boolean isSelected() {
46194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy        return mDelegate.isSelected();
47194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    }
48194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy
49194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    @Override
50194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    public CharSequence getDisplay() {
51194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy        return mDelegate.getDisplay();
52194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    }
53194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy
54194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    @Override
55194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    public CharSequence getValue() {
56194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy        return mDelegate.getValue();
57194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    }
58194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy
59194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    @Override
60194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    public long getContactId() {
61194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy        return mDelegate.getContactId();
62194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    }
63194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy
64194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    @Override
657a4e67708498ec46c2e9b3bad69d3807d88c064eScott Kennedy    public Long getDirectoryId() {
667a4e67708498ec46c2e9b3bad69d3807d88c064eScott Kennedy        return mDelegate.getDirectoryId();
677a4e67708498ec46c2e9b3bad69d3807d88c064eScott Kennedy    }
687a4e67708498ec46c2e9b3bad69d3807d88c064eScott Kennedy
697a4e67708498ec46c2e9b3bad69d3807d88c064eScott Kennedy    @Override
707a4e67708498ec46c2e9b3bad69d3807d88c064eScott Kennedy    public String getLookupKey() {
717a4e67708498ec46c2e9b3bad69d3807d88c064eScott Kennedy        return mDelegate.getLookupKey();
727a4e67708498ec46c2e9b3bad69d3807d88c064eScott Kennedy    }
737a4e67708498ec46c2e9b3bad69d3807d88c064eScott Kennedy
747a4e67708498ec46c2e9b3bad69d3807d88c064eScott Kennedy    @Override
75194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    public long getDataId() {
76194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy        return mDelegate.getDataId();
77194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    }
78194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy
79194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    @Override
80194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    public RecipientEntry getEntry() {
81194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy        return mDelegate.getEntry();
82194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    }
83194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy
84194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    @Override
85194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    public void setOriginalText(final String text) {
86194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy        mDelegate.setOriginalText(text);
87194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    }
88194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy
89194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    @Override
90194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    public CharSequence getOriginalText() {
91194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy        return mDelegate.getOriginalText();
92194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    }
93194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy
94194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    @Override
95194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    public void draw(final Canvas canvas, final CharSequence text, final int start, final int end,
96194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy            final float x, final int top, final int y, final int bottom, final Paint paint) {
97194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy        // Do nothing.
98194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    }
99194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy
100194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    @Override
101194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    public int getSize(final Paint paint, final CharSequence text, final int start, final int end,
102194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy            final Paint.FontMetricsInt fm) {
103194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy        return 0;
104194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    }
105194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy
106194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    @Override
107194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    public Rect getBounds() {
108194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy        return new Rect(0, 0, 0, 0);
109194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    }
110194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy
111194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    @Override
112194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    public void draw(final Canvas canvas) {
113194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy        // do nothing.
114194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy    }
115194d427ebcfc2133bda410e0e4c399250d9a6066Scott Kennedy}
116