Skip to content

Commit

Permalink
First step at extracting the old editor (moving Media related method …
Browse files Browse the repository at this point in the history
…to the EditPostActivity, they should end up in their own class/lib)
  • Loading branch information
maxme committed Feb 9, 2015
1 parent f017173 commit 559f9b2
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
Expand Down Expand Up @@ -557,4 +558,21 @@ public static Bitmap getRoundedEdgeBitmap(final Bitmap bitmap, int radius) {

return output;
}

/**
* Get the maximum size a thumbnail can be to fit in either portrait or landscape orientations.
*/
private static int sMaximumThumbnailWidthForEditor;
public static int getMaximumThumbnailWidthForEditor(Context context) {
if (sMaximumThumbnailWidthForEditor == 0) {
Point size = DisplayUtils.getDisplayPixelSize(context);
int screenWidth = size.x;
int screenHeight = size.y;
sMaximumThumbnailWidthForEditor = (screenWidth > screenHeight) ? screenHeight : screenWidth;
// 48dp of padding on each side so you can still place the cursor next to the image.
int padding = DisplayUtils.dpToPx(context, 48) * 2;
sMaximumThumbnailWidthForEditor -= padding;
}
return sMaximumThumbnailWidthForEditor;
}
}

0 comments on commit 559f9b2

Please sign in to comment.