use of com.example.c4q.capstone.userinterface.user.userprofilefragments.userprofilecontroller.ContactListAdapter in project Grupp by tmoronta1208.
the class InvitedFriendsFragment method convertIdsToUsers.
public void convertIdsToUsers(ArrayList<String> invitedList) {
friendsUserIDList = new ArrayList<>();
friendsUserIDList.addAll(invitedList);
Log.d("UserFriends Fragment", "convertIdsTousers");
if (friendsUserIDList != null) {
if (friendsUserIDList.size() != 0) {
for (String s : friendsUserIDList) {
userDataUtility.getPublicUser(s, new FBUserDataListener() {
@Override
public void getUid(String userID) {
}
@Override
public void getPublicUser(PublicUser publicUser) {
friendsUserList.add(publicUser);
}
});
}
if (friendsUserList != null) {
if (getActivity() != null) {
contactListAdapter = new ContactListAdapter(PublicUserDetails.class, R.layout.contact_item_view, ContactListViewHolder.class, contactsRef);
linearLayoutManager = new LinearLayoutManager(getActivity().getApplicationContext());
recyclerView.setAdapter(contactListAdapter);
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.addItemDecoration(new SimpleDividerItemDecoration(getContext()));
}
}
}
} else {
}
}
use of com.example.c4q.capstone.userinterface.user.userprofilefragments.userprofilecontroller.ContactListAdapter in project Grupp by tmoronta1208.
the class ContactListFragment method onCreateView.
/* public static ContactListFragment newInstance(String title) {
ContactListFragment fragment = new ContactListFragment();
Bundle args = new Bundle();
args.putString("title", title);
fragment.setArguments(args);
return fragment;
}*/
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
view = inflater.inflate(R.layout.fragment_contactlist, container, false);
searchView = view.findViewById(R.id.search_bar_cl);
searchView.setHint("Name, #Grupptag, Email");
searchView.setHintTextColor(getActivity().getResources().getColor(R.color.hintcolor));
String currentUserId = CurrentUser.getInstance().getUserID();
DatabaseReference contactsRef = FirebaseDatabase.getInstance().getReference().child(USER_CONTACTS).child(currentUserId);
recyclerView = view.findViewById(R.id.contact_list_rec);
recyclerView.setHasFixedSize(true);
LinearLayoutManager linearLayout = new LinearLayoutManager(view.getContext());
contactListAdapter = new ContactListAdapter(PublicUserDetails.class, R.layout.contact_item_view, ContactListViewHolder.class, contactsRef);
/**
*ajoxe:
* after modifying the adapter, set the list as friendsUserList
* contactListAdapter = new ContactListAdapter(friendsUserList, getContext());
*/
recyclerView.setAdapter(contactListAdapter);
recyclerView.addItemDecoration(new SimpleDividerItemDecoration(getContext()));
recyclerView.setLayoutManager(linearLayout);
return view;
}
use of com.example.c4q.capstone.userinterface.user.userprofilefragments.userprofilecontroller.ContactListAdapter in project Grupp by tmoronta1208.
the class InvitedFriendsFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String currentUserId = CurrentUser.getInstance().getUserID();
contactsRef = FirebaseDatabase.getInstance().getReference().child(USER_CONTACTS).child(currentUserId).child("contacts");
contactListAdapter = new ContactListAdapter(PublicUserDetails.class, R.layout.contact_item_view, ContactListViewHolder.class, contactsRef);
args = getArguments();
if (args != null) {
if (args.getStringArrayList("invitedFriends") != null) {
ArrayList<String> invitedFriends = args.getStringArrayList("invitedFriends");
Log.d("UserFriends Fragment", "on create: invited list array size:" + invitedFriends.size());
friendsUserIDList = invitedFriends;
convertIdsToUsers(invitedFriends);
}
}
if (friendsUserIDList == null || friendsUserIDList.size() == 0) {
Log.d("UserFriends Fragment", "on createview: invited list array is null");
} else {
convertIdsToUsers(friendsUserIDList);
if (friendsUserList != null) {
if (getActivity() != null) {
contactListAdapter = new ContactListAdapter(PublicUserDetails.class, R.layout.contact_item_view, ContactListViewHolder.class, contactsRef);
linearLayoutManager = new LinearLayoutManager(getActivity().getApplicationContext());
recyclerView.setAdapter(contactListAdapter);
recyclerView.setLayoutManager(linearLayoutManager);
}
}
}
}
Aggregations