| | |
| | | import androidx.lifecycle.Lifecycle; |
| | | |
| | | import com.hdl.photovoltaic.R; |
| | | import com.hdl.photovoltaic.bean.BaseEventBus; |
| | | import com.hdl.photovoltaic.listener.BaseView; |
| | | import com.hdl.photovoltaic.other.HdlThreadLogic; |
| | | import com.hdl.photovoltaic.widget.LoadingDialog; |
| | | |
| | | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | import org.greenrobot.eventbus.Subscribe; |
| | | import org.greenrobot.eventbus.ThreadMode; |
| | | |
| | | import java.util.Locale; |
| | | |
| | |
| | | |
| | | protected void onLazyInitView(Bundle savedInstanceState) { |
| | | onBindView(savedInstanceState); |
| | | // registerEventBus(); |
| | | //注册EventBus |
| | | registerEventBus(); |
| | | } |
| | | |
| | | |
| | |
| | | isFirst = true; |
| | | //隐藏Loading |
| | | hideLoading(); |
| | | // unregisterEventBus(); |
| | | //注销EventBus |
| | | unregisterEventBus(); |
| | | } |
| | | |
| | | |
| | | protected void unregisterEventBus() { |
| | | // if (EventBus.getDefault().isRegistered(this)) { |
| | | // EventBus.getDefault().unregister(this); |
| | | // } |
| | | if (EventBus.getDefault().isRegistered(this)) { |
| | | EventBus.getDefault().unregister(this); |
| | | } |
| | | } |
| | | |
| | | protected void registerEventBus() { |
| | | // if (!EventBus.getDefault().isRegistered(this)) { |
| | | // EventBus.getDefault().register(this); |
| | | // } |
| | | if (!EventBus.getDefault().isRegistered(this)) { |
| | | EventBus.getDefault().register(this); |
| | | } |
| | | } |
| | | |
| | | // @Subscribe(threadMode = ThreadMode.MAIN) |
| | | // public void onEventMessage(BaseEvent event) { |
| | | // |
| | | // } |
| | | @Subscribe(threadMode = ThreadMode.MAIN) |
| | | public void onEventMessage(BaseEventBus eventBus) { |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 显示View |