Added Selecao icons
This commit is contained in:
parent
186fca8c2d
commit
bb361d8b68
2 changed files with 34 additions and 4 deletions
BIN
res/drawable/selecao.png
Normal file
BIN
res/drawable/selecao.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 116 KiB |
|
@ -2,13 +2,16 @@ package net.phoenixinquis.android.juiz;
|
|||
|
||||
import android.os.Handler;
|
||||
import android.os.SystemClock;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.WindowManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.service.wallpaper.WallpaperService;
|
||||
import android.service.wallpaper.WallpaperService.Engine;
|
||||
|
||||
|
@ -23,10 +26,12 @@ public class JuizWallpaper extends WallpaperService {
|
|||
private final Paint mPaint = new Paint();
|
||||
private boolean mVisible;
|
||||
private long mStartTime;
|
||||
private int mStatusBarHeight;
|
||||
private int mWidth;
|
||||
private int mHeight;
|
||||
private Bitmap mLogo;
|
||||
private Bitmap mNoblesse;
|
||||
private Bitmap mSelecao;
|
||||
|
||||
private final Runnable mDrawWallpaper = new Runnable() {
|
||||
public void run() {
|
||||
|
@ -41,6 +46,9 @@ public class JuizWallpaper extends WallpaperService {
|
|||
Resources res = getResources();
|
||||
mLogo = BitmapFactory.decodeResource(res, R.drawable.noblesse_logo);
|
||||
mNoblesse = BitmapFactory.decodeResource(res, R.drawable.noblesse_oblige);
|
||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
options.inScaled = false;
|
||||
mSelecao = BitmapFactory.decodeResource(res, R.drawable.selecao, options);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,6 +64,19 @@ public class JuizWallpaper extends WallpaperService {
|
|||
@Override
|
||||
public void onSurfaceChanged(SurfaceHolder holder, int format, int width, int height) {
|
||||
super.onSurfaceChanged(holder, format, width, height);
|
||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(displayMetrics);
|
||||
switch (displayMetrics.densityDpi) {
|
||||
case DisplayMetrics.DENSITY_HIGH:
|
||||
mStatusBarHeight = 38;
|
||||
break;
|
||||
case DisplayMetrics.DENSITY_LOW:
|
||||
mStatusBarHeight = 19;
|
||||
break;
|
||||
case DisplayMetrics.DENSITY_MEDIUM:
|
||||
default:
|
||||
mStatusBarHeight = 25;
|
||||
}
|
||||
mWidth = width;
|
||||
mHeight = height;
|
||||
drawFrame();
|
||||
|
@ -74,6 +95,7 @@ public class JuizWallpaper extends WallpaperService {
|
|||
DrawNoblesse(c);
|
||||
mPaint.setAlpha(0xff);
|
||||
DrawNotificationArea(c);
|
||||
DrawSelecao(c);
|
||||
}
|
||||
} finally {
|
||||
if (c != null) holder.unlockCanvasAndPost(c);
|
||||
|
@ -87,12 +109,12 @@ public class JuizWallpaper extends WallpaperService {
|
|||
}
|
||||
|
||||
void DrawLogo(Canvas c) {
|
||||
c.drawBitmap(mLogo, 170, mHeight - 330, mPaint);
|
||||
c.drawBitmap(mLogo, 180, mHeight - 330, mPaint);
|
||||
}
|
||||
void DrawNoblesse(Canvas c) {
|
||||
c.save(Canvas.CLIP_SAVE_FLAG);
|
||||
int x = mWidth - 110;
|
||||
int y = 200;
|
||||
int x = mWidth - 100;
|
||||
int y = 240 + mStatusBarHeight;
|
||||
int w = mNoblesse.getWidth();
|
||||
int h = mHeight - y;
|
||||
long now = SystemClock.elapsedRealtime();
|
||||
|
@ -115,9 +137,17 @@ public class JuizWallpaper extends WallpaperService {
|
|||
mPaint.setStrokeWidth(lineWidth);
|
||||
float x = mWidth - 50;
|
||||
for (int i = 0; i < 7; i++) {
|
||||
c.drawLine(x, 150, x, mHeight - 100, mPaint);
|
||||
c.drawLine(x, 240 + mStatusBarHeight, x, mHeight - 100, mPaint);
|
||||
x += (lineWidth + lineSpacing);
|
||||
}
|
||||
}
|
||||
void DrawSelecao(Canvas c) {
|
||||
mPaint.setStyle(Paint.Style.STROKE);
|
||||
mPaint.setStrokeWidth(2);
|
||||
mPaint.setAlpha(0xaa);
|
||||
c.drawBitmap(mSelecao, 10, mStatusBarHeight, mPaint);
|
||||
mPaint.setAlpha(0xff);
|
||||
c.drawRect(10, mStatusBarHeight + 2, mSelecao.getWidth() + 10, mSelecao.getHeight() + mStatusBarHeight, mPaint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue