Search in sources :

Example 51 with SwipeRefreshLayout

use of android.support.v4.widget.SwipeRefreshLayout in project BloodHub by kazijehangir.

the class NewsListFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    mRecyclerView = (RecyclerView) getView().findViewById(R.id.recyclerView);
    mSwipeLayout = (SwipeRefreshLayout) getView().findViewById(R.id.swipeRefreshLayout);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    mRecyclerView.setAdapter(new RssFeedListAdapter(getActivity(), new ArrayList<RssFeedModel>()));
    mSwipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            new FetchFeedTask().execute((Void) null);
        }
    });
    new FetchFeedTask().execute((Void) null);
}
Also used : ArrayList(java.util.ArrayList) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout)

Example 52 with SwipeRefreshLayout

use of android.support.v4.widget.SwipeRefreshLayout in project TrebleShot by genonbeta.

the class NetworkDeviceListFragment method onListView.

@Override
protected ListView onListView(View mainContainer, ViewGroup listViewContainer) {
    Context context = mainContainer.getContext();
    mSwipeRefreshLayout = new SwipeRefreshLayout(context);
    mSwipeRefreshLayout.setColorSchemeColors(ContextCompat.getColor(context, R.color.colorPrimary), ContextCompat.getColor(context, R.color.colorAccent));
    mSwipeRefreshLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    listViewContainer.addView(mSwipeRefreshLayout);
    return super.onListView(mainContainer, mSwipeRefreshLayout);
}
Also used : Context(android.content.Context) ViewGroup(android.view.ViewGroup) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout)

Example 53 with SwipeRefreshLayout

use of android.support.v4.widget.SwipeRefreshLayout in project nextcloud-notes by stefan-niedermann.

the class SelectSingleNoteActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    android.support.v7.app.ActionBar ab = getSupportActionBar();
    SwipeRefreshLayout swipeRefreshLayout = getSwipeRefreshLayout();
    setResult(Activity.RESULT_CANCELED);
    findViewById(R.id.fab_create).setVisibility(View.GONE);
    if (ab != null) {
        ab.setTitle(R.string.activity_select_single_note);
    }
    swipeRefreshLayout.setEnabled(false);
    swipeRefreshLayout.setRefreshing(false);
}
Also used : SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout)

Example 54 with SwipeRefreshLayout

use of android.support.v4.widget.SwipeRefreshLayout in project nextcloud-notes by stefan-niedermann.

the class NotesListViewActivity method setupNotesList.

private void setupNotesList() {
    initList();
    // Pull to Refresh
    swipeRefreshLayout = findViewById(R.id.swiperefreshlayout);
    swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            if (db.getNoteServerSyncHelper().isSyncPossible()) {
                synchronize();
            } else {
                swipeRefreshLayout.setRefreshing(false);
                Toast.makeText(getApplicationContext(), getString(R.string.error_sync, getString(NotesClientUtil.LoginStatus.NO_NETWORK.str)), Toast.LENGTH_LONG).show();
            }
        }
    });
    // Floating Action Button
    findViewById(R.id.fab_create).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Intent createIntent = new Intent(getApplicationContext(), EditNoteActivity.class);
            createIntent.putExtra(EditNoteActivity.PARAM_CATEGORY, navigationSelection);
            startActivityForResult(createIntent, create_note_cmd);
        }
    });
}
Also used : Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) SearchView(android.support.v7.widget.SearchView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView)

Example 55 with SwipeRefreshLayout

use of android.support.v4.widget.SwipeRefreshLayout in project focus-android by mozilla-mobile.

the class BrowserFragment method inflateLayout.

