Ejemplo n.º 1
0
 private void retrieveAccessTokenAndFacebookIdFromRelation(
     final UserDataRetrieveCallback callback) {
   ParseRelation relation = ParseUser.getCurrentUser().getRelation("ItsBeta");
   if (relation != null) {
     relation
         .getQuery()
         .findInBackground(
             new FindCallback() {
               @Override
               public void done(List<ParseObject> parseObjects, ParseException e) {
                 if (e == null) {
                   if (parseObjects.size() == 1) {
                     facebookId = parseObjects.get(0).getString("facebookUserId");
                     accessToken = parseObjects.get(0).getString("facebookAccessToken");
                     callback.done();
                   } else {
                     callback.relationNotFound();
                   }
                 } else {
                   callback.error();
                 }
               }
             });
   }
 }
Ejemplo n.º 2
0
  @Override
  protected void onListItemClick(ListView l, View v, final int position, long id) {
    super.onListItemClick(l, v, position, id);

    if (getListView().isItemChecked(position)) {
      // add friend
      mFriendsRelation.add(mUsers.get(position));

    } else {
      // remove friend
      mFriendsRelation.remove(mUsers.get(position));
    }

    mCurrentUser.saveInBackground(
        new SaveCallback() {
          @Override
          public void done(ParseException e) {
            if (e != null) {
              // failed

              Log.e(TAG, e.getMessage());
            }
          }
        });
  }
Ejemplo n.º 3
0
        @Override
        public void onClick(DialogInterface dialog, int which) {
          switch (which) {
            case 0: // make user into a moderator
              ParseRelation moderators =
                  TheGroupUtil.getCurrentGroup().getRelation(TheGroupUtil.GROUP_MODERATORS);
              if (!isMod(TheGroupUtil.getAUser())) {
                moderators.add(TheGroupUtil.getAUser());
              }
              TheGroupUtil.getCurrentGroup().saveInBackground();

              break;
            case 1: // remove user
              ParseRelation members =
                  TheGroupUtil.getCurrentGroup().getRelation(TheGroupUtil.GROUP_MEMBERS);
              members.remove(TheGroupUtil.getAUser());
              TheGroupUtil.getCurrentGroup().saveInBackground();

              // check this, it will throw an error b/c user is not authenticated.
              /*ParseRelation relation = TheGroupUtil.getAUser().getRelation(TheGroupUtil.MEMBERSHIP);
              relation.remove(TheGroupUtil.getCurrentGroup());
              TheGroupUtil.getAUser().saveInBackground();
              */

              Intent intent = new Intent(SelectUserActivity.this, ViewBlogActivity.class);
              intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
              intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
              startActivity(intent);

              break;
          }
        }
Ejemplo n.º 4
0
  /**
   * This method checks to see if the current user is a moderator.
   *
   * @param theUser the current user
   * @return true if he is a moderator or founder, false otherwise.
   */
  private boolean isMod(final ParseUser theUser) {
    ParseRelation moderators =
        TheGroupUtil.getCurrentGroup().getRelation(TheGroupUtil.GROUP_MODERATORS);
    int i = -1;
    try {
      i = moderators.getQuery().whereEqualTo("objectId", theUser.getObjectId()).count();
    } catch (ParseException e) {
      e.printStackTrace();
    }

    return i == 1;
  }
Ejemplo n.º 5
0
  public static void removeCommunityFromCurrentUser(final ParseObject community) {
    ParseUser user = ParseUser.getCurrentUser();
    ParseRelation<ParseObject> relation = user.getRelation(Common.OBJECT_USER_COMMUNITY_RELATION);
    relation.remove(community);
    user.saveInBackground();

    ParseRelation<ParseObject> communityUsers =
        community.getRelation(Common.OBJECT_COMMUNITY_USERS);
    communityUsers.remove(user);
    community.saveInBackground();

    String channel = "community_" + community.getObjectId();
    ParsePush.unsubscribeInBackground(channel);
  }
