1 package org.robolectric.shadows; 2 3 import static org.robolectric.util.reflector.Reflector.reflector; 4 5 import android.widget.BaseAdapter; 6 import org.robolectric.annotation.Implementation; 7 import org.robolectric.annotation.Implements; 8 import org.robolectric.annotation.RealObject; 9 import org.robolectric.util.reflector.Direct; 10 import org.robolectric.util.reflector.ForType; 11 12 @SuppressWarnings({"UnusedDeclaration"}) 13 @Implements(BaseAdapter.class) 14 public class ShadowBaseAdapter { 15 @RealObject private BaseAdapter realBaseAdapter; 16 private boolean wasNotifyDataSetChangedCalled; 17 18 @Implementation notifyDataSetChanged()19 protected void notifyDataSetChanged() { 20 wasNotifyDataSetChangedCalled = true; 21 reflector(BaseAdapterReflector.class, realBaseAdapter).notifyDataSetChanged(); 22 } 23 clearWasDataSetChangedCalledFlag()24 public void clearWasDataSetChangedCalledFlag() { 25 wasNotifyDataSetChangedCalled = false; 26 } 27 wasNotifyDataSetChangedCalled()28 public boolean wasNotifyDataSetChangedCalled() { 29 return wasNotifyDataSetChangedCalled; 30 } 31 32 @ForType(BaseAdapter.class) 33 interface BaseAdapterReflector { 34 35 @Direct notifyDataSetChanged()36 void notifyDataSetChanged(); 37 } 38 } 39