use of com.moez.QKSMS.ui.view.ComposeView in project qksms by moezbhatti.
the class ComposeFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_compose, container, false);
mRecipients = (AutoCompleteContactView) view.findViewById(R.id.compose_recipients);
mRecipients.setOnItemClickListener(this);
mComposeView = (ComposeView) view.findViewById(R.id.compose_view);
mComposeView.onOpenConversation(null, null);
mComposeView.setActivityLauncher(this);
mComposeView.setRecipientProvider(this);
mComposeView.setOnSendListener(this);
mComposeView.setLabel("Compose");
mStarredContactsView = (StarredContactsView) view.findViewById(R.id.starred_contacts);
mStarredContactsView.setComposeScreenViews(mRecipients, mComposeView);
new Handler().postDelayed(() -> KeyboardUtils.showAndFocus(mContext, mRecipients), 100);
return view;
}
use of com.moez.QKSMS.ui.view.ComposeView in project qksms by moezbhatti.
the class MessageListFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_conversation, container, false);
mRecyclerView = (MessageListRecyclerView) view.findViewById(R.id.conversation);
mAdapter = new MessageListAdapter(mContext);
mAdapter.setItemClickListener(this);
mAdapter.setMultiSelectListener(this);
mAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
private long mLastMessageId = -1;
@Override
public void onChanged() {
LinearLayoutManager manager = (LinearLayoutManager) mRecyclerView.getLayoutManager();
int position;
if (mRowId != -1 && mCursor != null) {
// Scroll to the position in the conversation for that message.
position = SmsHelper.getPositionForMessageId(mCursor, "sms", mRowId, mAdapter.getColumnsMap());
// Be sure to reset the row ID here---we only want to scroll to the message
// the first time the cursor is loaded after the row ID is set.
mRowId = -1;
} else {
position = mAdapter.getItemCount() - 1;
}
if (mAdapter.getCount() > 0) {
MessageItem lastMessage = mAdapter.getItem(mAdapter.getCount() - 1);
if (mLastMessageId >= 0 && mLastMessageId != lastMessage.getMessageId()) {
// Scroll to bottom only if a new message was inserted in this conversation
if (position != -1) {
manager.smoothScrollToPosition(mRecyclerView, null, position);
}
}
mLastMessageId = lastMessage.getMessageId();
}
}
});
mRecyclerView.setAdapter(mAdapter);
mLayoutManager = new SmoothLinearLayoutManager(mContext);
mLayoutManager.setStackFromEnd(true);
mRecyclerView.setLayoutManager(mLayoutManager);
mComposeView = (ComposeView) view.findViewById(R.id.compose_view);
mComposeView.setActivityLauncher(this);
mComposeView.setLabel("MessageList");
mRecyclerView.setComposeView(mComposeView);
return view;
}
Aggregations