Sub Process_Globals
Dim rv As RemoteViews
Dim Timer1 As Timer
End Sub
Sub Service_Create
rv = ConfigureHomeWidget("widget", "Uhr", 0, "Mengenlehre Uhr",True)
Timer1.Initialize("Timer1", 5000) 'changes display after 5 seconds
Timer1.Enabled = True
rv.UpdateWidget
End Sub
Sub Service_Start (StartingIntent As Intent)
Uhr_RequestUpdate
If StartingIntent.Action = "android.appwidget.action.APPWIDGET_DELETED" Then Return
If rv.HandleWidgetEvents(StartingIntent) = False Then
Uhr_RequestUpdate
Else
Return
End If
If StartingIntent.Action <> "android.appwidget.action.APPWIDGET_DISABLED" Then
StartServiceAt("", DateTime.now, False)
End If
End Sub
Sub Uhr_RequestUpdate
Dim bm As Bitmap
Dim cv As Canvas
Dim now As Long
Dim Stunde,Minute As Int
Dim Stunde5, StundeR, Minute5, MinuteR As Int
Dim r1,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16,r17,r18,r19,r20,r21,r22,r23,r24,r25 As Rect
Dim r30,r31,r32,r33,r34,r35,r36,r37,r38,r39,r40,r41,r42,r43,r44,r45,r46,r47,r48,r49,r50,r51,r52 As Rect
bm.InitializeMutable(211dip, 241dip)
cv.Initialize2(bm)
DateTime.DateFormat = "HHmmss"
now = DateTime.now
Stunde = DateTime.GetHour(now)
Minute = DateTime.GetMinute(now)
r1.Initialize(0, 0, 210, 240)
cv.DrawRect(r1,Colors.RGB(127,255,212),False,1dip)
r3.Initialize(5, 5, 55, 55)
r4.Initialize(55, 5, 105, 55)
r5.Initialize(105, 5, 155, 55)
r6.Initialize(155, 5, 205, 55)
r7.Initialize(5, 65, 55, 115)
r8.Initialize(55, 65, 105, 115)
r9.Initialize(105, 65, 155, 115)
r10.Initialize(155, 65, 205, 115)
r11.Initialize(5, 185, 55, 235)
r12.Initialize(55, 185, 105, 235)
r13.Initialize(105, 185, 155, 235)
r14.Initialize(155, 185, 205, 235)
cv.DrawRect(r3,Colors.RGB(255,255,255),False,1dip)
cv.DrawRect(r4,Colors.RGB(255,255,255),False,1dip)
cv.DrawRect(r5,Colors.RGB(255,255,255),False,1dip)
cv.DrawRect(r6,Colors.RGB(255,255,255),False,1dip)
cv.DrawRect(r7,Colors.RGB(255,255,255),False,1dip)
cv.DrawRect(r8,Colors.RGB(255,255,255),False,1dip)
cv.DrawRect(r9,Colors.RGB(255,255,255),False,1dip)
cv.DrawRect(r10,Colors.RGB(255,255,255),False,1dip)
cv.DrawRect(r11,Colors.RGB(255,255,255),False,1dip)
cv.DrawRect(r12,Colors.RGB(255,255,255),False,1dip)
cv.DrawRect(r13,Colors.RGB(255,255,255),False,1dip)
cv.DrawRect(r14,Colors.RGB(255,255,255),False,1dip)
r15.Initialize(6, 125, 24, 175)
r16.Initialize(24, 125, 42, 175)
r17.Initialize(42, 125, 60, 175)
r18.Initialize(60, 125, 78, 175)
r19.Initialize(78, 125, 96, 175)
r20.Initialize(96, 125, 114, 175)
r21.Initialize(114, 125, 132, 175)
r22.Initialize(132, 125, 150, 175)
r23.Initialize(150, 125, 168, 175)
r24.Initialize(168, 125, 186, 175)
r25.Initialize(186, 125, 204, 175)
cv.DrawRect(r15,Colors.RGB(255,255,255),False,1dip)
cv.DrawRect(r16,Colors.RGB(255,255,255),False,1dip)
cv.DrawRect(r17,Colors.RGB(255,255,255),False,1dip)
cv.DrawRect(r18,Colors.RGB(255,255,255),False,1dip)
cv.DrawRect(r19,Colors.RGB(255,255,255),False,1dip)
cv.DrawRect(r20,Colors.RGB(255,255,255),False,1dip)
cv.DrawRect(r21,Colors.RGB(255,255,255),False,1dip)
cv.DrawRect(r22,Colors.RGB(255,255,255),False,1dip)
cv.DrawRect(r23,Colors.RGB(255,255,255),False,1dip)
cv.DrawRect(r24,Colors.RGB(255,255,255),False,1dip)
cv.DrawRect(r25,Colors.RGB(255,255,255),False,1dip)
r30.Initialize(6, 6, 54, 54) ' 5 Stundenfelder Innen #1
r31.Initialize(56, 6, 104, 54) ' 5 Stundenfelder Innen #2
r32.Initialize(106, 6, 154, 54) ' 5 Stundenfelder Innen #3
r33.Initialize(156, 6, 204, 54) ' 5 Stundenfelder Innen #4
r34.Initialize(6, 66, 54, 114) ' 1 Stundenfelder Innen #1
r35.Initialize(56, 66, 104, 114) ' 1 Stundenfelder Innen #2
r36.Initialize(106, 66, 154, 114) ' 1 Stundenfelder Innen #3
r37.Initialize(156, 66, 204, 114) ' 1 Stundenfelder Innen #4
r38.Initialize(7, 126, 23, 174) ' 5 Minutenfelder Innen #1
r39.Initialize(25, 126, 41, 174) ' 5 Minutenfelder Innen #2
r40.Initialize(43, 126, 59, 174) ' 5 Minutenfelder Innen #3
r41.Initialize(61, 126, 77, 174) ' 5 Minutenfelder Innen #4
r42.Initialize(79, 126, 95, 174) ' 5 Minutenfelder Innen #5
r43.Initialize(97, 126, 113, 174) ' 5 Minutenfelder Innen #6
r44.Initialize(115, 126, 131, 174) ' 5 Minutenfelder Innen #7
r45.Initialize(133, 126, 149, 174) ' 5 Minutenfelder Innen #8
r46.Initialize(151, 126, 167, 174) ' 5 Minutenfelder Innen #9
r47.Initialize(169, 126, 185, 174) ' 5 Minutenfelder Innen #10
r48.Initialize(187, 126, 203, 174) ' 5 Minutenfelder Innen #11
r49.Initialize(6, 186, 54, 234) ' 1 Minutenfekder Innen #1
r50.Initialize(56, 186, 104, 234) ' 1 Minutenfekder Innen #1
r51.Initialize(106, 186, 154, 234) ' 1 Minutenfekder Innen #1
r52.Initialize(156, 186, 204, 234) ' 1 Minutenfekder Innen #1
Stunde5 = Stunde / 5
If Stunde5 > 0 Then
Select Stunde5
Case 1
cv.DrawRect(r30,Colors.RGB(255,0,0),True,1dip)
Case 2
cv.DrawRect(r30,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r31,Colors.RGB(255,0,0),True,1dip)
Case 3
cv.DrawRect(r30,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r31,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r32,Colors.RGB(255,0,0),True,1dip)
Case 4
cv.DrawRect(r30,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r31,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r32,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r33,Colors.RGB(255,0,0),True,1dip)
End Select
End If
StundeR = Stunde - (Stunde5 * 5)
If StundeR > 0 Then
Select StundeR
Case 1
cv.DrawRect(r34,Colors.RGB(255,0,0),True,1dip)
Case 2
cv.DrawRect(r34,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r35,Colors.RGB(255,0,0),True,1dip)
Case 3
cv.DrawRect(r34,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r35,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r36,Colors.RGB(255,0,0),True,1dip)
Case 4
cv.DrawRect(r34,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r35,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r36,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r37,Colors.RGB(255,0,0),True,1dip)
End Select
End If
Minute5 = Minute / 5
If Minute5 > 0 Then
Select Minute5
Case 1
cv.DrawRect(r38,Colors.RGB(255,215,0),True,1dip)
Case 2
cv.DrawRect(r38,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r39,Colors.RGB(255,215,0),True,1dip)
Case 3
cv.DrawRect(r38,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r39,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r40,Colors.RGB(255,0,0),True,1dip)
Case 4
cv.DrawRect(r38,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r39,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r40,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r41,Colors.RGB(255,215,0),True,1dip)
Case 5
cv.DrawRect(r38,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r39,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r40,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r41,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r42,Colors.RGB(255,215,0),True,1dip)
Case 6
cv.DrawRect(r38,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r39,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r40,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r41,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r42,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r43,Colors.RGB(255,0,0),True,1dip)
Case 7
cv.DrawRect(r38,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r39,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r40,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r41,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r42,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r43,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r44,Colors.RGB(255,215,0),True,1dip)
Case 8
cv.DrawRect(r38,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r39,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r40,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r41,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r42,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r43,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r44,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r45,Colors.RGB(255,215,0),True,1dip)
Case 9
cv.DrawRect(r38,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r39,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r40,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r41,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r42,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r43,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r44,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r45,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r46,Colors.RGB(255,0,0),True,1dip)
Case 10
cv.DrawRect(r38,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r39,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r40,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r41,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r42,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r43,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r44,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r45,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r46,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r47,Colors.RGB(255,215,0),True,1dip)
Case 11
cv.DrawRect(r38,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r39,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r40,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r41,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r42,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r43,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r44,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r45,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r46,Colors.RGB(255,0,0),True,1dip)
cv.DrawRect(r47,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r48,Colors.RGB(255,215,0),True,1dip)
End Select
End If
MinuteR = Minute - (Minute5 * 5)
If MinuteR > 0 Then
Select MinuteR
Case 1
cv.DrawRect(r49,Colors.RGB(255,215,0),True,1dip)
Case 2
cv.DrawRect(r49,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r50,Colors.RGB(255,215,0),True,1dip)
Case 3
cv.DrawRect(r49,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r50,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r51,Colors.RGB(255,215,0),True,1dip)
Case 4
cv.DrawRect(r49,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r50,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r51,Colors.RGB(255,215,0),True,1dip)
cv.DrawRect(r52,Colors.RGB(255,215,0),True,1dip)
End Select
End If
rv.SetImage("ImageView1", cv.Bitmap)
rv.UpdateWidget
End Sub
Sub rv_Disabled
CancelScheduledService("")
StopService("")
End Sub
Sub Service_Destroy
End Sub
Sub Timer1_Tick
Uhr_RequestUpdate
End Sub
Sub ImageView1_Click
StartActivity(Main)
End Sub