1 package com.xtremelabs.robolectric.shadows;
2 
3 import android.content.BroadcastReceiver;
4 import android.content.Context;
5 import android.content.Intent;
6 import android.content.IntentFilter;
7 import com.google.android.maps.MapActivity;
8 import com.xtremelabs.robolectric.internal.Implementation;
9 import com.xtremelabs.robolectric.internal.Implements;
10 
11 /**
12  * Shadow {@code MapActivity} that registers and unregisters a {@code BroadcastReciever} when {@link #onResume()} and
13  * {@link #onPause()} are called respectively.
14  */
15 
16 @SuppressWarnings({"UnusedDeclaration"})
17 @Implements(MapActivity.class)
18 public class ShadowMapActivity extends ShadowActivity {
19     private ConnectivityBroadcastReceiver connectivityBroadcastReceiver = new ConnectivityBroadcastReceiver();
20 
21     @Implementation
onResume()22     public void onResume() {
23         registerReceiver(connectivityBroadcastReceiver, new IntentFilter());
24     }
25 
26     @Implementation
onPause()27     public void onPause() {
28         unregisterReceiver(connectivityBroadcastReceiver);
29     }
30 
31     @Implementation
isRouteDisplayed()32     public boolean isRouteDisplayed() {
33         return false;
34     }
35 
36     private static class ConnectivityBroadcastReceiver extends BroadcastReceiver {
onReceive(Context context, Intent intent)37         @Override public void onReceive(Context context, Intent intent) {
38         }
39     }
40 }
41