Ejemplo n.º 6
0
 public static void getUserCommunity(ParseUser user) {
   ParseRelation<ParseObject> relation = user.getRelation(Common.OBJECT_USER_COMMUNITY_RELATION);
   relation
       .getQuery()
       .findInBackground(
           new FindCallback<ParseObject>() {
             @Override
             public void done(List<ParseObject> list, ParseException e) {
               if (e == null) {
                 EventBus.getDefault().post(new UserCommunityEvent(list));
               }
             }
           });
 }
Ejemplo n.º 7
0
 private void addFriendCheckmarks() {
   mFriendRelation
       .getQuery()
       .findInBackground(
           new FindCallback<ParseUser>() {
             @Override
             public void done(List<ParseUser> friends, ParseException e) {
               if (e == null) {
                 // ok. loop
                 for (int i = 0; i < mUsers.size(); i++) {
                   ParseUser user = mUsers.get(i);
                   for (ParseUser friend : friends) {
                     if (friend.getObjectId().equals(user.getObjectId())) {
                       // they both match
                       getListView().setItemChecked(i, true);
                     }
                   }
                 }
               } else {
                 // something wrong. inform user about the error.
                 Toast.makeText(
                         EditFriendsActivity.this, "something went worong", Toast.LENGTH_SHORT)
                     .show();
               }
             }
           });
 }
Ejemplo n.º 8
0
  private void addFriendCheckMarks() {

    mFriendsRelation
        .getQuery()
        .findInBackground(
            new FindCallback<ParseUser>() {
              @Override
              public void done(List<ParseUser> friends, ParseException e) {
                if (e == null) {
                  // list returned - look for a match

                  for (int i = 0; i < mUsers.size(); i++) {
                    ParseUser user = mUsers.get(i);

                    for (ParseUser friend : friends) {
                      if (friend.getObjectId().equals(user.getObjectId())) {
                        getListView().setItemChecked(i, true);
                      }
                    }
                  }

                } else {
                  Log.e(TAG, e.getMessage());
                }
              }
            });
  }
  @Override
  public void onResume() {
    super.onResume();
    mCurrentUser = ParseUser.getCurrentUser();
    mFriendsRelation = mCurrentUser.getRelation(ParseConstants.KEY_FRIENDS_RELATION);
    getActivity().setProgressBarIndeterminateVisibility(true);
    ParseQuery<ParseUser> query = mFriendsRelation.getQuery();
    query.addAscendingOrder(ParseConstants.KEY_USERNAME);
    mFriendsRelation
        .getQuery()
        .findInBackground(
            new FindCallback<ParseUser>() {

              @Override
              public void done(List<ParseUser> friends, ParseException e) {
                getActivity().setProgressBarIndeterminateVisibility(false);
                if (e == null) {
                  mFriends = friends;
                  String[] usernames = new String[mFriends.size()];
                  int i = 0;
                  for (ParseUser user : mFriends) {
                    usernames[i] = user.getUsername();
                    i++;
                  }
                  ArrayAdapter<String> adapter =
                      new ArrayAdapter<String>(
                          getListView().getContext(),
                          android.R.layout.simple_list_item_1,
                          usernames);
                  setListAdapter(adapter);
                } else {
                  Log.e(TAG, e.getMessage());
                  AlertDialog.Builder builder = new AlertDialog.Builder(getListView().getContext());
                  builder
                      .setMessage(e.getMessage())
                      .setTitle(R.string.error_title)
                      .setPositiveButton(android.R.string.ok, null);
                  AlertDialog dialog = builder.create();
                  dialog.show();
                }
              }
            });
  }
Ejemplo n.º 10
0
  public static void addCommunityToUser(final ParseObject community) {
    ParseUser user = ParseUser.getCurrentUser();
    ParseRelation<ParseObject> relation = user.getRelation(Common.OBJECT_USER_COMMUNITY_RELATION);
    relation.add(community);
    user.saveInBackground(
        new SaveCallback() {
          @Override
          public void done(ParseException e) {
            getUserCommunity(ParseUser.getCurrentUser());
          }
        });

    ParseRelation<ParseObject> communityUsers =
        community.getRelation(Common.OBJECT_COMMUNITY_USERS);
    communityUsers.add(user);
    community.saveInBackground();

    String channel = "community_" + community.getObjectId();
    ParsePush.subscribeInBackground(channel);
  }
