Search in sources :

Example 16 with PublicUser

use of com.example.c4q.capstone.database.publicuserdata.PublicUser in project Grupp by tmoronta1208.

the class TempUserActivity method currentUserProfileData.

public void currentUserProfileData() {
    iconRef.addValueEventListener(new ValueEventListener() {

        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            UserIcon userIcon = dataSnapshot.getValue(UserIcon.class);
            try {
                String userIconUrl = userIcon.getIcon_url();
                Glide.with(TempUserActivity.this).load(userIconUrl).into(profilePic);
            } catch (NullPointerException e) {
                e.printStackTrace();
                profilePic.setImageResource(R.drawable.default_avatar);
            }
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {
        }
    });
    userRef.addValueEventListener(new ValueEventListener() {

        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            PublicUser publicUser = dataSnapshot.getValue(PublicUser.class);
            StringBuilder sb = new StringBuilder();
            sb.append(publicUser.getFirst_name());
            sb.append(" ");
            sb.append(publicUser.getLast_name());
            personName.setText(sb.toString());
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {
        }
    });
}
Also used : PublicUser(com.example.c4q.capstone.database.publicuserdata.PublicUser) DatabaseError(com.google.firebase.database.DatabaseError) UserIcon(com.example.c4q.capstone.database.publicuserdata.UserIcon) ValueEventListener(com.google.firebase.database.ValueEventListener) DataSnapshot(com.google.firebase.database.DataSnapshot)

Example 17 with PublicUser

use of com.example.c4q.capstone.database.publicuserdata.PublicUser in project Grupp by tmoronta1208.

the class VenueNetworkUtility method getVoteListFromFourSquare.

public void getVoteListFromFourSquare(List<PublicUser> eventGuests) {
    if (eventGuests != null) {
        Log.d(TAG, "venue util eventGuests" + eventGuests.size());
        // eventGuests.add(CurrentUser.getInstance().getCurrentPublicUser());
        String preferences = "beer karaoke";
        final int callCount = eventGuests.size();
        for (PublicUser guest : eventGuests) {
            final String id = guest.getUser_id();
            String zipCode = guest.getZip_code();
            int radius = guest.getRadius();
            radius = radius * 1609;
            String userRadius = String.valueOf(radius);
            Log.d(TAG, "user radius" + guest.getFirst_name() + " : " + userRadius);
            NetworkUtility.getNetworkUtility().getFourSQList(zipCode, userRadius, preferences, new VenueNetworkListener() {

                @Override
                public void getFourSList(List<Venue> fourSVenues) {
                    Log.d(TAG, "Venue Network Listener called");
                    Log.d(TAG, "list size" + fourSVenues.size());
                    Log.d(TAG, "user" + id);
                    HashMap<String, Venue> listMap = new HashMap<>();
                    for (Venue venue : fourSVenues) {
                        listMap.put(venue.getVenue_id(), venue);
                    }
                    venueMap.put(id, listMap);
                    if (venueMap.size() == callCount) {
                        Log.d(TAG, "ready to compare lists");
                        compareUserVenueLists();
                    }
                    Log.d(TAG, "not ready " + callCount);
                }

                @Override
                public void getFourSVenueIds(List<String> fourSquareVenueIds) {
                }
            });
        }
    }
}
Also used : PublicUser(com.example.c4q.capstone.database.publicuserdata.PublicUser) Venue(com.example.c4q.capstone.database.events.Venue) HashMap(java.util.HashMap)

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