use of org.wikipedia.views.HeaderMarginItemDecoration in project apps-android-wikipedia by wikimedia.
the class FeedView method init.
private void init() {
setVerticalScrollBarEnabled(true);
recyclerLayoutManager = new StaggeredGridLayoutManager(getColumns(), StaggeredGridLayoutManager.VERTICAL);
setItemAnimator(new FeedItemAnimator());
setLayoutManager(recyclerLayoutManager);
addItemDecoration(new MarginItemDecoration(getContext(), R.dimen.view_list_card_margin_horizontal, R.dimen.view_list_card_margin_vertical, R.dimen.view_list_card_margin_horizontal, R.dimen.view_list_card_margin_vertical));
addItemDecoration(new HeaderMarginItemDecoration(getContext(), R.dimen.view_feed_padding_top, R.dimen.view_feed_search_padding_bottom));
setCallback(new RecyclerViewColumnCallback());
setClipChildren(false);
}
use of org.wikipedia.views.HeaderMarginItemDecoration in project apps-android-wikipedia by wikimedia.
the class OnThisDayFragment method onCreateView.
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_on_this_day, container, false);
AnimationUtil.setSharedElementTransitions(requireActivity());
unbinder = ButterKnife.bind(this, view);
int age = requireActivity().getIntent().getIntExtra(AGE, 0);
wiki = requireActivity().getIntent().getParcelableExtra(WIKISITE);
date = DateUtil.getDefaultDateFor(age);
setUpToolbar();
eventsRecycler.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
final int topDecorationDp = 24;
eventsRecycler.addItemDecoration(new HeaderMarginItemDecoration(topDecorationDp, 0));
setUpRecycler(eventsRecycler);
errorView.setBackClickListener(v -> requireActivity().finish());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && requireActivity().getWindow().getSharedElementEnterTransition() != null && savedInstanceState == null) {
final int animDelay = 500;
dayText.postDelayed(() -> {
if (!isAdded() || dayText == null) {
return;
}
updateContents(age);
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), dayText.getCurrentTextColor(), ResourceUtil.getThemedColor(requireContext(), R.attr.main_toolbar_title_color));
colorAnimation.addUpdateListener(animator -> {
if (dayText != null) {
dayText.setTextColor((Integer) animator.getAnimatedValue());
}
});
colorAnimation.start();
}, animDelay);
} else {
dayText.setTextColor(ResourceUtil.getThemedColor(requireContext(), R.attr.main_toolbar_title_color));
updateContents(age);
}
eventsRecycler.setVisibility(View.GONE);
errorView.setVisibility(View.GONE);
return view;
}
use of org.wikipedia.views.HeaderMarginItemDecoration in project apps-android-wikipedia by wikimedia.
the class EditTasksFragment method setUpRecyclerView.
private void setUpRecyclerView() {
tasksRecyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
final int topDecorationDp = 16;
tasksRecyclerView.addItemDecoration(new HeaderMarginItemDecoration(topDecorationDp, 0));
tasksRecyclerView.addItemDecoration(new FooterMarginItemDecoration(0, topDecorationDp));
setUpTasks();
RecyclerAdapter adapter = new RecyclerAdapter(tasks);
tasksRecyclerView.setAdapter(adapter);
}
Aggregations