Ejemplo n.º 11
0
  public static void getCommunityQuestions(ParseObject community) {

    if (community == null) {
      getAllQuestions();
      return;
    }

    ParseRelation<ParseObject> relation = community.getRelation(Common.OBJECT_COMMUNITY_POSTS);
    ParseQuery<ParseObject> query = relation.getQuery();
    query.orderByDescending("updatedAt");
    query.findInBackground(
        new FindCallback<ParseObject>() {
          @Override
          public void done(List<ParseObject> list, ParseException e) {
            if (e == null) {
              Log.d("questions", "Retrieved " + list.size() + " community questions");
              EventBus.getDefault().post(new QuestionEvent(list));
            }
          }
        });
  }
Ejemplo n.º 12
0
 @Override
 protected void onListItemClick(ListView l, View v, int position, long id) {
   super.onListItemClick(l, v, position, id);
   if (getListView().isItemChecked(position)) {
     // add friend
     mFriendRelation.add(mUsers.get(position));
   } else {
     // remove friends
     mFriendRelation.remove(mUsers.get((position)));
   }
   mCurrentUser.saveInBackground(
       new SaveCallback() {
         @Override
         public void done(ParseException e) {
           if (e != null) {
             // there is an error
             Toast.makeText(EditFriendsActivity.this, android.R.string.no, Toast.LENGTH_SHORT)
                 .show();
           }
         }
       });
 }
  @Override
  public void onResume() {
    super.onResume();

    mCurrentUser = ParseUser.getCurrentUser();

    mFriendsRelation = mCurrentUser.getRelation(ParseConstants.KEY_FRIENDS_RELATION);

    mProgressBar.setVisibility(View.VISIBLE);

    ParseQuery<ParseUser> query = mFriendsRelation.getQuery();

    query.addAscendingOrder(ParseConstants.KEY_USERNAME);

    query.findInBackground(
        new FindCallback<ParseUser>() {
          @Override
          public void done(List<ParseUser> friends, ParseException e) {

            mProgressBar.setVisibility(View.INVISIBLE);

            if (e == null) {
              mFriends = friends;
              String[] usernames = new String[mFriends.size()];

              // For loop to iterate through the list of users
              int i = 0;
              for (ParseUser user : mFriends) {

                usernames[i] = user.getUsername();
                i++;
              }

              ArrayAdapter<String> adapter =
                  new ArrayAdapter<String>(
                      mListView.getContext(), android.R.layout.simple_list_item_checked, usernames);
              mListView.setAdapter(adapter);
              mListView.setEmptyView(mTextView); // Set the EmptyTextView
            } else {
              Log.e(TAG, e.getMessage());
              AlertDialog.Builder builder = new AlertDialog.Builder(RecipientsActivity.this);
              builder
                  .setMessage(e.getMessage())
                  .setTitle(R.string.error_title)
                  .setPositiveButton(android.R.string.ok, null);
              AlertDialog dialog = builder.create();
              dialog.show();
            }
          }
        });
  }
Ejemplo n.º 14
0
  public static void addDiaryEntries(
      final Calendar cal,
      final ParseUser user,
      final List<DiaryEntry> entries,
      final String userMeal) {

    ParseRelation<ParseObject> pastRecipesRelation = user.getRelation("pastRecipes");
    List<DiaryEntry> diaryEntriesList = new ArrayList<>();
    for (DiaryEntry entry : entries) {
      // Add to user's past recipes
      pastRecipesRelation.add(entry.getRecipe());

      final DiaryEntry diaryEntry = new DiaryEntry();
      diaryEntry.setDate(cal.getTime());
      diaryEntry.setUser(user);
      diaryEntry.setRecipe(entry.getRecipe());
      diaryEntry.setServingsMultiplier(entry.getServingsMultiplier());
      diaryEntry.saveInBackground();
      diaryEntriesList.add(diaryEntry);
    }
    user.saveInBackground();
    addUserMeal(cal, user, diaryEntriesList, userMeal);
  }
