Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
hiping to fix a rare crash with the image picker, adjusting icon size
Browse files Browse the repository at this point in the history
  • Loading branch information
y20k committed Dec 17, 2015
1 parent 909ca8e commit ed3a2f6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
28 changes: 14 additions & 14 deletions app/src/main/java/org/y20k/transistor/helpers/ImageHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public Bitmap createCircularFramedImage(int size) {
float inputImageWidth = (float)mInputImage.getWidth();

// calculate padding
float padding = (float)size/6;
float padding = (float)size/4;

// define variables needed for transformation matrix
Matrix transformationMatrix = new Matrix();
Expand Down Expand Up @@ -134,19 +134,6 @@ else if (inputImageHeight > inputImageWidth) {
}


/* Get the dominant color within input image - for testing purposes */
private int getDominantColor () {
Bitmap onePixelBitmap = Bitmap.createScaledBitmap(mInputImage, 1, 1, false);
int pixel = onePixelBitmap.getPixel(0, 0);

int red = Color.red(pixel);
int green = Color.green(pixel);
int blue = Color.blue(pixel);

return Color.argb(127, red, green, blue);
}


/* Return sampled down image for given Uri */
private Bitmap decodeSampledBitmapFromUri(Uri imageUri, int reqWidth, int reqHeight) {

Expand Down Expand Up @@ -200,4 +187,17 @@ private static int calculateSampleParameter(BitmapFactory.Options options, int r
return inSampleSize;
}


/* Get the dominant color within input image - for testing purposes */
private int getDominantColor () {
Bitmap onePixelBitmap = Bitmap.createScaledBitmap(mInputImage, 1, 1, false);
int pixel = onePixelBitmap.getPixel(0, 0);

int red = Color.red(pixel);
int green = Color.green(pixel);
int blue = Color.blue(pixel);

return Color.argb(127, red, green, blue);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public boolean onMenuItemClick(MenuItem item) {
Intent i = new Intent();
i.setAction(ACTION_IMAGE_CHANGE_REQUESTED);
i.putExtra(STATION_ID, mStationID);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(i);
LocalBroadcastManager.getInstance(mContext.getApplicationContext()).sendBroadcast(i);

return true;

Expand Down

0 comments on commit ed3a2f6

Please sign in to comment.