Search in sources :

Example 36 with SwipeRefreshLayout

use of android.support.v4.widget.SwipeRefreshLayout in project Devsfolio by Madonahs.

the class PostActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_add_feeds);
    ButterKnife.bind(this);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle(stringPost);
    mPost = new ArrayList<>();
    receivedPost = (Post) getIntent().getSerializableExtra("post");
    mPost.add(receivedPost);
    mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefresh);
    mSwipeRefreshLayout.setColorSchemeColors(ContextCompat.getColor(this, R.color.colorAccent));
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            updatePost();
        }
    });
    mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
    /* use this setting to improve performance if you know that changes
        in content do not change the layout size of the RecyclerView*/
    mRecyclerView.setHasFixedSize(true);
    // use a linear layout manager
    mLayoutManager = new LinearLayoutManager(this);
    mRecyclerView.setLayoutManager(mLayoutManager);
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) Toolbar(android.support.v7.widget.Toolbar)

Example 37 with SwipeRefreshLayout

use of android.support.v4.widget.SwipeRefreshLayout in project underlx by underlx.

the class GeneralPreferenceFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);
    getActivity().setTitle(getString(R.string.frag_settings_title));
    if (mListener != null) {
        mListener.checkNavigationDrawerItem(R.id.nav_settings);
    }
    FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
    fab.hide();
    SwipeRefreshLayout srl = (SwipeRefreshLayout) getActivity().findViewById(R.id.swipe_container);
    srl.setEnabled(false);
    return view;
}
Also used : FloatingActionButton(android.support.design.widget.FloatingActionButton) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout)

Example 38 with SwipeRefreshLayout

use of android.support.v4.widget.SwipeRefreshLayout in project underlx by underlx.

the class NotifPreferenceFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);
    getActivity().setTitle(getString(R.string.frag_notif_title));
    if (mListener != null) {
        mListener.checkNavigationDrawerItem(R.id.nav_notif);
    }
    FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
    fab.hide();
    SwipeRefreshLayout srl = (SwipeRefreshLayout) getActivity().findViewById(R.id.swipe_container);
    srl.setEnabled(false);
    IntentFilter filter = new IntentFilter();
    filter.addAction(MainActivity.ACTION_MAIN_SERVICE_BOUND);
    filter.addAction(MainService.ACTION_UPDATE_TOPOLOGY_FINISHED);
    LocalBroadcastManager bm = LocalBroadcastManager.getInstance(view.getContext());
    bm.registerReceiver(mBroadcastReceiver, filter);
    return view;
}
Also used : IntentFilter(android.content.IntentFilter) FloatingActionButton(android.support.design.widget.FloatingActionButton) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) LocalBroadcastManager(android.support.v4.content.LocalBroadcastManager)

Example 39 with SwipeRefreshLayout

use of android.support.v4.widget.SwipeRefreshLayout in project underlx by underlx.

the class TopFragment method setUpActivity.

protected void setUpActivity(String title, int navDrawerId, boolean withFab, boolean withRefresh) {
    getActivity().setTitle(title);
    if (mListener != null) {
        mListener.checkNavigationDrawerItem(navDrawerId);
    }
    FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
    if (withFab) {
        fab.show();
        CoordinatorLayout.LayoutParams params = new CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        params.gravity = Gravity.BOTTOM | Gravity.RIGHT;
        params.setMargins(getResources().getDimensionPixelOffset(R.dimen.fab_margin), getResources().getDimensionPixelOffset(R.dimen.fab_margin), getResources().getDimensionPixelOffset(R.dimen.fab_margin), getResources().getDimensionPixelOffset(R.dimen.fab_margin));
        fab.setLayoutParams(params);
    } else {
        fab.hide();
    }
    fab.setOnClickListener(null);
    SwipeRefreshLayout srl = (SwipeRefreshLayout) getActivity().findViewById(R.id.swipe_container);
    srl.setEnabled(withRefresh);
    srl.setRefreshing(false);
    srl.setOnRefreshListener(null);
}
Also used : CoordinatorLayout(android.support.design.widget.CoordinatorLayout) FloatingActionButton(android.support.design.widget.FloatingActionButton) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout)

Example 40 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)

Aggregations

SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)102 View (android.view.View)55 RecyclerView (android.support.v7.widget.RecyclerView)43 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)41 TextView (android.widget.TextView)29 Bundle (android.os.Bundle)21 Intent (android.content.Intent)17 Handler (android.os.Handler)17 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)16 AdapterView (android.widget.AdapterView)15 ListView (android.widget.ListView)15 ArrayList (java.util.ArrayList)13 ImageView (android.widget.ImageView)10 ViewGroup (android.view.ViewGroup)9 Context (android.content.Context)8 LayoutInflater (android.view.LayoutInflater)8 GridLayoutManager (android.support.v7.widget.GridLayoutManager)7 PandaRecyclerView (com.instructure.pandarecycler.PandaRecyclerView)7 SearchView (android.support.v7.widget.SearchView)6 Toolbar (android.support.v7.widget.Toolbar)6