@Override
public View inflateLayout(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    if (savedInstanceState != null && savedInstanceState.containsKey(RESTORE_KEY_DOWNLOAD)) {
        // If this activity was destroyed before we could start a download (e.g. because we were waiting for a permission)
        // then restore the download object.
        pendingDownload = savedInstanceState.getParcelable(RESTORE_KEY_DOWNLOAD);
    }
    final View view = inflater.inflate(R.layout.fragment_browser, container, false);
    videoContainer = (ViewGroup) view.findViewById(R.id.video_container);
    browserContainer = view.findViewById(R.id.browser_container);
    urlBar = view.findViewById(R.id.urlbar);
    statusBar = view.findViewById(R.id.status_bar_background);
    popupTint = view.findViewById(R.id.popup_tint);
    urlView = (TextView) view.findViewById(R.id.display_url);
    progressView = (AnimatedProgressBar) view.findViewById(R.id.progress);
    swipeRefresh = (SwipeRefreshLayout) view.findViewById(R.id.swipe_refresh);
    swipeRefresh.setColorSchemeResources(R.color.colorAccent);
    swipeRefresh.setEnabled(Features.SWIPE_TO_REFRESH);
    swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            reload();
            TelemetryWrapper.swipeReloadEvent();
        }
    });
    session.getUrl().observe(this, new Observer<String>() {

        @Override
        public void onChanged(@Nullable String url) {
            urlView.setText(UrlUtils.stripUserInfo(url));
        }
    });
    setBlockingEnabled(session.isBlockingEnabled());
    session.getLoading().observe(this, new AverageLoadTimeObserver(session));
    session.getLoading().observe(this, new NonNullObserver<Boolean>() {

        @Override
        public void onValueChanged(@NonNull Boolean loading) {
            if (loading) {
                backgroundTransitionGroup.resetTransition();
                progressView.setProgress(5);
                progressView.setVisibility(View.VISIBLE);
            } else {
                if (progressView.getVisibility() == View.VISIBLE) {
                    // We start a transition only if a page was just loading before
                    // allowing to avoid issue #1179
                    backgroundTransitionGroup.startTransition(ANIMATION_DURATION);
                    progressView.setVisibility(View.GONE);
                }
                swipeRefresh.setRefreshing(false);
            }
            updateBlockingBadging(loading || session.isBlockingEnabled());
            updateToolbarButtonStates(loading);
            final BrowserMenu menu = menuWeakReference.get();
            if (menu != null) {
                menu.updateLoading(loading);
            }
        }
    });
    if ((refreshButton = view.findViewById(R.id.refresh)) != null) {
        refreshButton.setOnClickListener(this);
    }
    if ((stopButton = view.findViewById(R.id.stop)) != null) {
        stopButton.setOnClickListener(this);
    }
    if ((forwardButton = view.findViewById(R.id.forward)) != null) {
        forwardButton.setOnClickListener(this);
    }
    if ((backButton = view.findViewById(R.id.back)) != null) {
        backButton.setOnClickListener(this);
    }
    final ImageView blockIcon = (ImageView) view.findViewById(R.id.block_image);
    blockIcon.setImageResource(R.drawable.ic_tracking_protection_disabled);
    blockView = (FrameLayout) view.findViewById(R.id.block);
    securityView = view.findViewById(R.id.security_info);
    session.getSecure().observe(this, new Observer<Boolean>() {

        @Override
        public void onChanged(Boolean secure) {
            if (!session.getLoading().getValue()) {
                if (secure) {
                    securityView.setImageResource(R.drawable.ic_lock);
                } else {
                    if (URLUtil.isHttpUrl(getUrl())) {
                        // HTTP site
                        securityView.setImageResource(R.drawable.ic_internet);
                    } else {
                        // Certificate is bad
                        securityView.setImageResource(R.drawable.ic_warning);
                    }
                }
            } else {
                securityView.setImageResource(R.drawable.ic_internet);
            }
        }
    });
    securityView.setOnClickListener(this);
    session.getProgress().observe(this, new Observer<Integer>() {

        @Override
        public void onChanged(Integer progress) {
            progressView.setProgress(progress);
        }
    });
    menuView = (ImageButton) view.findViewById(R.id.menuView);
    menuView.setOnClickListener(this);
    if (session.isCustomTab()) {
        initialiseCustomTabUi(view);
    } else {
        initialiseNormalBrowserUi(view);
    }
    return view;
}
Also used : ImageView(android.widget.ImageView) IWebView(org.mozilla.focus.web.IWebView) View(android.view.View) TextView(android.widget.TextView) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) AverageLoadTimeObserver(org.mozilla.focus.observer.AverageLoadTimeObserver) BrowserMenu(org.mozilla.focus.menu.browser.BrowserMenu) ImageView(android.widget.ImageView)

Aggregations

SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)115 View (android.view.View)65 RecyclerView (android.support.v7.widget.RecyclerView)58 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)43 TextView (android.widget.TextView)30 Bundle (android.os.Bundle)21 Intent (android.content.Intent)20 Handler (android.os.Handler)17 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)16 Toolbar (android.support.v7.widget.Toolbar)16 ArrayList (java.util.ArrayList)16 AdapterView (android.widget.AdapterView)14 ListView (android.widget.ListView)12 ImageView (android.widget.ImageView)11 GridLayoutManager (android.support.v7.widget.GridLayoutManager)10 Context (android.content.Context)9 LayoutInflater (android.view.LayoutInflater)9 ViewGroup (android.view.ViewGroup)9 DialogInterface (android.content.DialogInterface)8 FrameLayout (android.widget.FrameLayout)7