mirror of
https://github.com/NiciDieNase/chaosflix
synced 2024-11-23 12:53:08 +00:00
handle network error
This commit is contained in:
parent
cd7039906e
commit
c7f8de64e0
1 changed files with 15 additions and 17 deletions
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue