handle network error

This commit is contained in:
Felix 2017-09-25 04:03:51 +02:00
parent cd7039906e
commit c7f8de64e0

View file

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