use of androidx.recyclerview.widget.RecyclerView in project epoxy by airbnb.
the class ModelClickListenerTest method mockCompoundButtonForClicking.
private CompoundButton mockCompoundButtonForClicking(EpoxyModel model) {
CompoundButton mockedView = mock(CompoundButton.class);
RecyclerView recyclerMock = mock(RecyclerView.class);
EpoxyViewHolder holderMock = mock(EpoxyViewHolder.class);
when(holderMock.getAdapterPosition()).thenReturn(1);
doReturn(recyclerMock).when(mockedView).getParent();
doReturn(holderMock).when(recyclerMock).findContainingViewHolder(mockedView);
doReturn(model).when(holderMock).getModel();
when(mockedView.getParent()).thenReturn(recyclerMock);
when(recyclerMock.findContainingViewHolder(mockedView)).thenReturn(holderMock);
when(holderMock.getAdapterPosition()).thenReturn(1);
when(holderMock.getModel()).thenReturn(model);
View parentView = mock(View.class);
when(holderMock.objectToBind()).thenReturn(parentView);
doReturn(parentView).when(holderMock).objectToBind();
return mockedView;
}
use of androidx.recyclerview.widget.RecyclerView in project epoxy by airbnb.
the class ListenersUtils method getEpoxyHolderForChildView.
@Nullable
static EpoxyViewHolder getEpoxyHolderForChildView(View v) {
RecyclerView recyclerView = findParentRecyclerView(v);
if (recyclerView == null) {
return null;
}
ViewHolder viewHolder = recyclerView.findContainingViewHolder(v);
if (viewHolder == null) {
return null;
}
if (!(viewHolder instanceof EpoxyViewHolder)) {
return null;
}
return (EpoxyViewHolder) viewHolder;
}
use of androidx.recyclerview.widget.RecyclerView in project Signal-Android by WhisperSystems.
the class ReviewCardDialogFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
try {
initializeViewModel();
} catch (BadGroupIdException e) {
throw new IllegalStateException(e);
}
TextView description = view.findViewById(R.id.description);
RecyclerView recycler = view.findViewById(R.id.recycler);
ReviewCardAdapter adapter = new ReviewCardAdapter(getNoGroupsInCommonResId(), getGroupsInCommonResId(), new AdapterCallbacks());
recycler.setAdapter(adapter);
viewModel.getReviewCards().observe(getViewLifecycleOwner(), cards -> {
adapter.submitList(cards);
description.setText(getString(getDescriptionResId(), cards.size()));
});
viewModel.getReviewEvents().observe(getViewLifecycleOwner(), this::onReviewEvent);
}
use of androidx.recyclerview.widget.RecyclerView in project xabber-android by redsolution.
the class ServerInfoActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_server_info);
final Intent intent = getIntent();
AccountJid account = getAccount(intent);
if (account == null) {
finish();
return;
}
accountItem = AccountManager.getInstance().getAccount(account);
if (accountItem == null) {
Application.getInstance().onError(R.string.NO_SUCH_ACCOUNT);
finish();
return;
}
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
toolbar.setTitle(accountItem.getConnection().getXMPPServiceDomain());
BarPainter barPainter = new BarPainter(this, toolbar);
barPainter.updateWithAccountName(account);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.server_info_recycler_view);
serverInfoAdapter = new ServerInfoAdapter();
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(serverInfoAdapter);
progressBar = findViewById(R.id.server_info_progress_bar);
requestServerInfo();
}
use of androidx.recyclerview.widget.RecyclerView in project xabber-android by redsolution.
the class MessageVH method setupForwarded.
protected void setupForwarded(MessageItem messageItem, MessagesAdapter.MessageExtraData extraData) {
String[] forwardedIDs = messageItem.getForwardedIdsAsArray();
if (!Arrays.asList(forwardedIDs).contains(null)) {
RealmResults<MessageItem> forwardedMessages = MessageDatabaseManager.getInstance().getRealmUiThread().where(MessageItem.class).in(MessageItem.Fields.UNIQUE_ID, forwardedIDs).findAllSorted(MessageItem.Fields.TIMESTAMP, Sort.ASCENDING);
if (forwardedMessages.size() > 0) {
RecyclerView recyclerView = forwardLayout.findViewById(R.id.recyclerView);
ForwardedAdapter adapter = new ForwardedAdapter(forwardedMessages, extraData);
recyclerView.setLayoutManager(new LinearLayoutManager(extraData.getContext()));
recyclerView.setAdapter(adapter);
forwardLayout.setBackgroundColor(ColorManager.getColorWithAlpha(R.color.forwarded_background_color, 0.2f));
forwardLeftBorder.setBackgroundColor(extraData.getAccountMainColor());
forwardLayout.setVisibility(View.VISIBLE);
}
}
}
Aggregations