Ejemplo n.º 15
0
  public static void addDiaryEntry(
      final Calendar cal,
      final ParseUser user,
      final Recipe recipe,
      float servings,
      final String userMeal) {

    // Add recipe to users past recipes
    ParseRelation<ParseObject> relation = user.getRelation("pastRecipes");
    relation.add(recipe);
    user.saveInBackground();

    // Create new diary entry and save to parse
    final DiaryEntry diaryEntry = new DiaryEntry();
    diaryEntry.setDate(cal.getTime());
    diaryEntry.setUser(user);
    diaryEntry.setRecipe(recipe);
    diaryEntry.setServingsMultiplier(servings);
    diaryEntry.saveInBackground();

    List<DiaryEntry> entries = new ArrayList<>();
    entries.add(diaryEntry);
    addUserMeal(cal, user, entries, userMeal);
  }
Ejemplo n.º 16
0
  @Override
  public void onResume() {
    super.onResume();

    mCurrentUser = ParseUser.getCurrentUser();
    mFriendsRelation = mCurrentUser.getRelation(ParseConstants.KEY_RELATION);

    mFriendsRelation
        .getQuery()
        .findInBackground(
            new FindCallback<ParseUser>() {
              @Override
              public void done(List<ParseUser> friends, ParseException e) {
                mFriends = friends;

                if (e == null) {
                  String[] usernames = new String[mFriends.size()];
                  int i = 0;
                  for (ParseUser user : mFriends) {
                    usernames[i] = user.getUsername();
                    i++;
                  }
                  ArrayAdapter<String> adapter =
                      new ArrayAdapter<String>(
                          getListView().getContext(),
                          android.R.layout.simple_list_item_1,
                          usernames);

                  setListAdapter(adapter);
                } else {
                  Log.e(TAG, e.getMessage());
                  AlertDialog.Builder builder = new AlertDialog.Builder(getListView().getContext());
                  builder
                      .setTitle(getString(R.string.Error_Title))
                      .setMessage(e.getMessage())
                      .setPositiveButton(android.R.string.ok, null);

                  AlertDialog dialog = builder.create();
                  dialog.show();
                }
              }
            });
  }
Ejemplo n.º 17
0
  @Override
  public void onResume() {
    super.onResume();

    mCurrentUser = ParseUser.getCurrentUser();
    mFriendsRelation = mCurrentUser.getRelation(ParseConstants.KEY_FRIENDS_RELATION);
    ParseQuery<ParseUser> query = mFriendsRelation.getQuery();
    query.addAscendingOrder(ParseConstants.KEY_USERNAME);
    query.findInBackground(
        new FindCallback<ParseUser>() {
          @Override
          public void done(List<ParseUser> friends, ParseException e) {
            if (e == null) {
              mFriends = friends;

              String[] usernames = new String[mFriends.size()];
              int i = 0;
              for (ParseUser user : mFriends) {
                usernames[i] = user.getUsername();
                i++;
              }
              if (mGridView.getAdapter() == null) {
                UserAdapter adapter = new UserAdapter(RecipientsActivity.this, mFriends);
                mGridView.setAdapter(adapter);
              } else {

                ((UserAdapter) mGridView.getAdapter()).refill(mFriends);
              }
            } else {

              Log.e(TAG, e.getMessage());
              AlertDialog.Builder builder = new AlertDialog.Builder(RecipientsActivity.this);
              builder
                  .setMessage(e.getMessage())
                  .setTitle(R.string.error_title)
                  .setPositiveButton(android.R.string.ok, null);
              AlertDialog dialog = builder.create();
              dialog.show();
            }
          }
        });
  }
