Ejemplo n.º 1
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
      Bundle extras = data.getExtras();
      Bitmap imageBitmap = (Bitmap) extras.get("data");
      mImageView = (ImageView) findViewById(R.id.imgView);

      // Saving in Parse server
      ByteArrayOutputStream stream = new ByteArrayOutputStream();
      imageBitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
      byte[] dataTostore = stream.toByteArray();

      final ParseFile imgFile = new ParseFile("img.png", dataTostore);
      imgFile.saveInBackground();

      GalleryObj tempPicObj = new GalleryObj();
      ParseObject obj = new ParseObject("Gallery");

      obj.put("pic", imgFile);
      obj.put("Apartment", ParseUser.getCurrentUser().getString("Apartment"));
      try {
        obj.save();
        tempPicObj.id = obj.getObjectId();
        tempPicObj.pic = imageBitmap;
        STgallery.getInstance().add(tempPicObj);
      } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      adapter.notifyDataSetChanged();
    }
  }
Ejemplo n.º 2
0
    @Override
    protected Void doInBackground(Void... params) {
      // Create the array
      photoarraylist = new ArrayList<PhotoList>();
      try {
        // Locate the class table named "ImageUpload" in Parse.com
        ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("ImageUpload");
        // Locate the column named "position" in Parse.com and order list
        // by descending order of created.
        query.orderByDescending("createdAt");
        query.setLimit(15);
        ob = query.find();
        for (ParseObject po : ob) {
          // retrieve objectID and Title
          String stringTitle = (String) po.get("Title");
          String stringObjectID = po.getObjectId();

          // retrieve the image file
          ParseFile image = (ParseFile) po.get("Photo");
          PhotoList map = new PhotoList();
          map.setPhoto(image.getUrl());
          map.setObjectID(stringObjectID);
          map.setTitle(stringTitle);
          photoarraylist.add(map);
        }
      } catch (ParseException e) {
        Log.e("Error", e.getMessage());
        e.printStackTrace();
      }
      return null;
    }
Ejemplo n.º 3
0
  private void activePatientData() {

    ParseQuery<ParseObject> query = ParseQuery.getQuery("PatientDetails");
    query.whereEqualTo("patientId", patientIdRemove);
    try {
      ParseObject object = query.getFirst();
      object.put("status", "Active");
      object.save();
    } catch (ParseException e2) {
      // TODO Auto-generated catch block
      e2.printStackTrace();
    }

    /*	ParseQuery<ParseObject> query3 = ParseQuery.getQuery("_User");
    query3.whereEqualTo("userId", patientIdRemove);
    try {
    	ParseObject object = query3.getFirst();
    	object.put("status", "Active");
    	object.save();

    	}catch (ParseException e2) {
    	// TODO Auto-generated catch block
    	e2.printStackTrace();
    }*/

    Toast.makeText(SearchPatientByAdmin.this, "Patient Active", Toast.LENGTH_SHORT).show();
  }
Ejemplo n.º 4
0
  @Override
  public boolean onContextItemSelected(MenuItem item) {
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    Task t = mAdapter.getItem(info.position);
    current = info.position;
    switch (item.getItemId()) {
      case R.id.due_date:
        DialogFragment newFragment = new DatePickerFragment();
        newFragment.show(getFragmentManager(), "datePicker");
        return true;

      case R.id.remove_due_date:
        t.setDueYear(0);
        t.saveEventually();
        mAdapter.notifyDataSetChanged();
        return true;

      case R.id.delete:
        try {
          t.delete();
        } catch (ParseException e) {
          e.printStackTrace();
        }
        mAdapter.remove(t);
        mAdapter.notifyDataSetChanged();
        return true;
      default:
        mAdapter.notifyDataSetChanged();
        return super.onContextItemSelected(item);
    }
  }
    @Override
    protected Void doInBackground(Void... params) {
      // Create the array
      soaplist = new ArrayList<WorldPopulation>();
      try {
        ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("Product");
        // query.orderByAscending("Product");
        ob = query.find();
        for (ParseObject Product : ob) {
          // Locate images in Picture column
          ParseFile image = (ParseFile) Product.get("Picture");

          WorldPopulation map = new WorldPopulation();
          if (Product.get("Category").equals("soaps and shampoos")) {
            map.setPrice((String) Product.get("Price"));
            map.setProduct((String) Product.get("Product"));
            map.setCategory((String) Product.get("Category"));
            map.setQuantity(Integer.parseInt(Product.get("qty").toString()));
            map.setPicture(image.getUrl());
            soaplist.add(map);
          }
        }
      } catch (ParseException e) {
        Log.e("Error", e.getMessage());
        e.printStackTrace();
      }
      return null;
    }
