Change expander and divider look for MediaView

This commit is contained in:
Christopher Eby 2012-02-20 03:00:55 -06:00
parent 349b2295c0
commit 2a1217ae3b
8 changed files with 9 additions and 15 deletions

View File

@ -4,14 +4,19 @@
# For each SVG in orig/, PNGs will be created in the drawable directories
# for each DPI with the same name as the SVG. If the PNGs already exist
# and are newer than the SVG, they will not be recreated.
#
# Requires:
# - inkscape
# - imagemagick
# - optipng
gen() {
name=`basename "$1" .svgz`
png="res/drawable-$2/$name.png"
if [ "$1" -nt "$png" -o ! -e "$png" ]; then
inkscape --without-gui --export-area-page --export-dpi=$3 --export-png="$png" $1
convert -strip "$png" "$png"
optipng -quiet -o7 "$png"
convert -strip "$png" "$png" # strip comments and other metadata
optipng -quiet -o7 "$png" # shrink PNG
echo
fi
}

BIN
orig/arrow.svgz Normal file

Binary file not shown.

BIN
res/drawable-hdpi/arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

BIN
res/drawable-mdpi/arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 797 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

View File

@ -30,8 +30,6 @@ import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RadialGradient;
import android.graphics.Shader;
import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.View;
@ -55,10 +53,6 @@ public final class MediaView extends View {
* The paint object, cached for reuse.
*/
private static Paint sPaint;
/**
* The cached divider gradient that separates each view from other views.
*/
private static RadialGradient sDividerGradient;
/**
* The text size used for the text in all views.
*/
@ -67,9 +61,8 @@ public final class MediaView extends View {
public static void init(Context context)
{
Resources res = context.getResources();
sExpander = BitmapFactory.decodeResource(res, R.drawable.expander_arrow);
sExpander = BitmapFactory.decodeResource(res, R.drawable.arrow);
sTextSize = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 14, res.getDisplayMetrics());
sDividerGradient = null;
sPaint = new Paint();
sPaint.setTextSize(sTextSize);
@ -212,11 +205,7 @@ public final class MediaView extends View {
canvas.restore();
width = getWidth();
if (sDividerGradient == null)
sDividerGradient = new RadialGradient(width / 2, 1, width / 2, Color.WHITE, Color.TRANSPARENT, Shader.TileMode.CLAMP);
paint.setShader(sDividerGradient);
paint.setColor(Color.GRAY);
canvas.drawLine(0, height - 1, width, height - 1, paint);
paint.setShader(null);
}