Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
feat(photo): store picture on local storage
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelje authored and Hector Rondon committed Aug 10, 2017
1 parent 336a839 commit 18f52cf
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/src/main/java/org/flyve/mdm/agent/EditUserActivity.java
Expand Up @@ -74,7 +74,7 @@ public class EditUserActivity extends AppCompatActivity {
private MultipleEditText editPhone;
private Spinner spinnerLanguage;
private int REQUEST_CAMERA = 0, SELECT_FILE = 1;
private String userChoosenTask;
private String strPicture;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -97,6 +97,9 @@ public void onClick(View v) {
}

imgPhoto = (ImageView) findViewById(R.id.imgPhoto);
if(!user.getPicture().equals("")) {
imgPhoto.setImageBitmap(Helpers.StringToBitmap(user.getPicture()));
}

ImageView btnCamera = (ImageView) findViewById(R.id.btnCamera);
btnCamera.setOnClickListener(new View.OnClickListener() {
Expand Down Expand Up @@ -263,6 +266,7 @@ private void save() {
}
}

user.setPicture(strPicture);
user.setLanguage( spinnerLanguage.getSelectedItem().toString() );
user.setAdministrativeNumber( editAdministrative.getText().toString() );

Expand All @@ -282,11 +286,9 @@ private void selectImage() {
public void onClick(DialogInterface dialog, int item) {

if (items[item].equals("Take Photo")) {
userChoosenTask ="Take Photo";
cameraIntent();

} else if (items[item].equals("Choose from Library")) {
userChoosenTask ="Choose from Library";
galleryIntent();

} else if (items[item].equals("Cancel")) {
Expand Down Expand Up @@ -347,6 +349,7 @@ private void onCaptureImageResult(Intent data) {
}
}

strPicture = Helpers.BitmapToString(thumbnail);
imgPhoto.setImageBitmap(thumbnail);
}

Expand All @@ -360,6 +363,7 @@ private void onSelectFromGalleryResult(Intent data) {
}
}

strPicture = Helpers.BitmapToString(bm);
imgPhoto.setImageBitmap(bm);
}

Expand Down

0 comments on commit 18f52cf

Please sign in to comment.