SquadHouseDev / SquadHouse

https://squadhousedev.github.io/
0 stars 1 forks source link

To Do: Displaying Followers #45

Closed henrylao closed 3 years ago

henrylao commented 3 years ago

Classes In need of Usage:

Use the following to implement a feature for querying followers

void queryFollowers(User targetUser, RecyclerView.Adapter adapter, List<ParseUser> collection) {
    Log.i(TAG, "queryFollowers");
    collection.clear();
    ParseQuery<Follow> mainQuery = new ParseQuery<Follow>(Follow.class);
    mainQuery.whereEqualTo(Follow.KEY_TO, targetUser.getParseUser().getObjectId());
    mainQuery.findInBackground(new FindCallback<Follow>() {
        @Override
        public void done(List<Follow> objects, ParseException e) {
            Log.i(TAG, String.valueOf(objects.size()) + " followings");
            if (e == null) {
                // iterate over all Follow entries
                for (Follow c : objects) {
                    Log.i(TAG, c.getFollowTo().getObjectId());
                    collection.add((ParseUser) c.getFollowFrom());
                }
            } else {
            }
            // modify adapter to be used in
            adapter.notifyDataSetChanged();
        }
    });
}