Ejemplo n.º 18
0
  @Override
  public void onResume() {
    super.onResume();

    mCurrentUser = ParseUser.getCurrentUser();
    // get relations for the current user if the column exists it is returned else it is created.
    mFriendsRelation = mCurrentUser.getRelation(ParseConstants.KEY_FRIENDS_RELATION);
    // we are querying into parse relational object.
    // get the list of parse user objects which are in relation with the current parse user.
    mProgressBar.setVisibility(View.VISIBLE);
    ParseQuery<ParseUser> query = mFriendsRelation.getQuery();
    query.addAscendingOrder(ParseConstants.KEY_USERNAME);
    query.findInBackground(
        new FindCallback<ParseUser>() {
          @Override
          public void done(List<ParseUser> friends, ParseException e) {
            mProgressBar.setVisibility(View.INVISIBLE);
            mFriends = friends;
            if (e == null) {
              if (mGridView.getAdapter() == null) {
                UserAdapter adapter = new UserAdapter(getActivity(), mFriends);
                mGridView.setAdapter(adapter);
              } else {
                ((UserAdapter) mGridView.getAdapter()).refill(mFriends);
              }
            } else if (e.getMessage()
                .equals(
                    "java.lang.ClassCastException: java.lang.String cannot be cast to org.json.JSONObject")) {
              // Do nothing since friends are not yet added.
              // ignore
            } else {
              // Log.e(TAG, e.getMessage());
              AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
              builder.setTitle(R.string.error_title);
              builder.setMessage(e.getMessage());
              builder.setPositiveButton(android.R.string.ok, null);
              AlertDialog dialog = builder.create();
              dialog.show();
            }
          }
        });
  }
Ejemplo n.º 19
0
    public void runLoadDropItemsFromParse() {

      if (pageNumber != 0) {
        int pageMultiplier = pageNumber - 1;
        skipNumber = pageMultiplier * queryLimit;
        // Otherwise, clear the list, because this is a default(refresh) query
      } else {
        if (mDropListFromParse != null) {
          mDropListFromParse.clear();
        }
      }

      ParseUser user = ParseUser.getCurrentUser();

      ParseRelation relation = user.getRelation("todoDrops");

      ParseQuery query = relation.getQuery();

      query.setLimit(queryLimit);
      query.setSkip(skipNumber);
      query.include("authorPointer");
      query.orderByDescending("createdAt");
      query.findInBackground(
          new FindCallback<ParseObject>() {
            @Override
            public void done(List<ParseObject> list, ParseException e) {

              if (e != null) {
                Log.i("KEVIN", "error error");

              } else {

                for (int i = 0; i < list.size(); i++) {

                  // Collects Drop Objects
                  //                        dropObjectsList.add(list.get(i));

                  final DropItem dropItem = new DropItem();

                  // Drop Author Data//////////////////////////////////////////////////////////
                  ParseObject authorData = (ParseObject) list.get(i).get("authorPointer");

                  ParseFile parseProfilePicture = (ParseFile) authorData.get("parseProfilePicture");
                  if (parseProfilePicture != null) {
                    parseProfilePicture.getDataInBackground(
                        new GetDataCallback() {
                          @Override
                          public void done(byte[] data, ParseException e) {
                            if (e == null) {
                              Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
                              Bitmap resized = Bitmap.createScaledBitmap(bmp, 100, 100, true);
                              dropItem.setParseProfilePicture(resized);
                              if (pageNumber != 0) {
                                mDropAdapter.notifyDataSetChanged();
                              } else {

                                if (mDropListFromParse != null) {
                                  updateRecyclerView(mDropListFromParse);
                                }
                              }
                            }
                          }
                        });
                  }

                  // dropItemAll.setAuthorName(authorName);
                  dropItem.setAuthorName((String) authorData.get("displayName"));
                  // Author id
                  dropItem.setAuthorId(authorData.getObjectId());
                  // Author Rank
                  dropItem.setAuthorRank(authorData.getString("userRank"));
                  // Author Riple Count
                  dropItem.setAuthorRipleCount(String.valueOf(authorData.getInt("userRipleCount")));
                  // Author Info
                  dropItem.setAuthorInfo(authorData.getString("userInfo"));

                  // Drop Data////////////////////////////////////////////////////////////////
                  // DropObjectId
                  dropItem.setObjectId(list.get(i).getObjectId());
                  // Drop description
                  dropItem.setDescription(list.get(i).getString("description"));

                  // Get created at from parse and convert it to friendly String
                  Format formatter = new SimpleDateFormat("MMM dd, yyyy @ h a");
                  String dateAfter = formatter.format(list.get(i).getCreatedAt());
                  dropItem.setCreatedAt(dateAfter);

                  // Riple Count
                  int ripleCount = (list.get(i).getInt("ripleCount"));
                  if (ripleCount == 1) {
                    dropItem.setRipleCount(
                        String.valueOf(list.get(i).getInt("ripleCount") + " Riple"));
                  } else {
                    dropItem.setRipleCount(
                        String.valueOf(list.get(i).getInt("ripleCount") + " Riples"));
                  }

                  // Comment Count
                  int commentCount = (list.get(i).getInt("commentCount"));
                  if (commentCount == 1) {
                    dropItem.setCommentCount(
                        String.valueOf(list.get(i).getInt("commentCount") + " Comment"));
                  } else {
                    dropItem.setCommentCount(
                        String.valueOf(list.get(i).getInt("commentCount") + " Comments"));
                  }

                  mDropListFromParse.add(dropItem);
                }
              }

              Log.d(TAG, "DropList = " + mDropListFromParse.size());
              dropTabInteractionList = mDropListFromParse;
            }
          });
    }
