use of androidx.recyclerview.widget.RecyclerView in project Tusky by Vavassor.
the class ViewThreadFragment method onCreateView.
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_view_thread, container, false);
Context context = getContext();
swipeRefreshLayout = rootView.findViewById(R.id.swipeRefreshLayout);
swipeRefreshLayout.setOnRefreshListener(this);
swipeRefreshLayout.setColorSchemeResources(R.color.tusky_blue);
recyclerView = rootView.findViewById(R.id.recyclerView);
recyclerView.setHasFixedSize(true);
LinearLayoutManager layoutManager = new LinearLayoutManager(context);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setAccessibilityDelegateCompat(new ListStatusAccessibilityDelegate(recyclerView, this, statuses::getPairedItemOrNull));
DividerItemDecoration divider = new DividerItemDecoration(context, layoutManager.getOrientation());
recyclerView.addItemDecoration(divider);
recyclerView.addItemDecoration(new ConversationLineItemDecoration(context));
alwaysShowSensitiveMedia = accountManager.getActiveAccount().getAlwaysShowSensitiveMedia();
alwaysOpenSpoiler = accountManager.getActiveAccount().getAlwaysOpenSpoiler();
reloadFilters();
recyclerView.setAdapter(adapter);
statuses.clear();
((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
return rootView;
}
use of androidx.recyclerview.widget.RecyclerView in project materialistic by hidroh.
the class FavoriteFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_favorite, container, false);
mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
mEmptySearchView = view.findViewById(R.id.empty_search);
mEmptyView = view.findViewById(R.id.empty);
mEmptyView.findViewById(R.id.header_card_view).setOnLongClickListener(v -> {
View bookmark = mEmptyView.findViewById(R.id.bookmarked);
bookmark.setVisibility(bookmark.getVisibility() == View.VISIBLE ? View.INVISIBLE : View.VISIBLE);
return true;
});
mEmptyView.setVisibility(View.INVISIBLE);
return view;
}
use of androidx.recyclerview.widget.RecyclerView in project materialistic by hidroh.
the class BaseListFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mRecyclerView.setLayoutManager(new SnappyLinearLayoutManager(getActivity(), false));
final int verticalMargin = getResources().getDimensionPixelSize(R.dimen.cardview_vertical_margin);
final int horizontalMargin = getResources().getDimensionPixelSize(R.dimen.cardview_horizontal_margin);
final int divider = getResources().getDimensionPixelSize(R.dimen.divider);
mRecyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
if (getAdapter().isCardViewEnabled()) {
outRect.set(horizontalMargin, verticalMargin, horizontalMargin, 0);
} else {
outRect.set(0, 0, 0, divider);
}
}
});
}
use of androidx.recyclerview.widget.RecyclerView in project PhotoView by chrisbanes.
the class ActivityTransitionActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_transition);
RecyclerView list = findViewById(R.id.list);
list.setLayoutManager(new GridLayoutManager(this, 2));
ImageAdapter imageAdapter = new ImageAdapter(new ImageAdapter.Listener() {
@Override
public void onImageClicked(View view) {
transition(view);
}
});
list.setAdapter(imageAdapter);
}
use of androidx.recyclerview.widget.RecyclerView in project materialistic by hidroh.
the class ThreadPreviewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Item item = getIntent().getParcelableExtra(EXTRA_ITEM);
if (item == null) {
finish();
return;
}
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_thread_preview);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
// noinspection ConstantConditions
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_HOME_AS_UP);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(new SnappyLinearLayoutManager(this, false));
recyclerView.addItemDecoration(new CommentItemDecoration(this));
recyclerView.setAdapter(new ThreadPreviewRecyclerViewAdapter(mItemManager, item));
mKeyDelegate.setScrollable(new KeyDelegate.RecyclerViewHelper(recyclerView, KeyDelegate.RecyclerViewHelper.SCROLL_ITEM), null);
}
Aggregations