@Test public void wifiStateChanges() { Application application = RuntimeEnvironment.application; TestSubscriber<Integer> o = new TestSubscriber<>(); RxWifiManager.wifiStateChanges(application).subscribe(o); o.assertValues(); Intent intent1 = new Intent(WIFI_STATE_CHANGED_ACTION) .putExtra(EXTRA_WIFI_STATE, WIFI_STATE_DISABLED); application.sendBroadcast(intent1); o.assertValues(WIFI_STATE_DISABLED); Intent intent2 = new Intent(WIFI_STATE_CHANGED_ACTION) .putExtra(EXTRA_WIFI_STATE, WIFI_STATE_UNKNOWN); application.sendBroadcast(intent2); o.assertValues(WIFI_STATE_DISABLED, WIFI_STATE_UNKNOWN); }
@CheckResult @NonNull public static Observable<Integer> wifiStateChanges(@NonNull final Context context) { checkNotNull(context, "context == null"); IntentFilter filter = new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION); return RxBroadcastReceiver.create(context, filter).map(new Func1<Intent, Integer>() { @Override public Integer call(Intent intent) { return intent.getIntExtra(EXTRA_WIFI_STATE, -1); } }); }
RxWifiManager { @CheckResult @NonNull public static Observable<Integer> wifiStateChanges(@NonNull final Context context) { checkNotNull(context, "context == null"); IntentFilter filter = new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION); return RxBroadcastReceiver.create(context, filter).map(new Func1<Intent, Integer>() { @Override public Integer call(Intent intent) { return intent.getIntExtra(EXTRA_WIFI_STATE, -1); } }); } }
RxWifiManager { @CheckResult @NonNull public static Observable<Integer> wifiStateChanges(@NonNull final Context context) { checkNotNull(context, "context == null"); IntentFilter filter = new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION); return RxBroadcastReceiver.create(context, filter).map(new Func1<Intent, Integer>() { @Override public Integer call(Intent intent) { return intent.getIntExtra(EXTRA_WIFI_STATE, -1); } }); } private  RxWifiManager(); }
RxWifiManager { @CheckResult @NonNull public static Observable<Integer> wifiStateChanges(@NonNull final Context context) { checkNotNull(context, "context == null"); IntentFilter filter = new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION); return RxBroadcastReceiver.create(context, filter).map(new Func1<Intent, Integer>() { @Override public Integer call(Intent intent) { return intent.getIntExtra(EXTRA_WIFI_STATE, -1); } }); } private  RxWifiManager(); @CheckResult @NonNull // static Observable<Integer> wifiStateChanges(@NonNull final Context context); @CheckResult @NonNull // static Action1<? super Boolean> wifiState(@NonNull final WifiManager wifiManager); @CheckResult @NonNull // static Observable<NetworkStateChangedEvent> networkStateChanges(@NonNull final Context context); @CheckResult @NonNull // static Observable<Boolean> supplicantConnectionChanges(@NonNull final Context context); @CheckResult @NonNull // static Observable<SupplicantStateChangedEvent> supplicantStateChanges(@NonNull final Context context); }
RxWifiManager { @CheckResult @NonNull public static Observable<Integer> wifiStateChanges(@NonNull final Context context) { checkNotNull(context, "context == null"); IntentFilter filter = new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION); return RxBroadcastReceiver.create(context, filter).map(new Func1<Intent, Integer>() { @Override public Integer call(Intent intent) { return intent.getIntExtra(EXTRA_WIFI_STATE, -1); } }); } private  RxWifiManager(); @CheckResult @NonNull // static Observable<Integer> wifiStateChanges(@NonNull final Context context); @CheckResult @NonNull // static Action1<? super Boolean> wifiState(@NonNull final WifiManager wifiManager); @CheckResult @NonNull // static Observable<NetworkStateChangedEvent> networkStateChanges(@NonNull final Context context); @CheckResult @NonNull // static Observable<Boolean> supplicantConnectionChanges(@NonNull final Context context); @CheckResult @NonNull // static Observable<SupplicantStateChangedEvent> supplicantStateChanges(@NonNull final Context context);  }