Ejemplo n.º 6
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    for (int i = 0; i < 5; i++) {
      Shop saveShop = new Shop();
      saveShop.setAddress("add");
      saveShop.setCity("Sofia" + i);
      saveShop.setContactName("Didi");
      saveShop.setDetails("det");
      saveShop.setName("name" + i);
      saveShop.setTelephone("+359882545");
      saveShop.saveEventually();

      Painting painting = new Painting();
      painting.setHeight(20);
      painting.setWidth(30);
      painting.setType(ArtTechnic.GRAPHIC);
      painting.setName("Zora" + i);
      try {
        painting.save();
      } catch (ParseException e) {
        e.printStackTrace();
      }

      Events event = new Events();
      event.setEventType(EventType.CHECK_IN);
      event.setRevenue(125);
      event.setPainting(painting);
      event.setShop(saveShop);
      event.saveEventually();
    }
  }
Ejemplo n.º 7
0
    @Override
    protected Void doInBackground(Void... params) {
      // Create the array
      menulista = new ArrayList<MenuSetGet>();
      try {
        // Locate the class table named "Country" in Parse.com
        ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("computadoras");
        // Locate the column named "ranknum" in Parse.com and order list
        // by ascending
        query.orderByAscending("orden");
        ob = query.find();
        for (ParseObject country : ob) {
          // Locate images in flag column
          ParseFile image = (ParseFile) country.get("imagen");

          MenuSetGet map = new MenuSetGet();
          map.setNombre((String) country.get("nombre"));
          map.setDetalle((String) country.get("Detalle"));
          map.setPrecio((String) country.get("precio"));
          map.setImagen(image.getUrl());
          menulista.add(map);
        }
      } catch (ParseException e) {
        Log.e("Error", e.getMessage());
        e.printStackTrace();
      }
      return null;
    }
Ejemplo n.º 8
0
    @Override
    protected Void doInBackground(Void... params) {
      // Create the array
      userProfileList = new ArrayList<UserProfile>();
      try {

        // Locate the class table named "Country" in Parse.com
        ParseQuery<ParseUser> query = ParseUser.getQuery();

        Log.d("UserListActivity", "In asynctask.. username - " + currentUser.getUsername());

        query.whereNotEqualTo("username", currentUser.getUsername());

        // by ascending LastName
        query.orderByAscending("lastName");
        ob = query.find();
        for (ParseObject userProfile : ob) {

          UserProfile map = new UserProfile();
          map.setFirstName((String) userProfile.get("firstName"));
          map.setLastName((String) userProfile.get("lastName"));
          map.setDepartment((String) userProfile.get("department"));
          map.setUsername((String) userProfile.get("username"));

          userProfileList.add(map);
        }
      } catch (ParseException e) {
        Log.e("Error", e.getMessage());
        e.printStackTrace();
      }
      return null;
    }
  public void deleteMap(int position) {
    BeaconMap beaconMap = (BeaconMap) mGridView.getItemAtPosition(position);
    ParseQuery<Place> parseQueryBeacon = ParseQuery.getQuery("Place");
    parseQueryBeacon.whereEqualTo(Constants.COLUMN_PLACE_MAP_ID, beaconMap.getObjectId());

    try {

      ParseQuery<Beacon> beaconParseQuery = ParseQuery.getQuery("Beacon");
      beaconParseQuery.whereEqualTo(Constants.COLUMN_BEACON_MAP_ID, beaconMap.getObjectId());
      List<Beacon> beaconList = beaconParseQuery.find();
      for (Beacon beacon : beaconList) {
        beacon.deleteInBackground();
      }

      List<Place> placeList = parseQueryBeacon.find();
      for (Place place : placeList) {
        ParseQuery<BeaconPower> beaconPowerParseQuery = ParseQuery.getQuery("BeaconPower");
        beaconPowerParseQuery.whereEqualTo(
            Constants.COLUMN_BEACON_MEASURE_PLACE_ID, place.getObjectId());
        List<BeaconPower> beaconPowerList = beaconPowerParseQuery.find();
        for (BeaconPower beaconPower : beaconPowerList) {
          beaconPower.delete();
        }

        place.deleteInBackground();
      }
    } catch (ParseException e) {
      e.printStackTrace();
    }

    beaconMap.deleteInBackground();
  }
    @Override
    protected String doInBackground(String... params) {

      // Notify Parse Analytics that the app has been opened
      ParseAnalytics.trackAppOpenedInBackground(getIntent());

      CardDbHelper cardDbHelper = new CardDbHelper(getBaseContext());

      SQLiteDatabase db = cardDbHelper.getWritableDatabase();
      cardDbHelper.onCreate(db);

      try {
        ParseQuery<ParseObject> query = ParseQuery.getQuery("Card");
        query.setLimit(1000);
        query.selectKeys(Arrays.asList(""));
        List<ParseObject> results = query.find();

        Iterator<ParseObject> iterator = results.iterator();

        // Writing values to DB
        ContentValues values = new ContentValues();

        while (iterator.hasNext()) {
          ParseObject next = iterator.next();
          values.put("cardId", next.getObjectId().toString());
          db.insert(CardDbHelper.TABLE_NAME, "null", values);
        }

      } catch (ParseException e) {
        e.printStackTrace();
      }

      return "";
    }
Ejemplo n.º 11
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_add_item);

    client = new YardSaleApplication(this);

    String itemId = getIntent().getStringExtra("item_id");
    ivItemPreview = (ImageView) findViewById(R.id.ivItemPreview);
    etEditItemDescription = (EditText) findViewById(R.id.etItemDescription);
    etEditItemPrice = (EditText) findViewById(R.id.etItemPrice);
    Button btnSaveItem = (Button) findViewById(R.id.btnSaveItem);

    ParseQuery getItemQuery = Item.getQuery();
    try {
      item = (Item) getItemQuery.get(itemId);
    } catch (ParseException e) {
      e.printStackTrace();
    }

    Picasso.with(this).load(item.getPhoto().getUrl()).into(ivItemPreview);
    etEditItemDescription.setText(item.getDescription());
    etEditItemPrice.setText("$" + item.getPrice().toString());
    etEditItemPrice.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {
            String current = "";
            if (!s.toString().equals(current)) {
              etEditItemPrice.removeTextChangedListener(this);

              String cleanString = s.toString().replaceAll("[$,.]", "");

              double parsed = Double.parseDouble(cleanString);
              String formatted = NumberFormat.getCurrencyInstance().format((parsed / 100));

              current = formatted;
              etEditItemPrice.setText(formatted);
              etEditItemPrice.setSelection(formatted.length());

              etEditItemPrice.addTextChangedListener(this);
            }
          }

          @Override
          public void afterTextChanged(Editable s) {}
        });

    btnSaveItem.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            addItem(v);
          }
        });
  }
