Search in sources :

Example 46 with SwipeRefreshLayout

use of android.support.v4.widget.SwipeRefreshLayout in project RoMote by wseemann.

the class MainFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_main, container, false);
    mSelectDeviceText = (TextView) view.findViewById(R.id.select_device_text);
    mProgressLayout = (RelativeLayout) view.findViewById(R.id.progress_layout);
    mList = (ListView) view.findViewById(android.R.id.list);
    View emptyView = view.findViewById(android.R.id.empty);
    mList.setEmptyView(emptyView);
    mSwiperefresh = (SwipeRefreshLayout) view.findViewById(R.id.swiperefresh);
    mSwiperefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            // This method performs the actual data-refresh operation.
            // The method calls setRefreshing(false) when it's finished.
            setLoadingText(true);
            getLoaderManager().restartLoader(0, new Bundle(), mAvailableDevicesLoader);
        }
    });
    mFab = (FloatingActionButton) view.findViewById(R.id.fab);
    return view;
}
Also used : Bundle(android.os.Bundle) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout)

Example 47 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 48 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 49 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 50 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)

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