Search in sources :

Example 6 with SnackbarErrorNotification

use of org.edx.mobile.http.notifications.SnackbarErrorNotification in project edx-app-android by edx.

the class OldMyCoursesListFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    binding = DataBindingUtil.inflate(inflater, R.layout.fragment_my_courses_list, container, false);
    errorNotification = new FullScreenErrorNotification(binding.myCourseList);
    snackbarErrorNotification = new SnackbarErrorNotification(binding.getRoot());
    binding.swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            // Hide the progress bar as swipe layout has its own progress indicator
            binding.loadingIndicator.getRoot().setVisibility(View.GONE);
            errorNotification.hideError();
            loadData(false);
        }
    });
    binding.swipeContainer.setColorSchemeResources(R.color.edx_brand_primary_accent, R.color.edx_brand_gray_x_back, R.color.edx_brand_gray_x_back, R.color.edx_brand_gray_x_back);
    if (environment.getConfig().getCourseDiscoveryConfig().isCourseDiscoveryEnabled()) {
        // As per docs, the footer needs to be added before adapter is set to the ListView
        addFindCoursesFooter();
    }
    // Add empty views to cause dividers to render at the top and bottom of the list
    binding.myCourseList.addHeaderView(new View(getContext()), null, false);
    binding.myCourseList.addFooterView(new View(getContext()), null, false);
    binding.myCourseList.setAdapter(adapter);
    binding.myCourseList.setOnItemClickListener(adapter);
    return binding.getRoot();
}
Also used : FullScreenErrorNotification(org.edx.mobile.http.notifications.FullScreenErrorNotification) SnackbarErrorNotification(org.edx.mobile.http.notifications.SnackbarErrorNotification) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) View(android.view.View)

Aggregations

SnackbarErrorNotification (org.edx.mobile.http.notifications.SnackbarErrorNotification)6 FullScreenErrorNotification (org.edx.mobile.http.notifications.FullScreenErrorNotification)4 View (android.view.View)2 SuppressLint (android.annotation.SuppressLint)1 Bundle (android.os.Bundle)1 NonNull (android.support.annotation.NonNull)1 ViewPager (android.support.v4.view.ViewPager)1 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)1 Icon (com.joanzapata.iconify.Icon)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 StaticFragmentPagerAdapter (org.edx.mobile.view.adapters.StaticFragmentPagerAdapter)1 URLInterceptorWebViewClient (org.edx.mobile.view.custom.URLInterceptorWebViewClient)1