Ejemplo n.º 12
0
 @Override
 public void deleteFromLocal() {
   try {
     mParseUser.unpin();
   } catch (ParseException e) {
     e.printStackTrace();
   }
 }
Ejemplo n.º 13
0
 public Network getNetwork() {
   Network network = null;
   try {
     network = this.getParseObject(NETWORK_KEY).fetchIfNeeded();
   } catch (ParseException e) {
     e.printStackTrace();
   }
   return network;
 }
Ejemplo n.º 14
0
  static float[] updateGraph() {
    long timeStep = 1445214540000L;
    float[] results = new float[numData];

    ParseQuery<ParseObject> query = ParseQuery.getQuery("data");
    query.whereEqualTo("flag", 1);
    try {
      ParseObject flagged = query.getFirst();
      timeStep = flagged.getLong("unixTimeStamp");
      flagged.put("flag", 0);
      flagged.saveInBackground();
      Log.d("Find Flag", flagged.getObjectId());
    } catch (ParseException e) {
      Log.d("Find Flag", "Error: " + e.getMessage());
    }
    query = ParseQuery.getQuery("data");
    query.orderByAscending("unixTimeStamp");
    query.whereGreaterThan("unixTimeStamp", timeStep);
    try {
      ParseObject nextFlag = query.getFirst();
      nextFlag.put("flag", 1);
      nextFlag.saveInBackground();
      Log.d("Set Next Flag", nextFlag.getObjectId() + " is " + nextFlag.getInt("flag"));
    } catch (ParseException e) {
      Log.d("Set Next Flag", "Error: " + e.getMessage());
    }
    query = ParseQuery.getQuery("data");
    query.orderByDescending("unixTimeStamp");
    query.whereLessThan("unixTimeStamp", timeStep);
    for (int i = 0; i < numData; i++) {
      try {
        ParseObject data = query.getFirst();
        results[numData - i - 1] = (float) data.getInt("Bg");
        query.whereLessThan("unixTimeStamp", data.getLong("unixTimeStamp"));
      } catch (ParseException e) {
        Log.d("Fill Results Array", "Failed");
      }
    }
    /*query.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> data, ParseException e) {
            int i = 0;

            if (e == null) {
                Log.d("Blood Glucose", "Retrieved " + data.size() + " Blood Glucose Data Points");
                for(ParseObject person : data) {
                    results[i] = person.getInt("Bg");
                    i++;
                }
            }
            else {
                Log.d("Blood Glucose", "Error: " + e.getMessage());
            }
        }
    });*/
    return results;
  }
  @Override
  public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    // find all the views
    mListView = (ListView) view.findViewById(R.id.listViewApp);

    Lappointment.clear();

    List<String> doctorID;
    Log.d("Chan", "Username: "******"doctorUsername"));
    username = getArguments().getString("doctorUsername");
    List<ParseObject> list2 = new ArrayList<>();
    ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("Doctor");
    query.whereEqualTo("Doctor", username);
    try {
      list2 = query.find();
    } catch (ParseException e) {
      e.printStackTrace();
    }
    for (ParseObject obj : list2) {
      doctorIDf = obj.getString("doctorID");
      Log.d("chan", "Doctor ID :  " + String.valueOf(doctorIDf));
    }

    List<ParseObject> list = new ArrayList<>();
    ParseQuery<ParseObject> query2 = ParseQuery.getQuery("Appointment");
    query2.whereEqualTo("DoctorID", doctorIDf);
    try {
      list = query2.find();
    } catch (ParseException e) {
      e.printStackTrace();
    }
    for (ParseObject obj : list) {
      //            Appointments appt = new Appointments(obj.getString("AppointmentID"),
      // obj.getString("AppointmentDate"), obj.getString("PatientID"), obj.getString("DoctorID"),
      // obj.getString("AppointmentTime"), obj.getString("Status"));

      //            Lappointment.add(appt);
      Log.d("chan", "Status: " + obj.getString("Status"));
      Log.d("chan", "Status: " + obj.getString("Status"));
    }

    Log.d("chan", "Appointment size : " + String.valueOf(Lappointment.size()));
    // create a new instance of adapter
    ViewAppointmentRequest adapter =
        new ViewAppointmentRequest(getActivity(), R.layout.item_appointment, Lappointment);

    // set the adapter
    mListView.setAdapter(adapter);

    // set item click listener

    // handle Parse Exception here

    // set item click listener
    mListView.setOnItemClickListener(this);
  }