Ejemplo n.º 20
0
 public static void countItsBetaRelationInBackground(CountCallback callback) {
   ParseRelation relation = ParseUser.getCurrentUser().getRelation("ItsBeta");
   if (relation != null) {
     relation.getQuery().countInBackground(callback);
   }
 }
Ejemplo n.º 21
0
  private void getAllUsers() {
    myBar.setVisibility(View.VISIBLE);

    ParseRelation userRelation =
        TheGroupUtil.getCurrentGroup().getRelation(TheGroupUtil.GROUP_MEMBERS);
    userRelation
        .getQuery()
        .findInBackground(
            new FindCallback() {
              @Override
              public void done(List list, ParseException e) {
                myBar.setVisibility(View.INVISIBLE);
                if (e == null) {
                  mUsers = new ParseUser[list.size()];
                  for (int i = 0; i < list.size(); i++) {
                    mUsers[i] = (ParseUser) list.get(i);
                  }
                  UserAdapter adapter = new UserAdapter(SelectUserActivity.this, mUsers);
                  myList.setAdapter(adapter);
                  myList.setOnItemClickListener(
                      new AdapterView.OnItemClickListener() {
                        @Override
                        public void onItemClick(
                            AdapterView<?> parent, View view, int position, long id) {
                          TheGroupUtil.setAUser(mUsers[position]);

                          if (isMod(ParseUser.getCurrentUser())) {
                            AlertDialog.Builder builder =
                                new AlertDialog.Builder(SelectUserActivity.this);
                            builder.setItems(R.array.user_choices, mDialogInterface);
                            AlertDialog dialog = builder.create();
                            dialog.show();
                          }
                        }
                      });
                } else {
                  /// Something went wrong.
                  Toast.makeText(
                          SelectUserActivity.this,
                          "Sorry, there was an error getting users!",
                          Toast.LENGTH_LONG)
                      .show();
                }
              }

              @Override
              public void done(Object o, Throwable throwable) {
                myBar.setVisibility(View.INVISIBLE);
                if (throwable == null) {
                  ArrayList<ParseUser> arrayList = (ArrayList) o;
                  mUsers = new ParseUser[arrayList.size()];
                  for (int i = 0; i < arrayList.size(); i++) {
                    mUsers[i] = (ParseUser) arrayList.get(i);
                  }
                  UserAdapter adapter = new UserAdapter(SelectUserActivity.this, mUsers);
                  myList.setAdapter(adapter);
                  myList.setOnItemClickListener(
                      new AdapterView.OnItemClickListener() {
                        @Override
                        public void onItemClick(
                            AdapterView<?> parent, View view, int position, long id) {
                          TheGroupUtil.setAUser(mUsers[position]);

                          if (isMod(ParseUser.getCurrentUser())) {
                            AlertDialog.Builder builder =
                                new AlertDialog.Builder(SelectUserActivity.this);
                            builder.setItems(R.array.user_choices, mDialogInterface);
                            AlertDialog dialog = builder.create();
                            dialog.show();
                          }
                        }
                      });
                }
              }
            });
  }
