1 package org.robolectric.shadows; 2 3 import static android.os.Build.VERSION_CODES.M; 4 import static org.robolectric.shadow.api.Shadow.directlyOn; 5 6 import android.graphics.Bitmap; 7 import android.graphics.drawable.Icon; 8 import android.net.Uri; 9 import org.robolectric.annotation.HiddenApi; 10 import org.robolectric.annotation.Implementation; 11 import org.robolectric.annotation.Implements; 12 import org.robolectric.annotation.RealObject; 13 14 @SuppressWarnings({"UnusedDeclaration"}) 15 @Implements(value = Icon.class, minSdk = M) 16 public class ShadowIcon { 17 18 @RealObject 19 private Icon realIcon; 20 21 @HiddenApi 22 @Implementation 23 public int getType() { 24 return directlyOn(realIcon, Icon.class).getType(); 25 } 26 27 @HiddenApi 28 @Implementation 29 public int getResId() { 30 return directlyOn(realIcon, Icon.class).getResId(); 31 } 32 33 @HiddenApi 34 @Implementation 35 public Bitmap getBitmap() { 36 return directlyOn(realIcon, Icon.class).getBitmap(); 37 } 38 39 @HiddenApi 40 @Implementation 41 public Uri getUri() { 42 return directlyOn(realIcon, Icon.class).getUri(); 43 } 44 45 @HiddenApi 46 @Implementation 47 public int getDataLength() { 48 return directlyOn(realIcon, Icon.class).getDataLength(); 49 } 50 51 @HiddenApi 52 @Implementation 53 public int getDataOffset() { 54 return directlyOn(realIcon, Icon.class).getDataOffset(); 55 } 56 57 @HiddenApi 58 @Implementation 59 public byte[] getDataBytes() { 60 return directlyOn(realIcon, Icon.class).getDataBytes(); 61 } 62 } 63