use of org.wikipedia.views.DrawableItemDecoration in project apps-android-wikipedia by wikimedia.
the class NotificationActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_notifications);
ButterKnife.bind(this);
errorView.setRetryClickListener((v) -> beginUpdateList());
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.addItemDecoration(new DrawableItemDecoration(this, R.attr.list_separator_drawable));
ItemTouchHelper.Callback touchCallback = new SwipeableItemTouchHelperCallback(this, ResourceUtil.getThemedAttributeId(this, R.attr.chart_shade5), R.drawable.ic_archive_white_24dp, ResourceUtil.getThemedAttributeId(this, R.attr.secondary_text_color));
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(touchCallback);
itemTouchHelper.attachToRecyclerView(recyclerView);
swipeRefreshLayout.setOnRefreshListener(() -> {
swipeRefreshLayout.setRefreshing(false);
beginUpdateList();
});
beginUpdateList();
NotificationSettingsActivity.promptEnablePollDialog(this);
}
use of org.wikipedia.views.DrawableItemDecoration in project apps-android-wikipedia by wikimedia.
the class ListCardView method initRecycler.
/**
* Called by the constructor. Override to provide custom behavior but otherwise do not call
* directly.
*/
protected void initRecycler(@NonNull RecyclerView recyclerView) {
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.addItemDecoration(new DrawableItemDecoration(getContext(), R.attr.list_separator_drawable));
recyclerView.setNestedScrollingEnabled(false);
}
use of org.wikipedia.views.DrawableItemDecoration in project apps-android-wikipedia by wikimedia.
the class ReadingListsFragment method onCreateView.
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_reading_lists, container, false);
unbinder = ButterKnife.bind(this, view);
searchEmptyView.setEmptyText(R.string.search_reading_lists_no_results);
readingListView.setLayoutManager(new LinearLayoutManager(getContext()));
readingListView.setAdapter(adapter);
readingListView.addItemDecoration(new DrawableItemDecoration(requireContext(), R.attr.list_separator_drawable, false));
readingListView.addItemDecoration(new MarginItemDecoration(0, 0, 0, DimenUtil.roundedDpToPx(DimenUtil.getDimension(R.dimen.floating_queue_container_height))) {
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
if (parent.getChildAdapterPosition(view) == adapter.getItemCount() - 1 && ((MainActivity) requireActivity()).isFloatingQueueEnabled() && readingLists.size() > 1) {
super.getItemOffsets(outRect, view, parent, state);
}
}
});
disposables.add(WikipediaApp.getInstance().getBus().subscribe(new EventBusConsumer()));
contentContainer.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
emptyContainer.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
((ViewGroup) emptyContainer.getChildAt(0)).getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
swipeRefreshLayout.setColorSchemeResources(getThemedAttributeId(requireContext(), R.attr.colorAccent));
swipeRefreshLayout.setOnRefreshListener(() -> refreshSync(ReadingListsFragment.this, swipeRefreshLayout));
if (ReadingListSyncAdapter.isDisabledByRemoteConfig()) {
swipeRefreshLayout.setEnabled(false);
}
return view;
}
use of org.wikipedia.views.DrawableItemDecoration in project apps-android-wikipedia by wikimedia.
the class MostReadFragment method initRecycler.
private void initRecycler() {
mostReadLinks.setLayoutManager(new LinearLayoutManager(getContext()));
mostReadLinks.addItemDecoration(new DrawableItemDecoration(requireContext(), R.attr.list_separator_drawable));
mostReadLinks.setNestedScrollingEnabled(false);
}
Aggregations