Better preview visuals.
Smaller thumbnail (removed unnecessary padding), more opaque background. Uses a white background because the dark background interferes with the new dark widgets. Change-Id: I7654741d845609200569fce34b6cde891d2b5d29
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.3 KiB |
@@ -444,6 +444,22 @@ public class CellLayout extends ViewGroup {
|
||||
return mCellHeight;
|
||||
}
|
||||
|
||||
int getLeftPadding() {
|
||||
return mPortrait ? mShortAxisStartPadding : mLongAxisStartPadding;
|
||||
}
|
||||
|
||||
int getTopPadding() {
|
||||
return mPortrait ? mLongAxisStartPadding : mShortAxisStartPadding;
|
||||
}
|
||||
|
||||
int getRightPadding() {
|
||||
return mPortrait ? mShortAxisEndPadding : mLongAxisEndPadding;
|
||||
}
|
||||
|
||||
int getBottomPadding() {
|
||||
return mPortrait ? mLongAxisEndPadding : mShortAxisEndPadding;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
// TODO: currently ignoring padding
|
||||
|
||||
@@ -40,6 +40,7 @@ import android.content.res.Resources;
|
||||
import android.database.ContentObserver;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@@ -1562,8 +1563,21 @@ public final class Launcher extends Activity
|
||||
Bitmap cache = source.getDrawingCache();
|
||||
if (cache == null) return;
|
||||
|
||||
Bitmap bitmap = Bitmap.createScaledBitmap(cache,
|
||||
(int) (cache.getWidth() / 2.5f), (int) (cache.getHeight() / 2.5f), true);
|
||||
int width = cache.getWidth();
|
||||
int height = cache.getHeight();
|
||||
float sx = (int) (width / 2.5f) / (float) width;
|
||||
float sy = (int) (height / 2.5f) / (float) height;
|
||||
|
||||
Matrix m = new Matrix();
|
||||
m.setScale(sx, sy);
|
||||
|
||||
CellLayout cell = ((CellLayout) source);
|
||||
int x = cell.getLeftPadding();
|
||||
int y = cell.getTopPadding();
|
||||
width -= (x + cell.getRightPadding());
|
||||
height -= (y + cell.getBottomPadding());
|
||||
|
||||
Bitmap bitmap = Bitmap.createBitmap(cache, x, y, width, height, m, true);
|
||||
|
||||
ImageView preview = new ImageView(this);
|
||||
preview.setImageBitmap(bitmap);
|
||||
|
||||
Reference in New Issue
Block a user