BaseRecipientChip.java revision 514f8a75f72fa2e735418ffb5d6e30aa914fbe7b
1/*
2 * Copyright (C) 2013 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.ex.chips.recipientchip;
18
19import com.android.ex.chips.RecipientEntry;
20
21/**
22 * BaseRecipientChip defines an object that contains information relevant to a
23 * particular recipient.
24 */
25interface BaseRecipientChip {
26
27    /**
28     * Set the selected state of the chip.
29     */
30    void setSelected(boolean selected);
31
32    /**
33     * Return true if the chip is selected.
34     */
35    boolean isSelected();
36
37    /**
38     * Get the text displayed in the chip.
39     */
40    CharSequence getDisplay();
41
42    /**
43     * Get the text value this chip represents.
44     */
45    CharSequence getValue();
46
47    /**
48     * Get the id of the contact associated with this chip.
49     */
50    long getContactId();
51
52    /**
53     * Get the id of the data associated with this chip.
54     */
55    long getDataId();
56
57    /**
58     * Get associated RecipientEntry.
59     */
60    RecipientEntry getEntry();
61
62    /**
63     * Set the text in the edittextview originally associated with this chip
64     * before any reverse lookups.
65     */
66    void setOriginalText(String text);
67
68    /**
69     * Set the text in the edittextview originally associated with this chip
70     * before any reverse lookups.
71     */
72    CharSequence getOriginalText();
73
74    /**
75     * Checks if this contact was retrieved from a GAL lookup.
76     *
77     * @return <code>true</code> if it came from GAL, <code>false</code> otherwise
78     */
79    boolean isGalContact();
80}
81