Timber.d("observer");
Timber.d(observer.toString());
public boolean isInternetAvailable(){
ConnectivityManager connectivityManager = (ConnectivityManager)
getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
return activeNetworkInfo != null && activeNetworkInfo.isConnected();
}
public Observable<Boolean> isConnectionAvailable(){
Timber.d(isInternetAvailable()+" available");
return Observable.just(isInternetAvailable());
}
public Observable<List<Category>> getCategories() {
Timber.d("local repository");
return database.categoryDao().getAll();
}
@Dao
public interface CategoryDao {
@Query("SELECT * FROM Category")
Observable<List<Category>> getAll();
public void setMainPresenter(Presenter presenter){
this.presenter = presenter;
}
public void setToolBarData(ToolBarData data){
this.presenter.toolBarDataChanged(data);
}
public MainActivityPresenter(){
repository.setMainPresenter(this); //подписка на события
}
public void toolBarDataChanged(ToolBarData data){
//изменить данные в тулбаре
}
repository.setToolBarData(toolBarData);