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);
}
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;
}
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;
}
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);
}
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);
}
Aggregations