use of com.example.c4q.capstone.database.publicuserdata.PublicUser in project Grupp by tmoronta1208.
the class NewEventConverter method convertPubDetailsToPubUser.
public PublicUser convertPubDetailsToPubUser(PublicUserDetails publicUserDetails) {
PublicUser user = new PublicUser();
user.setRadius(Integer.parseInt(publicUserDetails.getRadius()));
user.setZip_code(String.valueOf(publicUserDetails.getZip_code()));
UserIcon userIcon = new UserIcon();
userIcon.setIcon_url(publicUserDetails.getIcon_url());
user.setUser_icon(userIcon);
user.setFirst_name(publicUserDetails.getFirst_name());
user.setLast_name(publicUserDetails.getLast_name());
user.setUser_id(publicUserDetails.getUid());
return user;
}
use of com.example.c4q.capstone.database.publicuserdata.PublicUser in project Grupp by tmoronta1208.
the class NewEventConverter method guestMapFromPubUser.
public HashMap<String, EventGuest> guestMapFromPubUser(List<PublicUser> guestList, boolean confirmed) {
HashMap<String, EventGuest> guestHashMap = new HashMap<>();
for (PublicUser user : guestList) {
EventGuest eventGuest = eventGuestFromPUblicUser(user, confirmed);
guestHashMap.put(eventGuest.getUser_id(), eventGuest);
}
return guestHashMap;
}
use of com.example.c4q.capstone.database.publicuserdata.PublicUser in project Grupp by tmoronta1208.
the class CurrentUserUtility method getCurrentUserFriends.
/**
* ajoxe:
* this method gets current users friends as public user objects
*/
public void getCurrentUserFriends() {
Log.d(TAG, "get current user friends called :");
publicUserReference.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
userFriendsPublicUserList = new ArrayList<>();
if (userHasFriends && userFriendIds.size() != 0) {
for (final String friendID : userFriendIds) {
if (dataSnapshot.child(friendID).getValue(PublicUser.class) != null) {
PublicUser user = dataSnapshot.child(friendID).getValue(PublicUser.class);
userFriendsPublicUserList.add(user);
}
}
Log.d(TAG, "get current user friends called : list size = " + userFriendsPublicUserList.size());
currentUserListener.getUserFriends(userFriendsPublicUserList);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
use of com.example.c4q.capstone.database.publicuserdata.PublicUser in project Grupp by tmoronta1208.
the class CurrentUserUtility method getCurrentPublicUserProfile.
public static void getCurrentPublicUserProfile() {
ValueEventListener publicUserListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (currentUserExists) {
PublicUser user = dataSnapshot.child(currentUserID).getValue(PublicUser.class);
if (user != null) {
userHasPublicProfile = true;
Log.d(TAG, "getPublicUser: user first name: " + user.getFirst_name());
// currentUserListener.getPublicUser(user);
// userListener.publicUserExists(userHasPublicProfile);
} else {
userHasPublicProfile = false;
}
Log.d(TAG, "getPublicUser: user has public profile " + userHasPublicProfile);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
// Getting Post failed, log a message
Log.d(TAG, "loadPost:onCancelled", databaseError.toException());
// ...
}
};
publicStaticUserReference.addListenerForSingleValueEvent(publicUserListener);
}
use of com.example.c4q.capstone.database.publicuserdata.PublicUser in project Grupp by tmoronta1208.
the class FBUserDataUtility method getPublicUser.
/**
*ajoxe:
* this method get a single public user from the datatbase
*/
public void getPublicUser(final String userID, final FBUserDataListener userDataListener) {
ValueEventListener userListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
// Get Post object and use the values to update the UI
PublicUser user = dataSnapshot.child(userID).getValue(PublicUser.class);
if (user != null) {
Log.w(TAG, "getPublicUser: user first name: " + user.getFirst_name());
userDataListener.getPublicUser(user);
}
// ...
}
@Override
public void onCancelled(DatabaseError databaseError) {
// Getting Post failed, log a message
Log.w(TAG, "loadPost:onCancelled", databaseError.toException());
// ...
}
};
publicUserReference.addListenerForSingleValueEvent(userListener);
}
Aggregations