Skip to content

Commit

Permalink
Merge "Navbar: handle images selected through the documents api" into…
Browse files Browse the repository at this point in the history
… kitkat
  • Loading branch information
sethyx authored and Gerrit Code Review committed Feb 7, 2014
2 parents 42b3ebd + 89b7116 commit 6d78631
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions src/com/aokp/romcontrol/fragments/navbar/ArrangeNavbarFragment.java
Expand Up @@ -44,6 +44,7 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;


Expand Down Expand Up @@ -427,17 +428,28 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
}

Uri tempSelectedUri = getTempFileUri();
try {
Log.e(TAG,
"Selected image path: "
+ tempSelectedUri.getPath());
Bitmap bitmap = BitmapFactory.decodeFile(tempSelectedUri
.getPath());
bitmap.compress(Bitmap.CompressFormat.PNG, 100, iconStream);
} catch (NullPointerException npe) {
Log.e(TAG, "SeletedImageUri was null.");
super.onActivityResult(requestCode, resultCode, data);
return;
Bitmap bitmap;
if (data != null) {
Uri mUri = data.getData();
try {
bitmap = MediaStore.Images.Media.getBitmap(
getActivity().getContentResolver(), mUri);
Bitmap resizedbitmap = Bitmap.createScaledBitmap(bitmap, 100, 100, true);
resizedbitmap.compress(Bitmap.CompressFormat.PNG, 100, iconStream);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} else {
try {
bitmap = BitmapFactory.decodeFile(tempSelectedUri.getPath());
bitmap.compress(Bitmap.CompressFormat.PNG, 100, iconStream);
} catch (NullPointerException npe) {
Log.e(TAG, "SeletedImageUri was null.");
super.onActivityResult(requestCode, resultCode, data);
return;
}
}

String imageUri = Uri.fromFile(
Expand Down

0 comments on commit 6d78631

Please sign in to comment.