Ejemplo n.º 1
0
  public static ParseObject getTema(String idString) {
    ParseObject tema = null;
    ParseQuery<ParseObject> query = ParseQuery.getQuery("Tema");
    try {
      query.fromLocalDatastore();
      tema = query.get(idString);
    } catch (Exception e) {
      e.printStackTrace();
    }

    return tema;
  }
Ejemplo n.º 2
0
 public static User getUserLocal(String email) {
   ParseQuery<ParseUser> query = ParseQuery.getQuery(ParseUser.class);
   query.fromLocalDatastore();
   query.whereEqualTo(EMAIL, email);
   try {
     ParseUser parseUser = query.getFirst();
     return User.create(parseUser);
   } catch (ParseException e) {
     e.printStackTrace();
     return null;
   }
 }
Ejemplo n.º 3
0
 public Permission getAdminPermission(Master master) {
   if (master == null) return null;
   ParseQuery<com.parse.ParseObject> query = ParseQuery.getQuery(Permission.PERMISSION_CLASS_NAME);
   query.fromLocalDatastore();
   query.whereEqualTo(Permission.USER_ID, getId());
   query.whereEqualTo(Permission.TYPE, Permission.ADMIN_PERMISSION);
   query.whereEqualTo(Permission.MASTER_ID, master.getId());
   try {
     com.parse.ParseObject parsePermission = query.getFirst();
     return Permission.create(parsePermission);
   } catch (ParseException e) {
     return null;
   }
 }
Ejemplo n.º 4
0
  private void loadInfoDataFromLocal() {
    ParseQuery<Info> query = Info.getQuery();
    query.fromLocalDatastore();
    query.orderByDescending("createdAt");
    query.getFirstInBackground(
        new GetCallback<Info>() {

          @Override
          public void done(Info info, ParseException e) {
            if (info == null) {
              Log.d("Parse", "The getFirst request failed.");
            } else {
              // got the most recently modified object... do something with it here
              title.setText(info.getTitle());
              content.setText(info.getContent() + info.getCreatedAt().toString());
              contact.setText("Contact: " + info.getEmail());
            }
          }
        });
  }
Ejemplo n.º 5
0
  public void loadLists() {
    groups = new ArrayList<Group>();

    ParseQuery<Group> query = Group.getQuery();

    query.fromLocalDatastore();
    try {
      groups = query.find();

    } catch (ParseException e) {
      e.printStackTrace();
    }
    Group inbox = new Group();
    inbox.setName("Inbox");
    groups.add(0, inbox);

    // if(TaskDAO.getTasksTodayCount()!=0){
    Group today = new Group();
    today.setName("Today");
    groups.add(1, today);
    // }

    // if(TaskDAO.getTasksNextDaysCount()!=0){
    Group tomorrow = new Group();
    tomorrow.setName("In 7 Days");
    groups.add(2, tomorrow);
    // }

    Group create = new Group();
    create.setName("Create list");
    groups.add(groups.size(), create);

    todayAdapter = new ListAdapter(groups, this);
    todayRecyclerView.setAdapter(todayAdapter);

    RecyclerView.ItemDecoration itemDecoration =
        new DividerItemDecoration(this, LinearLayoutManager.VERTICAL);
    // todayRecyclerView.addItemDecoration(itemDecoration);
  }
  private void getWorkoutDatastore() {
    workoutDataStore = new ArrayList<Workout>();
    ParseQuery<WorkoutDataStore> query = ParseQuery.getQuery(WorkoutDataStore.class);
    query.whereEqualTo("User", ParseUser.getCurrentUser());
    query.fromLocalDatastore();
    query.findInBackground(
        new FindCallback<WorkoutDataStore>() {

          @Override
          public void done(List<WorkoutDataStore> workouts, ParseException e) {
            if (e == null) {
              workoutDataStore.clear();
              for (WorkoutDataStore workout : workouts) {
                workoutDataStore.add(workout.toWorkoutObject());
              }
              adapter.clear();
              adapter.addAll(workoutDataStore);
            } else {
              Toast.makeText(getApplicationContext(), "fails", Toast.LENGTH_SHORT);
            }
          }
        });
  }
Ejemplo n.º 7
0
 public void getWordList(FindCallback<ParseObject> callback) {
   ParseQuery<ParseObject> query = ParseQuery.getQuery(ParseConstants.CLASS_SAVED_WORD);
   query.whereEqualTo(ParseConstants.SAVED_WORD_USER, ParseUser.getCurrentUser());
   query.fromLocalDatastore();
   query.findInBackground(callback);
 }