diff --git a/touch/src/main/java/de/nicidienase/chaosflix/touch/activities/BrowseActivity.java b/touch/src/main/java/de/nicidienase/chaosflix/touch/activities/BrowseActivity.java index b364c595..9eb26ad7 100644 --- a/touch/src/main/java/de/nicidienase/chaosflix/touch/activities/BrowseActivity.java +++ b/touch/src/main/java/de/nicidienase/chaosflix/touch/activities/BrowseActivity.java @@ -4,6 +4,7 @@ import android.arch.lifecycle.ViewModelProviders; import android.content.res.Resources; import android.os.Bundle; import android.support.annotation.Nullable; +import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; @@ -60,23 +61,20 @@ public class BrowseActivity extends AppCompatActivity implements if(savedInstanceState == null){ ConferencesTabBrowseFragment browseFragment = ConferencesTabBrowseFragment.newInstance(getNumColumns()); - mViewModel.getConferencesWrapperAsLiveData().observe(browseFragment,conferencesWrapper -> { - FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); - ft.replace(R.id.fragment_container,browseFragment); - ft.setReorderingAllowed(true); - ft.commit(); - }); -// mDisposables.add(mViewModel.getConferencesWrapper() -// .observeOn(AndroidSchedulers.mainThread()) -// .doOnError(throwable -> Log.d(TAG, String.valueOf(throwable.getCause()))) -// .subscribe(conferencesWrapper -> { -// ConferencesTabBrowseFragment browseFragment -// = ConferencesTabBrowseFragment.newInstance(getNumColumns()); -// FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); -// ft.replace(R.id.fragment_container,browseFragment); -// ft.setReorderingAllowed(true); -// ft.commit(); -// })); +// mViewModel.getConferencesWrapperAsLiveData().observe(browseFragment,conferencesWrapper -> { +// FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); +// ft.replace(R.id.fragment_container,browseFragment); +// ft.setReorderingAllowed(true); +// ft.commit(); +// }); + mDisposables.add(mViewModel.getConferencesWrapper() + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(conferencesWrapper -> { + FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); + ft.replace(R.id.fragment_container,browseFragment); + ft.setReorderingAllowed(true); + ft.commit(); + }, throwable -> Snackbar.make(findViewById(R.id.fragment_container),throwable.getMessage(),Snackbar.LENGTH_INDEFINITE).show())); } }