1 package com.xtremelabs.robolectric.shadows; 2 3 import android.location.Criteria; 4 5 import com.xtremelabs.robolectric.internal.Implementation; 6 import com.xtremelabs.robolectric.internal.Implements; 7 8 @Implements(Criteria.class) 9 public class ShadowCriteria { 10 private int accuracy = Criteria.NO_REQUIREMENT; 11 // private int bearingAccuracy; 12 // private int horizontalAccuracy; 13 // private int verticalAccuracy; 14 // private int speedAccuracy; 15 private int powerRequirement = Criteria.NO_REQUIREMENT; 16 __constructor__(Criteria criteria)17 public void __constructor__(Criteria criteria) { 18 accuracy = criteria.getAccuracy(); 19 powerRequirement = criteria.getPowerRequirement(); 20 } 21 22 @Implementation getAccuracy()23 public int getAccuracy() { 24 return accuracy; 25 } 26 27 @Implementation setAccuracy(int accuracy)28 public void setAccuracy(int accuracy) { 29 this.accuracy = accuracy; 30 } 31 32 @Implementation getPowerRequirement()33 public int getPowerRequirement() { 34 return powerRequirement; 35 } 36 37 @Implementation setPowerRequirement(int powerRequirement)38 public void setPowerRequirement(int powerRequirement) { 39 this.powerRequirement = powerRequirement; 40 } 41 42 @Implementation 43 @Override equals(Object obj)44 public boolean equals(Object obj) { 45 if (!(obj instanceof Criteria)) { 46 return false; 47 } 48 Criteria criteria = (Criteria) obj; 49 if (criteria.getAccuracy() == accuracy && criteria.getPowerRequirement() == powerRequirement) { 50 return true; 51 } 52 return false; 53 } 54 } 55