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 17 package com.android.ex.chips.recipientchip; 18 19 import android.graphics.Canvas; 20 import android.graphics.Paint; 21 import android.graphics.Rect; 22 import android.text.style.ReplacementSpan; 23 24 import com.android.ex.chips.RecipientEntry; 25 26 /** 27 * RecipientChip defines a span that contains information relevant to a 28 * particular recipient. 29 */ 30 public class InvisibleRecipientChip extends ReplacementSpan implements DrawableRecipientChip { 31 private final SimpleRecipientChip mDelegate; 32 33 public InvisibleRecipientChip(final RecipientEntry entry) { 34 super(); 35 36 mDelegate = new SimpleRecipientChip(entry); 37 } 38 39 @Override 40 public void setSelected(final boolean selected) { 41 mDelegate.setSelected(selected); 42 } 43 44 @Override 45 public boolean isSelected() { 46 return mDelegate.isSelected(); 47 } 48 49 @Override 50 public CharSequence getDisplay() { 51 return mDelegate.getDisplay(); 52 } 53 54 @Override 55 public CharSequence getValue() { 56 return mDelegate.getValue(); 57 } 58 59 @Override 60 public long getContactId() { 61 return mDelegate.getContactId(); 62 } 63 64 @Override 65 public long getDataId() { 66 return mDelegate.getDataId(); 67 } 68 69 @Override 70 public RecipientEntry getEntry() { 71 return mDelegate.getEntry(); 72 } 73 74 @Override 75 public void setOriginalText(final String text) { 76 mDelegate.setOriginalText(text); 77 } 78 79 @Override 80 public CharSequence getOriginalText() { 81 return mDelegate.getOriginalText(); 82 } 83 84 @Override 85 public boolean isGalContact() { 86 return mDelegate.isGalContact(); 87 } 88 89 @Override 90 public void draw(final Canvas canvas, final CharSequence text, final int start, final int end, 91 final float x, final int top, final int y, final int bottom, final Paint paint) { 92 // Do nothing. 93 } 94 95 @Override 96 public int getSize(final Paint paint, final CharSequence text, final int start, final int end, 97 final Paint.FontMetricsInt fm) { 98 return 0; 99 } 100 101 @Override 102 public Rect getBounds() { 103 return new Rect(0, 0, 0, 0); 104 } 105 106 @Override 107 public void draw(final Canvas canvas) { 108 // do nothing. 109 } 110 } 111