• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.xtremelabs.robolectric.shadows;
2 
3 
4 import android.graphics.drawable.ColorDrawable;
5 import com.xtremelabs.robolectric.internal.Implementation;
6 import com.xtremelabs.robolectric.internal.Implements;
7 
8 import static com.xtremelabs.robolectric.Robolectric.shadowOf;
9 
10 @Implements(ColorDrawable.class)
11 public class ShadowColorDrawable extends ShadowDrawable {
12 
13     int colorResourceId;
14 
__constructor__(int color)15     public void __constructor__(int color) {
16       colorResourceId = color;
17     }
18 
19     @Override @Implementation
equals(Object o)20     public boolean equals(Object o) {
21       if (realObject == o) return true;
22       if (o == null || realObject.getClass() != o.getClass()) return false;
23 
24       if (!super.equals(o)) return false;
25 
26       ShadowColorDrawable that = shadowOf((ColorDrawable)o);
27 
28       if (colorResourceId != that.colorResourceId) return false;
29 
30       return true;
31     }
32 
33     @Override @Implementation
hashCode()34     public int hashCode() {
35       int result = super.hashCode();
36       result = 31 * result + colorResourceId;
37       return result;
38     }
39 }
40