Ejemplo n.º 16
0
  public String getName() {

    String name = null;

    try {
      name = this.fetchIfNeeded().get("name").toString();
    } catch (ParseException e) {
      e.printStackTrace();
    }
    return name;
  }
Ejemplo n.º 17
0
 public void AddWishList(String name) {
   WishList wishList = new WishList();
   wishList.setName(name);
   wishList.setOwner(ParseUser.getCurrentUser());
   try {
     wishList.save();
   } catch (ParseException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
Ejemplo n.º 18
0
 // Uploads data to parse server as student object
 private void addToParse() {
   ParseObject studentObj = new ParseObject("Student");
   studentObj.put("name", name);
   studentObj.put("facebookID", facebookID);
   studentObj.addAll("courses", classes);
   studentObj.addAll("friendsList", friendsList);
   try {
     studentObj.save();
   } catch (ParseException a) {
     a.printStackTrace();
   }
 }
Ejemplo n.º 19
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.º 20
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.º 21
0
 public byte[] getUserPhotoByteArray() {
   if (mUserPhotoFile == null) {
     return null;
   }
   byte[] iconByteData = new byte[0];
   try {
     iconByteData = mUserPhotoFile.getData();
   } catch (ParseException e) {
     Log.e(TAG, "error getting byte[] " + e.getMessage());
   }
   return iconByteData;
 }
Ejemplo n.º 22
0
  private List<BeaconMap> getBeaconMapsArray() {
    List<BeaconMap> beaconMaps = new ArrayList<>();
    ParseQuery<BeaconMap> query = ParseQuery.getQuery(BeaconMap.class);
    query.whereEqualTo("userId", ParseUser.getCurrentUser().getObjectId());
    Log.e("UserId=", ParseUser.getCurrentUser().getObjectId());
    try {
      beaconMaps = query.find();

    } catch (ParseException e) {
      e.printStackTrace();
    }
    return beaconMaps;
  }
    @Override
    protected Void doInBackground(Void... params) {
      // Locate the class table named "Country" in Parse.com

      ParseQuery<ParseObject> ironItems = new ParseQuery<ParseObject>("IronItems");
      try {
        ironItemsObject = ironItems.find();
      } catch (ParseException e) {
        Log.e("Error", e.getMessage());
        e.printStackTrace();
      }
      return null;
    }
Ejemplo n.º 24
0
  public void inactivePatientData() {
    ParseQuery<ParseObject> query = ParseQuery.getQuery("PatientDetails");
    query.whereEqualTo("patientId", patientIdRemove);
    try {
      ParseObject object = query.getFirst();
      object.put("status", "Inactive");
      object.save();
    } catch (ParseException e2) {
      // TODO Auto-generated catch block
      e2.printStackTrace();
    }
    /*
    ParseQuery<ParseObject> query1 = ParseQuery.getQuery("AppointmentDetails");
    query1.whereEqualTo("patientId", patientIdRemove);
    try {
    	List<ParseObject> objects = query1.find();
    	for (ParseObject p : objects) {

    			p.delete();
    	}
    	}catch (ParseException e2) {
    	// TODO Auto-generated catch block
    	e2.printStackTrace();
    }*/
    /*ParseQuery<ParseObject> query2 = ParseQuery.getQuery("MedicalRecords");
    query2.whereEqualTo("patientId", patientIdRemove);
    try {
    	List<ParseObject> objects = query2.find();
    	for (ParseObject p : objects) {

    			p.delete();
    	}
    	}catch (ParseException e2) {
    	// TODO Auto-generated catch block
    	e2.printStackTrace();
    }*/
    /*		ParseQuery<ParseObject> query3 = ParseQuery.getQuery("_User");
    		query3.whereEqualTo("userId", patientIdRemove);
    		try {
    			ParseObject object = query3.getFirst();
    			object.put("status", "Inactive");
    			object.save();

    			}catch (ParseException e2) {
    			// TODO Auto-generated catch block
    			e2.printStackTrace();
    		}
    */
    Toast.makeText(SearchPatientByAdmin.this, "Patient Inactive", Toast.LENGTH_SHORT).show();
  }
Ejemplo n.º 25
0
 @Override
 public Cartelera obtenerCartelera() {
   Cartelera c = new Cartelera();
   ParseQuery<ParseObject> query;
   List<ParseObject> list;
   try {
     query = ParseQuery.getQuery("Cartelera");
     list = query.find();
     if (list.size() == 0) {
       return null;
     }
   } catch (ParseException e) {
     e.printStackTrace();
   }
   return c;
 }
Ejemplo n.º 26
0
  @Override
  public void onSnackListUpdateComplete(ParseException e) {
    // Start the login activity if the session token is invalid.
    if (e != null && e.getCode() == ParseException.INVALID_SESSION_TOKEN) {
      if (myActivity != null) {
        Intent startLoginIntent = new Intent(myActivity, LoginActivity.class);
        ParseUser.logOutInBackground();
        myActivity.finish();
        startActivity(startLoginIntent);
      }
    }

    adapter.notifyDataSetChanged();

    if (progressOverlay != null) {
      progressOverlay.setVisibility(View.GONE);
    }

    // Show the help message if appropriate.
    // That is, if we haven't already showed it for the current user this session and the
    // current user has zero entries. Only show the help message if the SnackList is pointing
    // at the current user.
    if (lastShowedHelpFor != ParseUser.getCurrentUser()
        && !showingHelp
        && SnackList.getInstance().size() == 0
        && ParseUser.getCurrentUser().equals(SnackList.getInstance().getUser())) {
      try {
        showHelpMessage();
      } catch (IllegalStateException ignored) {
        // In the case that onSaveInstanceState has been already been called, we ignore
        // the exception.
      }
    }
  }
Ejemplo n.º 27
0
  private void initializeData() {

    ParseUser current = ParseUser.getCurrentUser();

    if (current != null) {
      String[] classes = new String[1];
      if (current.getBoolean("isteach")) {
        c.setText("Create Class");
      } else {
        c.setText("Add Class");
      }
      if (current.getString("Classes").contains(",")) {
        classes = current.getString("Classes").split(",");
      } else {
        classes[0] = current.getString("Classes");
      }
      ParseObject[] classesList = new ParseObject[classes.length];
      int z = 0;

      for (z = 0; z < classes.length; z++) {
        ParseQuery<ParseObject> query = ParseQuery.getQuery("Classes");
        query.whereEqualTo("objectId", classes[z]);
        try {
          ParseObject f = query.getFirst();
          classesList[z] = f;
        } catch (ParseException e) {
          Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_LONG).show();
        }
      }
      courses = new ArrayList<>();
      for (ParseObject g : classesList) {
        courses.add(
            new Courses(
                g.getString("ClassName"),
                g.getString("Teacher"),
                R.drawable.logo_audio,
                g.getObjectId()));
      }
    } else {
      courses = new ArrayList<>();
      courses.add(new Courses("Physics", "Culbertson", R.drawable.physics));
      courses.add(new Courses("Mobile App Dev", "Galanos", R.drawable.mobile));
      courses.add(new Courses("AP Calculus BC", "Spoden", R.drawable.integral));
      courses.add(new Courses("AP Chemistry", "Acio", R.drawable.chemistry));
      courses.add(new Courses("DNA Science", "Cobb", R.drawable.dna));
    }
  }
Ejemplo n.º 28
0
    @Override
    protected HashMap<String, Object> doInBackground(String... strings) {

      Log.d("Settings.java", "saving settings on parse ");

      Log.d(
          "Settings.java",
          "updating details to parse : "
              + bname
              + " "
              + username
              + " "
              + email
              + " "
              + mobile
              + " "
              + service);

      HashMap<String, Object> params = new HashMap<String, Object>();
      params.put("userId", parseObjectId);
      params.put("username", name);
      params.put("service", strservice);
      params.put("mobile", strnumber);
      params.put("password", strpassword);
      params.put("email", stremail);

      try {

        updateUser = ParseCloud.callFunction("updateUser", params);
        Log.d("DBHandler", " object:" + updateUser);

      } catch (ParseException e) {
        e.printStackTrace();
        String Msg = e.getMessage();
        try {
          JSONObject parseJsonMsg = new JSONObject(Msg);
          ParseMessage = parseJsonMsg.getString("message");
        } catch (JSONException excep) {
          excep.printStackTrace();
        }
        Log.d("Setting.java", "exception message :" + ParseMessage);
      }

      return updateUser;
    }
Ejemplo n.º 29
0
 public String uploadParseAvatar(byte[] data) {
   String username = EMChatManager.getInstance().getCurrentUser();
   ParseQuery<ParseObject> pQuery = ParseQuery.getQuery(CONFIG_TABLE_NAME);
   pQuery.whereEqualTo(CONFIG_USERNAME, username);
   ParseObject pUser = null;
   try {
     pUser = pQuery.getFirst();
     if (pUser == null) {
       pUser = new ParseObject(CONFIG_TABLE_NAME);
       pUser.put(CONFIG_USERNAME, username);
     }
     ParseFile pFile = new ParseFile(data);
     pUser.put(CONFIG_AVATAR, pFile);
     pUser.save();
     return pFile.getUrl();
   } catch (ParseException e) {
     if (e.getCode() == ParseException.OBJECT_NOT_FOUND) {
       try {
         pUser = new ParseObject(CONFIG_TABLE_NAME);
         pUser.put(CONFIG_USERNAME, username);
         ParseFile pFile = new ParseFile(data);
         pUser.put(CONFIG_AVATAR, pFile);
         pUser.save();
         return pFile.getUrl();
       } catch (ParseException e1) {
         e1.printStackTrace();
         EMLog.e(TAG, "parse error " + e1.getMessage());
       }
     } else {
       e.printStackTrace();
       EMLog.e(TAG, "parse error " + e.getMessage());
     }
   }
   return null;
 }
Ejemplo n.º 30
0
 public boolean updateParseNickName(final String nickname) {
   String username = EMChatManager.getInstance().getCurrentUser();
   ParseQuery<ParseObject> pQuery = ParseQuery.getQuery(CONFIG_TABLE_NAME);
   pQuery.whereEqualTo(CONFIG_USERNAME, username);
   ParseObject pUser = null;
   try {
     pUser = pQuery.getFirst();
     if (pUser == null) {
       return false;
     }
     pUser.put(CONFIG_NICK, nickname);
     pUser.save();
     return true;
   } catch (ParseException e) {
     if (e.getCode() == ParseException.OBJECT_NOT_FOUND) {
       pUser = new ParseObject(CONFIG_TABLE_NAME);
       pUser.put(CONFIG_USERNAME, username);
       pUser.put(CONFIG_NICK, nickname);
       try {
         pUser.save();
         return true;
       } catch (ParseException e1) {
         e1.printStackTrace();
         EMLog.e(TAG, "parse error " + e1.getMessage());
       }
     }
     e.printStackTrace();
     EMLog.e(TAG, "parse error " + e.getMessage());
   }
   return false;
 }