Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ The tutorial video is available here on Youtube : https://www.youtube.com/watch?
Clock Live Wallpaper is also published on Google Play Store : https://play.google.com/store/apps/details?id=com.ssaurel.clocklw

###Screenshot
![Screenshot] (https://github.com/ssaurel/android-clock-livewallpaper/blob/master/screenshot.png)
![Screenshot] (https://github.com/ThomasTraber/android-clock-livewallpaper/blob/master/screenshot.png)
9 changes: 7 additions & 2 deletions gen/com/ssaurel/clocklw/R.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ public final class R {
public static final class attr {
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
public static final int widgetdial=0x7f020001;
public static final int clock_michael_breuer_02=0x7f020000;
public static final int ic_launcher=0x7f020001;
public static final int whiteclock=0x7f020002;
public static final int widgetdial=0x7f020003;
public static final int widgetdial_org=0x7f020004;
public static final int woodenclock=0x7f020005;
public static final int woodenclock_src=0x7f020006;
}
public static final class layout {
public static final int main=0x7f030000;
Expand Down
Binary file added res/drawable/whiteclock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/drawable/widgetdial.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable/widgetdial_org.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable/woodenclock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable/woodenclock_src.xcf
Binary file not shown.
Binary file modified screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 9 additions & 5 deletions src/com/ssaurel/clocklw/AnalogClock.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,16 @@ protected void onDraw(Canvas canvas) {
float hour = cal.get(Calendar.HOUR_OF_DAY);
//draw hands
paint.setColor(colors[0]);
canvas.drawLine(x, y, (float) (x + (radius * 0.5f) * Math.cos(Math.toRadians((hour / 12.0f * 360.0f) - 90f))),
(float) (y + (radius * 0.5f) * Math.sin(Math.toRadians((hour / 12.0f * 360.0f) - 90f))), paint);
paint.setStrokeWidth(13);
paint.setStrokeCap(Paint.Cap.ROUND);
canvas.drawLine(x, y, (float) (x + (radius * 0.4f) * Math.cos(Math.toRadians(((hour + min/60f) / 12.0f * 360.0f) - 90f))),
(float) (y + (radius * 0.4f) * Math.sin(Math.toRadians(((hour + min/60f)/ 12.0f * 360.0f) - 90f))), paint);
canvas.save();
paint.setColor(colors[1]);
canvas.drawLine(x, y, (float) (x + (radius * 0.6f) * Math.cos(Math.toRadians((min / 60.0f * 360.0f) - 90f))),
(float) (y + (radius * 0.6f) * Math.sin(Math.toRadians((min / 60.0f * 360.0f) - 90f))), paint);
paint.setStrokeWidth(5);
paint.setStrokeCap(Paint.Cap.ROUND);
canvas.drawLine(x, y, (float) (x + (radius * 0.7f) * Math.cos(Math.toRadians((min / 60.0f * 360.0f) - 90f))),
(float) (y + (radius * 0.7f) * Math.sin(Math.toRadians((min / 60.0f * 360.0f) - 90f))), paint);
canvas.save();

if (displayHandSec) {
Expand All @@ -81,4 +85,4 @@ protected void onDraw(Canvas canvas) {
}
}
}
}
}
5 changes: 3 additions & 2 deletions src/com/ssaurel/clocklw/ClockWallpaperService.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void run() {

private Paint paint;
/** hands colors for hour, min, sec */
private int[] colors = { 0xFFFF0000, 0xFF0000FF, 0xFFA2BC13 };
private int[] colors = { 0xFF777777, 0xFF000000, 0xFFA2BC13 };
private int bgColor;
private int width;
private int height;
Expand All @@ -57,6 +57,7 @@ public ClockWallpaperEngine() {
paint.setAntiAlias(true);
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(5);
paint.setStrokeJoin(Paint.Join.ROUND);
bgColor = Color.parseColor("#C0C0C0");
clock = new AnalogClock(getApplicationContext());
handler.post(drawRunner);
Expand Down Expand Up @@ -110,7 +111,7 @@ private void draw() {

private void draw(Canvas canvas) {
canvas.drawColor(bgColor);
clock.config(width / 2, height / 2, (int) (width * 0.6f),
clock.config(width / 2, height /2 , (int) (width * 1.0f),
new Date(), paint, colors, displayHandSec);
clock.draw(canvas);
}
Expand Down