@Override public void onDestroyView() { super.onDestroyView(); if (mPropertiesMode == Mode.VIEW) { WatchTowerApplication.get(getActivity()).getComponent().eventBus().unregister(this); } mSubscriptions.unsubscribe(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mPropertiesMode = (Mode) getArguments().getSerializable(EXTRA_MODE); if (mPropertiesMode == null) { throw new IllegalArgumentException("Properties fragment requires a mode!"); } mBeacon = getArguments().getParcelable(EXTRA_BEACON); if (mPropertiesMode == Mode.UPDATE && mBeacon == null) { throw new IllegalArgumentException("Properties fragment requires a beacon!"); } mSubscriptions = new CompositeSubscription(); mDataManager = WatchTowerApplication.get(getActivity()).getComponent().dataManager(); if (mPropertiesMode == Mode.VIEW) { WatchTowerApplication.get(getActivity()).getComponent().eventBus().register(this); } setHasOptionsMenu(true); }