@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.create_key_email_fragment, container, false); mEmailEdit = (EmailEditText) view.findViewById(R.id.create_key_email); View backButton = view.findViewById(R.id.create_key_back_button); View nextButton = view.findViewById(R.id.create_key_next_button); CheatSheet.setup(backButton, getContentDescription(backButton)); CheatSheet.setup(nextButton, getContentDescription(nextButton)); RecyclerView emailsRecyclerView = (RecyclerView) view.findViewById(R.id.create_key_emails); // initial values mEmailEdit.setText(mCreateKeyActivity.mEmail); // focus empty edit fields if (mCreateKeyActivity.mEmail == null) { mEmailEdit.requestFocus(); } backButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { mCreateKeyActivity.loadFragment(null, FragAction.TO_LEFT); } }); nextButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { nextClicked(); } }); emailsRecyclerView.setHasFixedSize(true); emailsRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); emailsRecyclerView.setItemAnimator(new DefaultItemAnimator()); if (mEmailAdapter == null) { mEmailAdapter = new EmailAdapter( mAdditionalEmailModels, new View.OnClickListener() { @Override public void onClick(View v) { addEmail(); } }); if (mCreateKeyActivity.mAdditionalEmails != null) { mEmailAdapter.addAll(mCreateKeyActivity.mAdditionalEmails); } } emailsRecyclerView.setAdapter(mEmailAdapter); return view; }
public ViewHolder(View itemView) { super(itemView); mTextView = (TextView) itemView.findViewById(R.id.create_key_email_item_email); mDeleteButton = (ImageButton) itemView.findViewById(R.id.create_key_email_item_delete_button); CheatSheet.setup(mDeleteButton, getContentDescription(mDeleteButton)); }
public FooterHolder(View itemView) { super(itemView); mAddButton = (Button) itemView.findViewById(R.id.create_key_add_email); CheatSheet.setup(mAddButton, getContentDescription(mAddButton)); }