Ejemplo n.º 22
0
  // get a list of all your friends - this code is copied from the onResume() method in the
  // FriendsFragment with some additions
  @Override
  public void onResume() {
    super.onResume();

    // get the current user using the getCurrentUser() method
    mCurrentUser = ParseUser.getCurrentUser();
    // for the relation, from this user we want to call a method called getRelation()
    mFriendsRelation = mCurrentUser.getRelation(ParseConstants.KEY_FRIENDS_RELATION);

    // start the progress indicator before we run our query
    // use the getActivity() to get a reference to the activity in which the fragment is running (as
    // setProgressBarIndeterminateVisibility() is an Activity method)
    // note: Window provided Progress Bars are now deprecated with Toolbar.
    // see:
    // http://stackoverflow.com/questions/27788195/setprogressbarindeterminatevisibilitytrue-not-working
    // getActivity().setProgressBarIndeterminateVisibility(true);

    // the first thing we need is a list of the users friends...
    // we have the friend relation, but this doesn't give us a list of users to work with
    // the list itself is still on the back end, we need to use the ParseRelation to retrieve it
    // use the build in query to retrieve it - this gets us the query associated with this
    // ParseRelation
    ParseQuery<ParseUser> query = mFriendsRelation.getQuery();

    // sort the list by username before calling it
    query.addAscendingOrder(ParseConstants.KEY_USERNAME);

    query.findInBackground(
        new FindCallback<ParseUser>() {
          @Override
          public void done(List<ParseUser> friends, ParseException e) {

            // getActivity().setProgressBarIndeterminateVisibility(false);

            // include an if statement to check the exception
            if (e == null) {

              // set the mFriends variable based on the list of friends that is returned
              mFriends = friends;

              // now we need to use mFriends as the data source for the list view in our fragments
              // we need to create an adapter and set it as the list adapter, just like we do for
              // lost activities
              // this is very similar to what we are ding for all users in the EditFriends activity,
              // so copy and paste that code

              // create an array of strings to store the usernames and set the size equal to that of
              // the list returned
              String[] usernames = new String[mFriends.size()];
              // enhanced for loop to go through the list of parse users and create an array of
              // usernames
              int i = 0;
              for (ParseUser user : mFriends) {
                usernames[i] = user.getUsername();
                i++;
              }
              // create an array adapter and set it as the adapter for this activity
              ArrayAdapter<String> adapter =
                  new ArrayAdapter<String>(
                      // for the first parameter here, need to get the context of a fragment through
                      // the list view itself
                      // the list view knows which context it is in because of its layout in the
                      // fragment and in the activity that contains the fragment, so use...
                      getListView().getContext(),
                      android.R.layout.simple_list_item_checked,
                      usernames);
              // need to call setListAdapter for this activity.  This method is specifically from
              // the ListActivity class
              setListAdapter(adapter);
            } else {
              // display a message to the user (copied from EditFriendsActivity)
              // there was an error - log the message
              Log.e(TAG, e.getMessage());
              // display an alert to the user
              // if there is a parse exception then...
              AlertDialog.Builder builder = new AlertDialog.Builder(RouteRecipientsActivity.this);
              // set the message from the exception
              builder
                  .setMessage(e.getMessage())
                  .setTitle(R.string.error_title)
                  .setPositiveButton(android.R.string.ok, null);
              AlertDialog dialog = builder.create();
              dialog.show();
            }
          }
        });
  }