Search in sources :

Example 6 with PublicUser

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;
}
Also used : PublicUser(com.example.c4q.capstone.database.publicuserdata.PublicUser) UserIcon(com.example.c4q.capstone.database.publicuserdata.UserIcon)

Example 7 with PublicUser

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;
}
Also used : EventGuest(com.example.c4q.capstone.database.events.EventGuest) PublicUser(com.example.c4q.capstone.database.publicuserdata.PublicUser) HashMap(java.util.HashMap)

Example 8 with PublicUser

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) {
        }
    });
}
Also used : PublicUser(com.example.c4q.capstone.database.publicuserdata.PublicUser) DatabaseError(com.google.firebase.database.DatabaseError) ArrayList(java.util.ArrayList) ValueEventListener(com.google.firebase.database.ValueEventListener) DataSnapshot(com.google.firebase.database.DataSnapshot)

Example 9 with PublicUser

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);
}
Also used : PublicUser(com.example.c4q.capstone.database.publicuserdata.PublicUser) DatabaseError(com.google.firebase.database.DatabaseError) ValueEventListener(com.google.firebase.database.ValueEventListener) DataSnapshot(com.google.firebase.database.DataSnapshot)

Example 10 with PublicUser

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);
}
Also used : PublicUser(com.example.c4q.capstone.database.publicuserdata.PublicUser) DatabaseError(com.google.firebase.database.DatabaseError) ValueEventListener(com.google.firebase.database.ValueEventListener) DataSnapshot(com.google.firebase.database.DataSnapshot)

Aggregations

PublicUser (com.example.c4q.capstone.database.publicuserdata.PublicUser)17 DataSnapshot (com.google.firebase.database.DataSnapshot)8 DatabaseError (com.google.firebase.database.DatabaseError)8 ValueEventListener (com.google.firebase.database.ValueEventListener)8 UserIcon (com.example.c4q.capstone.database.publicuserdata.UserIcon)6 PrivateUser (com.example.c4q.capstone.database.privateuserdata.PrivateUser)4 PrivateUserLocation (com.example.c4q.capstone.database.privateuserdata.PrivateUserLocation)4 View (android.view.View)3 FBUserDataListener (com.example.c4q.capstone.utils.FBUserDataListener)2 FirebaseAuth (com.google.firebase.auth.FirebaseAuth)2 HashMap (java.util.HashMap)2 Intent (android.content.Intent)1 LocationManager (android.location.LocationManager)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 EventGuest (com.example.c4q.capstone.database.events.EventGuest)1 Venue (com.example.c4q.capstone.database.events.Venue)1 PublicUserDetails (com.example.c4q.capstone.database.publicuserdata.PublicUserDetails)1 ContactListAdapter (com.example.c4q.capstone.userinterface.user.userprofilefragments.userprofilecontroller.ContactListAdapter)1 ContactListViewHolder (com.example.c4q.capstone.userinterface.user.userprofilefragments.userprofileviews.ContactListViewHolder)1