public void goToAllContactList(View v) { for (Contact contact : allContactsList) { Log.d(TAG, "inside gotoAllContactList " + contact.isSelected()); } Intent intent = new Intent(this, AllFriendsList.class); intent.putParcelableArrayListExtra("FRIENDS_LIST", (ArrayList<Contact>) allContactsList); startActivityForResult(intent, 1); }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK && requestCode == 1) { allContactsList = data.getParcelableArrayListExtra("SELECTED_CONTACTS_LIST"); selectedList.clear(); for (Contact contact : allContactsList) { if (contact.isSelected()) { selectedList.add(contact); } } for (Contact contact : allContactsList) { Log.d(TAG, "inside gotoAllContactList " + contact.isSelected()); } contactListViewAdapter.updateList(selectedList); contactListViewAdapter.notifyDataSetChanged(); } }
// Replace the contents of a view (invoked by the layout manager) @Override public void onBindViewHolder(ViewHolder holder, final int position) { // - get element from your dataset at this position // - replace the contents of the view with that element final Contact contactsItem = mDataset.get(position); final String name = contactsItem.getPhoneBookName() == null ? contactsItem.getProfileName() : contactsItem.getPhoneBookName(); final String status = contactsItem.getStatus() == null ? "" : contactsItem.getStatus(); final String picLocalURL = contactsItem.getPicLocalUrl(); Log.d(TAG, "info are : " + name + "---" + status + "---" + picLocalURL); if (picLocalURL != null) { Bitmap bitmap = BitmapFactory.decodeFile(picLocalURL, new BitmapFactory.Options()); holder.buddyPicImageView.setImageBitmap(bitmap); } else { holder.buddyPicImageView.setImageResource(R.drawable.gumnaam_profile_image); } holder.buddyName.setText(name); holder.buddyStatus.setText(status); if (HelpMe.isAdmin(context) && !contactsItem.getIdOnServer().equals(TJPreferences.getUserId(context))) { holder.removeBuddyIcon.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { new AlertDialog.Builder(context) .setTitle("Remove Friend") .setMessage("Are you sure you want to remove your friend from this journey") .setPositiveButton( android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { mDialog.show(); JourneyUtil.getInstance() .setExitJourneyListener(JourneyInfoBuddiesListAdapter.this); JourneyUtil.getInstance() .exitJourney(context, mDataset.get(position).getIdOnServer()); } }) .setNegativeButton( android.R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing } }) .setIcon(android.R.drawable.ic_dialog_alert) .show(); } }); } else { holder.removeBuddyIcon.setVisibility(View.GONE); } Journey journey = JourneyDataSource.getJourneyById(context, TJPreferences.getActiveJourneyId(context)); if (journey.getCreatedBy().equals(contactsItem.getIdOnServer())) { holder.adminText.setVisibility(View.VISIBLE); } else { holder.adminText.setVisibility(View.GONE); } }