Initial Comit

This commit is contained in:
2021-12-19 10:56:25 +01:00
commit b8c9c75cf8
2351 changed files with 1819654 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Activity
Version=11
@EndOfDesignText@
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private Label5 As Label
Private Label3 As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("About")
Activity.Title="Über DPM-Mobile"
Label3.Text="Version 1.0"&CRLF&"11. Sept. 2021"
Label5.Text="(C) 2021 - Stefan Hutter Unternehmensberatung"&CRLF&"Staldenbachstrasse 13"&CRLF&"CH-8808 Pfäffikon SZ"&CRLF&"info@shub.ch - www.shub.ch"
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Private Sub Button3_Click
Activity.Finish
End Sub

View File

@@ -0,0 +1,62 @@
B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=StaticCode
Version=11
@EndOfDesignText@
'Code module
'Subs in this code module will be accessible from all modules.
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Public PatID As String
Public PID As String
Public sURL As String=""
Public ResettimerInterval As Int
Public Jobname As String
Public PatName As String
Public JobEnabled As Boolean=False
Public Searchstring As String
End Sub
Sub Get_Params(Param As String) As String
Try
Dim result As String
Dim TR As TextReader
Dim inp As InputStream
inp=File.OpenInput(File.DirInternal , "DPM.ini")
TR.Initialize(inp)
If Param="URL" Then
Try
result= TR.Readline
Catch
result=""
End Try
End If
If Param="TIMER" Then
Try
result=TR.Readline
result=TR.ReadLine
Catch
result=""
End Try
End If
TR.Close
Return result
Catch
End Try
End Sub
Sub Save_Parameter(url As String,append As Boolean)
Dim Tw As TextWriter
Dim out As OutputStream
out = File.OpenOutput(File.DirInternal , "DPM.ini",append)
Tw.Initialize(out)
Tw.WriteLine(url)
Tw.Flush
Tw.close
End Sub

View File

@@ -0,0 +1,238 @@
B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Activity
Version=11
@EndOfDesignText@
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private bs1 As BillScanner
Private pattimer As Timer
Dim lblpatient As Label
Dim pnlEnterPatID As Panel
Dim txtPatNr As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("BarcodeScanner")
Activity.Title="Charge-Scanner"
bs1.ScanMode = bs1.FORMAT_ONE_D
AllgFnkt.PatID=0
If File.Exists(File.DirInternal ,"DPM.ini") = True Then
AllgFnkt.sURL=AllgFnkt.Get_Params("URL")
AllgFnkt.ResettimerInterval=AllgFnkt.Get_Params("TIMER")
Else
End If
lblpatient.Text="Bitte Patient auswählen"
pattimer.Initialize("timer",AllgFnkt.ResettimerInterval)
End Sub
Sub Activity_Resume
If AllgFnkt.pid<>"" Then AllgFnkt.PatID=AllgFnkt.pid
If File.Exists(File.DirInternal ,"DPM.ini") = True Then
AllgFnkt.Get_Params("TIMER")
pattimer.Enabled=False
pattimer.Initialize("timer",AllgFnkt.ResettimerInterval)
pattimer.Enabled=True
End If
If AllgFnkt.PID<>"" Then get_Pat(AllgFnkt.PID)
End Sub
Sub Activity_Pause (UserClosed As Boolean)
Try
bs1.stopScanning
Catch
End Try
'AllgFnkt.PatID=0
End Sub
Sub Timer_Tick
AllgFnkt.PatID=0
lblpatient.Text="Bitte Patient auswählen"
End Sub
#Region Job
Sub get_Pat(id As String)
Dim job As HttpJob
AllgFnkt.JobName="GetPat"
job.Initialize(AllgFnkt.JobName, Me)
Dim callurl As String
callurl=AllgFnkt.sURL&"/DPMService/api/Service_View_Pat/"&id
job.Download(callurl)
End Sub
Sub get_Pat_Name(searchstring As String)
Dim job As HttpJob
AllgFnkt.Searchstring=searchstring
AllgFnkt.JobName="GetPatName"
job.Initialize(AllgFnkt.JobName, Me)
Dim callurl As String
callurl=AllgFnkt.sURL&"/DPMService/api/Service_View_Pat/search/"&searchstring
job.Download(callurl)
End Sub
Sub bs1_scan_value(val As String, rawbyte() As Byte, barcodetype As Int)
If AllgFnkt.JobEnabled=False Then Return
AllgFnkt.JobEnabled=False
Try
bs1.stopScanning
Catch
End Try
Dim job As HttpJob
AllgFnkt.JobName="PostCharche"
job.Initialize(AllgFnkt.JobName, Me)
job.PostString(AllgFnkt.sURL&"/DPMService/api/PatCharge/"&AllgFnkt.PatID&"/"&val,"")
Dim b As Beeper
b.Initialize(300, 500) '300 milliseconds, 500 hz
b.Beep
pattimer.Enabled=True
End Sub
Sub JobDone(Job As HttpJob)
ProgressDialogHide
If Job.Success Then
Dim res As String
res = Job.GetString
Dim parser As JSONParser
parser.Initialize(res)
Log("Response from server: " & res)
Select Job.JobName
Case "GetPat"
Dim list1 As List
list1 = parser.NextArray
If list1.Size<1 Then
ToastMessageShow("Patient nicht vorhanden.",True)
'/pnlEnterPatID.Visible=True
AllgFnkt.PatID=0
lblpatient.Text="Patient nicht vorhanden."
Return
End If
Dim map1 As Map
map1 = list1.Get(0)
Log(map1)
AllgFnkt.PatID = map1.Get("id")
AllgFnkt.PatName=map1.Get("pat")
lblpatient.Text=AllgFnkt.PatName
Case "GetPatName"
Dim list1 As List
list1 = parser.NextArray
If list1.Size<1 Then
ToastMessageShow("Keine Daten gefunden",True)
AllgFnkt.PatID=0
lblpatient.Text="Patient nicht vorhanden."
Return
End If
If list1.Size=1 Then
Dim map1 As Map
map1 = list1.Get(0)
AllgFnkt.PatID = map1.Get("id")
AllgFnkt.PatName=map1.Get("pat")
lblpatient.Text=AllgFnkt.PatName
Return
End If
StartActivity("ListPat")
'
'
' Dim map1 As Map
' map1 = list1.Get(0)
' Log(map1)
'
' AllgFnkt.PatID = map1.Get("id")
' AllgFnkt.PatName=map1.Get("pat")
' lblpatient.Text=AllgFnkt.PatName
Case "PostCharche"
ToastMessageShow("Barcode erfolgreich gespeichert",False)
End Select
Else
ToastMessageShow("Funktionsaufruf fehlgeschlagen.",True)
End If
Job.Release
End Sub
#End Region
#Region ButtonHandling
Private Sub btnSearchPat_Click
Dim inppat As InputDialog
If inppat.Show("Patient-Nr","Patient Nummer eingeben","OK","","",Null) = DialogResponse.CANCEL Then Return
get_Pat(inppat.Input)
pattimer.Enabled=False
get_Pat(txtPatNr.Text)
'pnlEnterPatID.Visible=False
'btnSearchPat.RequestFocus
pattimer.Enabled=True
End Sub
#End Region
Private Sub btnEnterPatID_Click
Dim inppat As InputDialog
inppat.InputType=inppat.INPUT_TYPE_NUMBERS
If inppat.Show("","Patient Nummer eingeben","OK","","",Null) = DialogResponse.CANCEL Then Return
get_Pat(inppat.Input)
lblpatient.RequestFocus
End Sub
Private Sub BtnStartScan_Click
If AllgFnkt.PatID=0 Then
ToastMessageShow("Bitte zuerst Patient wählen",True)
Return
End If
AllgFnkt.JobEnabled=True
bs1.startScanning
pattimer.Enabled=False
End Sub
Private Sub BtnStopScan_Click
Try
bs1.stopScanning
Catch
End Try
Activity.Finish
End Sub
Private Sub btnListdata_Click
If AllgFnkt.PatID=0 Then
ToastMessageShow("Bitte zuerst Patient auswählen.",True)
Return
End If
AllgFnkt.pid=AllgFnkt.PatID
AllgFnkt.PatName=lblpatient.Text
StartActivity("ListData")
End Sub
Private Sub btnEnterPatID_LongClick
Dim inppat As InputDialog
inppat.InputType=inppat.INPUT_TYPE_TEXT
If inppat.Show("","Patient Name eingeben","OK","","",Null) = DialogResponse.CANCEL Then Return
get_Pat_Name(inppat.Input)
lblpatient.RequestFocus
End Sub

View File

@@ -0,0 +1,573 @@
B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Class
Version=11
@EndOfDesignText@
'Class module
'Version: 1.1
'Author: Frédéric Leneuf-Magaud
'This class is released as donationware.
Sub Class_Globals
Private pnlContent As Panel
Private pnlSidebar As Panel
Private pnlGesture As Panel
Private sbParent As Panel
Private sbPosition As Byte
Private sbAnimType As Byte
Private sbInterpolator As Float
Private sbAnimInProgress As Byte
Private sbStopAnim As Boolean
Private sbOpenDuration As Int
Private sbCloseDuration As Int
Private sbIsVisible As Boolean
Private sbIsOpening As Boolean
Private sbStartX, sbStartY As Int
Private pnlSidebarStartX, pnlSidebarStartY As Int
Private pnlContentStartX, pnlContentStartY As Int
Private sbHandle As View
Private sbFinalMovement As Byte
Private sbSubFullyOpen As String
Private sbSubFullyClosed As String
Private sbSubMove As String
Private sbModule As Object
Private FROM_OPEN As Boolean: FROM_OPEN = True
Private FROM_CLOSE As Boolean: FROM_CLOSE = False
Private OPEN_ANIM As Boolean: OPEN_ANIM = False
Private CLOSE_ANIM As Boolean: CLOSE_ANIM = True
Private OPENING As Byte: OPENING = 1
Private CLOSING As Byte: CLOSING = 2
End Sub
'Initializes the content panel and its sidebar
'<B>Parent</B> = activity or panel holding the content panel and its sidebar
'<B>SidebarSize</B> = width or height of the sidebar
'<B>SidebarPosition</B>:<I>
' 0 = left
' 1 = right
' 2 = top
' 3 = bottom</I>
'<B>AnimType</B>:<I>
' 0 = the content panel is pushed to the side and reveals the sidebar
' 1 = the content panel and the sidebar move together to the side
' 2 = the sidebar slides above the content panel</I>
'<B>Open</B>/<B>CloseDuration</B> = duration of the opening/closing animation
Public Sub Initialize(Parent As Panel, SidebarSize As Int, SidebarPosition As Byte, AnimType As Byte, OpenDuration As Int, CloseDuration As Int)
sbParent = Parent
pnlContent.Initialize("Block")
Parent.AddView(pnlContent, 0, 0, getParentWidth, getParentHeight)
pnlSidebar.Initialize("Block")
Select SidebarPosition
Case 0 'LEFT
If AnimType = 0 Then
Parent.AddView(pnlSidebar, 0, 0, SidebarSize, getParentHeight)
Else
Parent.AddView(pnlSidebar, -SidebarSize, 0, SidebarSize, getParentHeight)
End If
Case 1 'RIGHT
If AnimType = 0 Then
Parent.AddView(pnlSidebar, getParentWidth - SidebarSize, 0, SidebarSize, getParentHeight)
Else
Parent.AddView(pnlSidebar, getParentWidth, 0, SidebarSize, getParentHeight)
End If
Case 2 'TOP
If AnimType = 0 Then
Parent.AddView(pnlSidebar, 0, 0, getParentWidth, SidebarSize)
Else
Parent.AddView(pnlSidebar, 0, -SidebarSize, getParentWidth, SidebarSize)
End If
Case 3 'BOTTOM
If AnimType = 0 Then
Parent.AddView(pnlSidebar, 0, getParentHeight - SidebarSize, getParentWidth, SidebarSize)
Else
Parent.AddView(pnlSidebar, 0, getParentHeight, getParentWidth, SidebarSize)
End If
End Select
If AnimType = 0 Then pnlSidebar.SendToBack
sbPosition = SidebarPosition
sbAnimType = AnimType
sbInterpolator = 0.7
sbOpenDuration = OpenDuration
sbCloseDuration = CloseDuration
sbIsVisible = False
End Sub
Private Sub Block_Touch(Action As Int, X As Float, Y As Float)
' This sub is just there to prevent the Touch events from passing through
End Sub
'Gets a drawable from the Android system resources
Public Sub LoadDrawable(Name As String) As Object
Dim r As Reflector
r.Target = r.GetContext
r.Target = r.RunMethod("getResources")
r.Target = r.RunMethod("getSystem")
Dim ID_Drawable As Int
ID_Drawable = r.RunMethod4("getIdentifier", Array As Object(Name, "drawable", "android"), _
Array As String("java.lang.String", "java.lang.String", "java.lang.String"))
r.Target = r.GetContext
r.Target = r.RunMethod("getResources")
Return r.RunMethod2("getDrawable", ID_Drawable, "java.lang.int")
End Sub
'Sets the three event handlers
'<B>Module</B> = Me
'<B>SubOnFullyOpen</B> = name of the sub handling the onFullyOpen event
' Handler: <I>Sub onFullyOpen</I>
'<B>SubOnFullyClosed</B> = name of the sub handling the onFullyClosed event
' Handler: <I>Sub onFullyClosed</I>
'<B>SubOnMove</B> = name of the sub handling the onMove event
' Handler: <I>Sub onMove(IsOpening As Boolean)</I>
Public Sub SetOnChangeListeners(Module As Object, SubOnFullyOpen As String, SubOnFullyClosed As String, SubOnMove As String)
sbModule = Module
sbSubFullyOpen = SubOnFullyOpen
sbSubFullyClosed = SubOnFullyClosed
sbSubMove = SubOnMove
End Sub
Public Sub Sidebar As Panel
Return pnlSidebar
End Sub
Public Sub ContentPanel As Panel
Return pnlContent
End Sub
#Region Parent Width/Height
'Gets the real width of the parent
'In some containers like TabHosts, the width property returns -1, so this function uses a different method to get width
Private Sub getParentWidth As Int
If sbParent.Width < 0 Then
Dim r As Reflector, RealWidth As Int
r.Target = sbParent
RealWidth = r.RunMethod("getWidth")
If RealWidth = 0 Then
DoEvents
RealWidth = r.RunMethod("getWidth")
End If
Return RealWidth
Else
Return sbParent.Width
End If
End Sub
'Gets the real height of the parent
'In some containers like TabHosts, the height property returns -1, so this function uses a different method to get height
Private Sub getParentHeight As Int
If sbParent.Height < 0 Then
Dim r As Reflector, RealHeight As Int
r.Target = sbParent
RealHeight = r.RunMethod("getHeight")
If RealHeight = 0 Then
DoEvents
RealHeight = r.RunMethod("getHeight")
End If
Return RealHeight
Else
Return sbParent.Height
End If
End Sub
#End Region
#Region Animation
'Sets the animation rate of change
'<B>Value</B>:
'&lt; 1 = decelerate
'1 = linear
'&gt; 1 = accelerate
Public Sub SetInterpolator(Value As Float)
sbInterpolator = Value
End Sub
Private Sub Animate(Progression As Int)
Select sbPosition
Case 0 'LEFT
If sbAnimType > 0 Then pnlSidebar.Left = pnlSidebarStartX + Progression
If sbAnimType < 2 Then pnlContent.Left = pnlContentStartX + Progression
If sbAnimType = 2 Then
If sbHandle.IsInitialized Then sbHandle.Left = pnlSidebar.Left + pnlSidebar.Width
If pnlGesture.IsInitialized Then pnlGesture.Left = pnlSidebar.Left + pnlSidebar.Width - (pnlGesture.Width / 2)
Else
If sbHandle.IsInitialized Then sbHandle.Left = pnlContent.Left
If pnlGesture.IsInitialized Then pnlGesture.Left = pnlContent.Left - (pnlGesture.Width / 2)
End If
Case 1 'RIGHT
If sbAnimType > 0 Then pnlSidebar.Left = pnlSidebarStartX + Progression
If sbAnimType < 2 Then pnlContent.Left = pnlContentStartX + Progression
If sbAnimType = 2 Then
If sbHandle.IsInitialized Then sbHandle.Left = pnlSidebar.Left - sbHandle.Width
If pnlGesture.IsInitialized Then pnlGesture.Left = pnlSidebar.Left - (pnlGesture.Width / 2)
Else
If sbHandle.IsInitialized Then sbHandle.Left = pnlContent.Left + pnlContent.Width - sbHandle.Width
If pnlGesture.IsInitialized Then pnlGesture.Left = pnlContent.Left + pnlContent.Width - (pnlGesture.Width / 2)
End If
Case 2 'TOP
If sbAnimType > 0 Then pnlSidebar.Top = pnlSidebarStartY + Progression
If sbAnimType < 2 Then pnlContent.Top = pnlContentStartY + Progression
If sbAnimType = 2 Then
If sbHandle.IsInitialized Then sbHandle.Top = pnlSidebar.Top + pnlSidebar.Height
If pnlGesture.IsInitialized Then pnlGesture.Top = pnlSidebar.Top + pnlSidebar.Height - (pnlGesture.Height / 2)
Else
If sbHandle.IsInitialized Then sbHandle.Top = pnlContent.Top
If pnlGesture.IsInitialized Then pnlGesture.Top = pnlContent.Top - (pnlGesture.Height / 2)
End If
Case 3 'BOTTOM
If sbAnimType > 0 Then pnlSidebar.Top = pnlSidebarStartY + Progression
If sbAnimType < 2 Then pnlContent.Top = pnlContentStartY + Progression
If sbAnimType = 2 Then
If sbHandle.IsInitialized Then sbHandle.Top = pnlSidebar.Top - sbHandle.Height
If pnlGesture.IsInitialized Then pnlGesture.Top = pnlSidebar.Top - (pnlGesture.Height / 2)
Else
If sbHandle.IsInitialized Then sbHandle.Top = pnlContent.Top + pnlContent.Height - sbHandle.Height
If pnlGesture.IsInitialized Then pnlGesture.Top = pnlContent.Top + pnlContent.Height - (pnlGesture.Height / 2)
End If
End Select
sbIsVisible = (CalcDistance(FROM_CLOSE) <> 0)
End Sub
Private Sub AnimateSidebar(Close As Boolean)
' Calculates the animation distance and duration (the closer it is to the position to reach, the shorter the duration)
Dim AnimDistance, AnimDuration As Int
Dim PctStillToMove As Float
If Close Then
AnimDistance = CalcDistance(FROM_CLOSE)
PctStillToMove = Abs(AnimDistance) / pnlSidebar.Width
AnimDuration = sbCloseDuration * PctStillToMove
sbAnimInProgress = CLOSING
Else
AnimDistance = CalcDistance(FROM_OPEN)
PctStillToMove = Abs(AnimDistance) / pnlSidebar.Width
AnimDuration = sbOpenDuration * PctStillToMove
sbAnimInProgress = OPENING
End If
If AnimDistance = 0 Then
' No distance -> no need for an animation
sbAnimInProgress = 0
TriggerFinalEvent
Return
End If
pnlSidebarStartX = pnlSidebar.Left
pnlSidebarStartY = pnlSidebar.Top
pnlContentStartX = pnlContent.Left
pnlContentStartY = pnlContent.Top
' Animates the views
sbStopAnim = False
Dim Progression As Float
Dim EndTime, DeltaTime As Long
EndTime = DateTime.Now + AnimDuration
Do While DateTime.Now < EndTime
DeltaTime = EndTime - DateTime.Now
Animate(Power(1 - (DeltaTime / AnimDuration), sbInterpolator) * AnimDistance)
If SubExists(sbModule, sbSubMove) Then
' Triggers an onMove event
CallSub2(sbModule, sbSubMove, Not(Close))
End If
DoEvents 'Processes the draw messages and keeps the UI responsive
If sbStopAnim Then
DeltaTime = 0
Exit
End If
Loop
If DeltaTime <> 0 Then Animate(AnimDistance)
sbAnimInProgress = 0
TriggerFinalEvent
End Sub
#End Region
'Opens the sidebar
Public Sub OpenSidebar
If sbAnimInProgress = CLOSING Then
' Stops the current closing animation to start an opening animation
sbStopAnim = True
CallSubDelayed2(Me, "AnimateSidebar", OPEN_ANIM)
Else If sbAnimInProgress = 0 Then
' Starts an opening animation if there's not already one running
AnimateSidebar(OPEN_ANIM)
End If
End Sub
'Closes the sidebar
Public Sub CloseSidebar
If sbAnimInProgress = OPENING Then
' Stops the current opening animation to start a closing animation
sbStopAnim = True
CallSubDelayed2(Me, "AnimateSidebar", CLOSE_ANIM)
Else If sbAnimInProgress = 0 Then
' Starts a closing animation if there's not already one running
AnimateSidebar(CLOSE_ANIM)
End If
End Sub
'Is the sidebar currently visible ?
Public Sub IsSidebarVisible As Boolean
Return sbIsVisible
End Sub
#Region Button, handle & swipe gesture
'Sets the button used to open or close the sidebar
'The button can be a Panel, an ImageView, a Button...
'It must be initialized and on screen.
Public Sub SetOpenCloseButton(Btn As View)
If Btn = Null Then Return
Dim r As Reflector
r.Target = Btn
r.SetOnClickListener("Btn_Click")
End Sub
Private Sub Btn_Click(ViewTag As Object)
If IsSidebarVisible Then
If sbAnimInProgress = CLOSING Then
OpenSidebar
Else
CloseSidebar
End If
Else
OpenSidebar
End If
End Sub
'Adds the handle used to open or close the sidebar
'The handle can be a Panel, an ImageView, a Button...
'It must be initialized but not yet on screen.
'<B>Position</B> = top position if the sidebar is on the left or the right, left position otherwise
'<B>FinalMovement</B>:<I>
'0 = the sidebar can stay partially open/closed. There's no final movement.
'1 = the sidebar cannot stay partially open/closed. The final movement is an opening if the last movement was an opening movement, otherwise it is a closing.
'2 = the sidebar cannot stay partially open/closed. The final movement is an opening if the visible size of the sidebar >= 50% of its total size, otherwise it is a closing.</I>
Public Sub AddOpenCloseHandle(Hdl As View, Position As Int, Width As Int, Height As Int, FinalMovement As Byte)
If Hdl = Null Then Return
sbHandle = Hdl
Select sbPosition
Case 0 'LEFT
sbParent.AddView(Hdl, pnlContent.Left, Position, Width, Height)
Case 1 'RIGHT
sbParent.AddView(Hdl, pnlContent.Left + pnlContent.Width - Width, Position, Width, Height)
Case 2 'TOP
sbParent.AddView(Hdl, Position, pnlContent.Top, Width, Height)
Case 3 'BOTTOM
sbParent.AddView(Hdl, Position, pnlContent.Top + pnlContent.Height - Height, Width, Height)
End Select
sbFinalMovement = FinalMovement
Dim r As Reflector
r.Target = Hdl
r.SetOnTouchListener("Gesture_onTouch")
End Sub
'Enables the swipe gesture to open/close the sidebar
'<B>GestureAreaSize</B> = size of the gesture area
'The gesture area is an area above the frontier between the sidebar and the content panel where the gesture is expected.
'This area consumes all Touch events.
'<B>FinalMovement</B>:<I>
'0 = the sidebar can stay partially open/closed. There's no final movement.
'1 = the sidebar cannot stay partially open/closed. The final movement is an opening if the last movement was an opening movement, otherwise it is a closing.
'2 = the sidebar cannot stay partially open/closed. The final movement is an opening if the visible size of the sidebar >= 50% of its total size, otherwise it is a closing.</I>
Public Sub EnableSwipeGesture(Enabled As Boolean, GestureAreaSize As Int, FinalMovement As Byte)
If Not(Enabled) Then
If pnlGesture.IsInitialized Then pnlGesture.RemoveView
pnlGesture = Null
Return
End If
If pnlGesture.IsInitialized Then
Select sbPosition
Case 0 'LEFT
pnlGesture.SetLayout(pnlContent.Left - (GestureAreaSize / 2), 0, GestureAreaSize, getParentHeight)
Case 1 'RIGHT
pnlGesture.SetLayout(pnlContent.Left + pnlContent.Width - (GestureAreaSize / 2), 0, GestureAreaSize, getParentHeight)
Case 2 'TOP
pnlGesture.SetLayout(0, pnlContent.Top - (GestureAreaSize / 2), getParentWidth, GestureAreaSize)
Case 3 'BOTTOM
pnlGesture.SetLayout(0, pnlContent.Top + pnlContent.Height - (GestureAreaSize / 2), getParentWidth, GestureAreaSize)
End Select
Else
pnlGesture.Initialize("")
Select sbPosition
Case 0 'LEFT
sbParent.AddView(pnlGesture, pnlContent.Left - (GestureAreaSize / 2), 0, GestureAreaSize, getParentHeight)
Case 1 'RIGHT
sbParent.AddView(pnlGesture, pnlContent.Left + pnlContent.Width - (GestureAreaSize / 2), 0, GestureAreaSize, getParentHeight)
Case 2 'TOP
sbParent.AddView(pnlGesture, 0, pnlContent.Top - (GestureAreaSize / 2), getParentWidth, GestureAreaSize)
Case 3 'BOTTOM
sbParent.AddView(pnlGesture, 0, pnlContent.Top + pnlContent.Height - (GestureAreaSize / 2), getParentWidth, GestureAreaSize)
End Select
Dim r As Reflector
r.Target = pnlGesture
r.SetOnTouchListener("Gesture_onTouch")
End If
sbFinalMovement = FinalMovement
End Sub
#End Region
Private Sub CalcDistance(FromOpen As Boolean) As Int
' Calculates the distance between the current position and the position to reach
Select sbPosition
Case 0 'LEFT
If sbAnimType = 2 Then
If FromOpen Then
Return - pnlSidebar.Left
Else
Return - pnlSidebar.Left - pnlSidebar.Width
End If
Else
If FromOpen Then
Return pnlSidebar.Width - pnlContent.Left
Else
Return - pnlContent.Left
End If
End If
Case 1 'RIGHT
If sbAnimType = 2 Then
If FromOpen Then
Return - pnlSidebar.Left + pnlContent.Width - pnlSidebar.Width
Else
Return - pnlSidebar.Left + pnlContent.Width
End If
Else
If FromOpen Then
Return - pnlSidebar.Width - pnlContent.Left
Else
Return - pnlContent.Left
End If
End If
Case 2 'TOP
If sbAnimType = 2 Then
If FromOpen Then
Return - pnlSidebar.Top
Else
Return - pnlSidebar.Top - pnlSidebar.Height
End If
Else
If FromOpen Then
Return pnlSidebar.Height - pnlContent.Top
Else
Return - pnlContent.Top
End If
End If
Case 3 'BOTTOM
If sbAnimType = 2 Then
If FromOpen Then
Return - pnlSidebar.Top + pnlContent.Height - pnlSidebar.Height
Else
Return - pnlSidebar.Top + pnlContent.Height
End If
Else
If FromOpen Then
Return - pnlSidebar.Height - pnlContent.Top
Else
Return - pnlContent.Top
End If
End If
End Select
End Sub
Private Sub Gesture_onTouch(ViewTag As Object, Action As Int, X As Float, Y As Float, MotionEvent As Object) As Boolean
If Action = 0 Then
sbStopAnim = True
sbStartX = X
sbStartY = Y
Else If Action = 2 Then
' Moves the views to follow the finger
Dim OldPos As Int
Select sbPosition
Case 0 'LEFT
If sbAnimType = 2 Then
OldPos = pnlSidebar.Left
pnlSidebar.Left = Max(-pnlSidebar.Width, Min(pnlSidebar.Left + X - sbStartX, 0))
If sbHandle.IsInitialized Then sbHandle.Left = sbHandle.Left - OldPos + pnlSidebar.Left
If pnlGesture.IsInitialized Then pnlGesture.Left = pnlGesture.Left - OldPos + pnlSidebar.Left
Else
OldPos = pnlContent.Left
pnlContent.Left = Max(0, Min(pnlContent.Left + X - sbStartX, pnlSidebar.Width))
If sbAnimType = 1 Then pnlSidebar.Left = pnlContent.Left - pnlSidebar.Width
If sbHandle.IsInitialized Then sbHandle.Left = sbHandle.Left - OldPos + pnlContent.Left
If pnlGesture.IsInitialized Then pnlGesture.Left = pnlGesture.Left - OldPos + pnlContent.Left
End If
sbIsOpening = X > sbStartX
Case 1 'RIGHT
If sbAnimType = 2 Then
OldPos = pnlSidebar.Left
pnlSidebar.Left = Max(pnlContent.Width - pnlSidebar.Width, Min(pnlSidebar.Left + X - sbStartX, pnlContent.Width))
If sbHandle.IsInitialized Then sbHandle.Left = sbHandle.Left - OldPos + pnlSidebar.Left
If pnlGesture.IsInitialized Then pnlGesture.Left = pnlGesture.Left - OldPos + pnlSidebar.Left
Else
OldPos = pnlContent.Left
pnlContent.Left = Max(-pnlSidebar.Width, Min(pnlContent.Left + X - sbStartX, 0))
If sbAnimType = 1 Then pnlSidebar.Left = pnlContent.Left + pnlContent.Width
If sbHandle.IsInitialized Then sbHandle.Left = sbHandle.Left - OldPos + pnlContent.Left
If pnlGesture.IsInitialized Then pnlGesture.Left = pnlGesture.Left - OldPos + pnlContent.Left
End If
sbIsOpening = X < sbStartX
Case 2 'TOP
If sbAnimType = 2 Then
OldPos = pnlSidebar.Top
pnlSidebar.Top = Max(-pnlSidebar.Height, Min(pnlSidebar.Top + Y - sbStartY, 0))
If sbHandle.IsInitialized Then sbHandle.Top = sbHandle.Top - OldPos + pnlSidebar.Top
If pnlGesture.IsInitialized Then pnlGesture.Top = pnlGesture.Top - OldPos + pnlSidebar.Top
Else
OldPos = pnlContent.Top
pnlContent.Top = Max(0, Min(pnlContent.Top + Y - sbStartY, pnlSidebar.Height))
If sbAnimType = 1 Then pnlSidebar.Top = pnlContent.Top - pnlSidebar.Height
If sbHandle.IsInitialized Then sbHandle.Top = sbHandle.Top - OldPos + pnlContent.Top
If pnlGesture.IsInitialized Then pnlGesture.Top = pnlGesture.Top - OldPos + pnlContent.Top
End If
sbIsOpening = Y > sbStartY
Case 3 'BOTTOM
If sbAnimType = 2 Then
OldPos = pnlSidebar.Top
pnlSidebar.Top = Max(pnlContent.Height - pnlSidebar.Height, Min(pnlSidebar.Top + Y - sbStartY, pnlContent.Height))
If sbHandle.IsInitialized Then sbHandle.Top = sbHandle.Top - OldPos + pnlSidebar.Top
If pnlGesture.IsInitialized Then pnlGesture.Top = pnlGesture.Top - OldPos + pnlSidebar.Top
Else
OldPos = pnlContent.Top
pnlContent.Top = Max(-pnlSidebar.Height, Min(pnlContent.Top + Y - sbStartY, 0))
If sbAnimType = 1 Then pnlSidebar.Top = pnlContent.Top + pnlContent.Height
If sbHandle.IsInitialized Then sbHandle.Top = sbHandle.Top - OldPos + pnlContent.Top
If pnlGesture.IsInitialized Then pnlGesture.Top = pnlGesture.Top - OldPos + pnlContent.Top
End If
sbIsOpening = Y < sbStartY
End Select
sbIsVisible = (CalcDistance(FROM_CLOSE) <> 0)
' Triggers an onMove event
If SubExists(sbModule, sbSubMove) Then
If sbIsOpening Then
CallSub2(sbModule, sbSubMove, True)
Else
CallSub2(sbModule, sbSubMove, False)
End If
End If
Else If Action = 1 Then
' Is there a final movement to do?
If sbFinalMovement > 0 And sbIsVisible Then
If sbFinalMovement = 2 Then sbIsOpening = Abs(CalcDistance(FROM_CLOSE)) >= Abs(CalcDistance(FROM_OPEN))
If sbIsOpening Then
CallSubDelayed2(Me, "AnimateSidebar", OPEN_ANIM)
Else
CallSubDelayed2(Me, "AnimateSidebar", CLOSE_ANIM)
End If
Else
TriggerFinalEvent
End If
End If
Return True
End Sub
Sub TriggerFinalEvent
' Triggers an onFullyOpen or onFullyClosed event
If CalcDistance(FROM_OPEN) = 0 And SubExists(sbModule, sbSubFullyOpen) Then
CallSub(sbModule, sbSubFullyOpen)
Else If CalcDistance(FROM_CLOSE) = 0 And SubExists(sbModule, sbSubFullyClosed) Then
CallSub(sbModule, sbSubFullyClosed)
End If
End Sub

View File

@@ -0,0 +1,140 @@
Build1=Default,shub.dpm
File1=About.bal
File10=Parameter.bal
File11=patient.png
File12=scan.png
File13=Settings.png
File14=stopscan.png
File2=arrowback.png
File3=BarcodeScanner.bal
File4=ChargeScan.png
File5=daten.png
File6=icon.png
File7=LData.bal
File8=LPat.bal
File9=MainPage.bal
FileGroup1=Default Group
FileGroup10=Default Group
FileGroup11=Default Group
FileGroup12=Default Group
FileGroup13=Default Group
FileGroup14=Default Group
FileGroup2=Default Group
FileGroup3=Default Group
FileGroup4=Default Group
FileGroup5=Default Group
FileGroup6=Default Group
FileGroup7=Default Group
FileGroup8=Default Group
FileGroup9=Default Group
Group=Default Group
Library1=audio
Library2=b4xpages
Library3=billscanner
Library4=core
Library5=ime
Library6=json
Library7=okhttputils2
Library8=dialogs
ManifestCode='This code will be applied to the manifest file during compilation.~\n~'You do not need to modify it in most cases.~\n~'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136~\n~AddManifestText(~\n~<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="29"/>~\n~<supports-screens android:largeScreens="true" ~\n~ android:normalScreens="true" ~\n~ android:smallScreens="true" ~\n~ android:anyDensity="true"/>)~\n~SetApplicationAttribute(android:icon, "@drawable/icon")~\n~SetApplicationAttribute(android:label, "$LABEL$")~\n~'CreateResourceFromFile(Macro, Themes.DarkTheme)~\n~'End of default text.~\n~CreateResourceFromFile(Macro, Core.NetworkClearText)~\n~AddApplicationText(<meta-data~\n~ android:name="com.google.android.gms.version"~\n~ android:value="@integer/google_play_services_version" />~\n~ <meta-data~\n~ android:name="com.google.android.gms.vision.DEPENDENCIES"~\n~ android:value="barcode" />)~\n~ ~\n~AddManifestText(<uses-feature android:name="android.hardware.camera" android:required="true" />)~\n~AddManifestText(<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />)~\n~AddManifestText(<uses-feature android:name="android.hardware.camera.flash" android:required="false" />)~\n~~\n~~\n~
Module1=About
Module2=AllgFnkt
Module3=|relative|..\B4XMainPage
Module4=BarcodeScanner
Module5=ListData
Module6=ListPat
Module7=MenuHandler
Module8=Parameter
Module9=Starter
NumberOfFiles=14
NumberOfLibraries=8
NumberOfModules=9
Version=11
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: DPM Mobile
#VersionCode: 1
#VersionName: Initial
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False
#MultiDex: True
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: true
#End Region
'#BridgeLogger: True
Sub Process_Globals
End Sub
Sub Globals
Dim clsMenuHandler As MenuHandler
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim pm As B4XPagesManager
pm.Initialize(Activity)
Activity.LoadLayout("MainPage")
Activity.Title="DPM Mobile"
Activity.TitleColor=0xFF077AFF
End Sub
Private Sub BtnSetings_Click
StartActivity("Parameter")
End Sub
Private Sub Button1_Click
StartActivity("BarcodeScanner")
End Sub
'Template version: B4A-1.01
#Region Delegates
Sub Activity_ActionBarHomeClick
' ActionBarHomeClicked = True
' B4XPages.Delegate.Activity_ActionBarHomeClick
' ActionBarHomeClicked = False
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean
Return B4XPages.Delegate.Activity_KeyPress(KeyCode)
End Sub
Sub Activity_Resume
B4XPages.Delegate.Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
B4XPages.Delegate.Activity_Pause
End Sub
Sub Activity_PermissionResult (Permission As String, Result As Boolean)
B4XPages.Delegate.Activity_PermissionResult(Permission, Result)
End Sub
Sub Create_Menu (Menu As Object)
B4XPages.Delegate.Create_Menu(Menu)
End Sub
#if Java
public boolean _onCreateOptionsMenu(android.view.Menu menu) {
processBA.raiseEvent(null, "create_menu", menu);
return true;
}
#End If
#End Region
'Program code should go into B4XMainPage and other pages.
Private Sub ImageView1_Click
StartActivity("About")
End Sub

View File

@@ -0,0 +1,33 @@
ModuleBookmarks0=
ModuleBookmarks1=
ModuleBookmarks2=
ModuleBookmarks3=
ModuleBookmarks4=
ModuleBookmarks5=
ModuleBookmarks6=
ModuleBookmarks7=
ModuleBookmarks8=
ModuleBookmarks9=
ModuleBreakpoints0=
ModuleBreakpoints1=
ModuleBreakpoints2=
ModuleBreakpoints3=
ModuleBreakpoints4=
ModuleBreakpoints5=
ModuleBreakpoints6=
ModuleBreakpoints7=
ModuleBreakpoints8=
ModuleBreakpoints9=
ModuleClosedNodes0=
ModuleClosedNodes1=
ModuleClosedNodes2=
ModuleClosedNodes3=
ModuleClosedNodes4=
ModuleClosedNodes5=
ModuleClosedNodes6=
ModuleClosedNodes7=
ModuleClosedNodes8=
ModuleClosedNodes9=1
NavigationStack=ListData,SetHeader,207,6,ListPat,init_view,51,2,Visueller Designer,LData.bal,-100,2,Visueller Designer,LPat.bal,-100,1,ListPat,AddRow,181,6,ListPat,SetHeader,214,6,BarcodeScanner,JobDone,153,0,ListPat,Cell_LongClick,118,6,BarcodeScanner,btnEnterPatID_Click,190,0,BarcodeScanner,Activity_Resume,48,6,BarcodeScanner,get_Pat,66,0
SelectedBuild=0
VisibleModules=3,8,1,4,2,7,5,6

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 992 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1,254 @@
B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Activity
Version=11
@EndOfDesignText@
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
End Sub
Sub Globals
Dim jobname As String
Dim SV As ScrollView
Dim BtnClose As Button
Dim Header As Panel
Dim Table As Panel
Dim NumberOfColumns, RowHeight, ColumnWidth As Int
Dim HeaderColor, TableColor, FontColor, HeaderFontColor As Int
Dim FontSize As Float
Type RowCol (Row As Int, Col As Int)
Dim Alignment As Int
Dim SelectedRow As Int
Dim SelectedRowColor As Int
'Table settings
HeaderColor = Colors.Gray
NumberOfColumns = 3
RowHeight = 30dip
TableColor = Colors.White
FontColor = Colors.Black
HeaderFontColor = Colors.White
FontSize = 11
Alignment = Gravity.CENTER 'change to Gravity.LEFT or Gravity.RIGHT for other alignments.
SelectedRowColor = Colors.Blue
Dim list1 As List
End Sub
Sub Activity_Create(FirstTime As Boolean)
init_view
End Sub
Sub init_view
SV.Initialize(0)
Activity.LoadLayout("LData")
Table = SV.Panel
Table.Color = TableColor
Activity.AddView(SV, 5%x, 10%y, 90%x, 80%y)
Activity.Title="Chargen"
ColumnWidth = SV.Width / NumberOfColumns
SelectedRow = -1
'add header
SetHeader(Array As String("ID", "Charge", "Datum"))
'add rows
Get_Data
Activity.Title="Daten " & AllgFnkt.PatName
End Sub
Sub Get_Data
Dim job As HttpJob
jobname="GetData"
job.Initialize(jobname, Me)
job.Download(AllgFnkt.sURL&"/DPMService/api/PatCharge/"&AllgFnkt.PatID)
End Sub
Sub JobDone(Job As HttpJob)
ProgressDialogHide
If Job.Success Then
Dim res As String
res = Job.GetString
Dim parser As JSONParser
parser.Initialize(res)
Log("Response from server: " & res)
Select Job.JobName
Case "DelData"
list1.Clear
Table.RemoveAllViews
init_view
'Get_Data
Case "GetData"
list1 = parser.NextArray
Dim i As Int
For i=0 To list1.Size-1
Dim map1 As Map
map1=list1.Get(i)
Dim s1 As String
Dim s2 As String
Dim s3 As String
s1=map1.Get("id")
s2=map1.Get("charge")
s3=map1.Get("datum")
AddRow(Array As String(s1,s2,s3))
Next
If list1.Size<1 Then
ToastMessageShow("Keine Daten vorhanden.",True)
Return
End If
End Select
End If
End Sub
Sub Cell_LongClick
Dim rc As RowCol
Dim l As Label
Dim x As String
x=""
l = Sender
rc = l.Tag
SelectRow(rc.Row)
' Activity.Title = "Cell clicked: (" & rc.Row & ", " & rc.Col &")"
For i=0 To list1.Size-1
If i=rc.Row Then
Dim map1 As Map
map1=list1.Get(i)
x=map1.Get("id")
'ToastMessageShow(map1.Get("id"),False)
End If
Next
If x<>"" Then
Msgbox2Async("Eintrag Nr. "&x&" wirkllich löschen?", "Charge-Eintrag löschen", "Ja", "Nein", "", Null, False)
Wait For MsgBox_Result (Result As Int)
If Result = DialogResponse.POSITIVE Then
Dim job As HttpJob
jobname="DelData"
job.Initialize(jobname, Me)
job.Delete(AllgFnkt.sURL&"/DPMService/api/PatCharge/"&x)
End If
End If
End Sub
Sub Cell_Click
Dim rc As RowCol
Dim l As Label
l = Sender
rc = l.Tag
SelectRow(rc.Row)
' Activity.Title = "Cell clicked: (" & rc.Row & ", " & rc.Col &")"
For i=0 To list1.Size-1
If i=rc.Row Then
Dim map1 As Map
map1=list1.Get(i)
'ToastMessageShow(map1.Get("id"),False)
End If
Next
End Sub
Sub Header_Click
Dim l As Label
Dim col As Int
l = Sender
col = l.Tag
' Activity.Title = "Header clicked: " & col
End Sub
Sub SelectRow(Row As Int)
'remove the color of previously selected row
If SelectedRow > -1 Then
For col = 0 To NumberOfColumns - 1
GetView(SelectedRow, col).Color = Colors.Transparent
Next
End If
SelectedRow = Row
For col = 0 To NumberOfColumns - 1
GetView(Row, col).Color = SelectedRowColor
Next
End Sub
Sub GetView(Row As Int, Col As Int) As Label
Dim l As Label
l = Table.GetView(Row * NumberOfColumns + Col)
Return l
End Sub
Sub AddRow(Values() As String)
If Values.Length <> NumberOfColumns Then
Log("Wrong number of values.")
Return
End If
Dim lastRow As Int
lastRow = NumberOfRows
For i = 0 To NumberOfColumns - 1
Dim l As Label
l.Initialize("cell")
l.Text = Values(i)
l.Gravity = Alignment
l.TextSize = FontSize
l.TextColor = FontColor
Dim rc As RowCol
rc.Initialize
rc.Col = i
rc.Row = lastRow
l.Tag = rc
Table.AddView(l, ColumnWidth * i, RowHeight * lastRow, ColumnWidth, RowHeight)
Next
Table.Height = NumberOfRows * RowHeight
End Sub
Sub SetHeader(Values() As String)
If Header.IsInitialized Then Return 'should only be called once
Header.Initialize("")
For i = 0 To NumberOfColumns - 1
Dim l As Label
l.Initialize("header")
l.Text = Values(i)
l.Gravity = Gravity.CENTER
l.TextSize = FontSize
l.Color = HeaderColor
l.TextColor = HeaderFontColor
l.Tag = i
Header.AddView(l, ColumnWidth * i, 0, ColumnWidth, RowHeight)
Next
Activity.AddView(Header, SV.Left, SV.Top - RowHeight, SV.Width, RowHeight)
End Sub
Sub NumberOfRows As Int
Return Table.NumberOfViews / NumberOfColumns
End Sub
Sub SetCell(Row As Int, Col As Int, Value As String)
GetView(Row, Col).Text = Value
End Sub
Sub GetCell(Row As Int, Col As Int) As String
Return GetView(Row, Col).Text
End Sub
Sub ClearAll
For i = Table.NumberOfViews -1 To 0 Step -1
Table.RemoveViewAt(i)
Next
Table.Height = 0
SelectedRow = -1
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Private Sub bClose_Click
Activity.Finish
'StartActivity("Main")
End Sub

View File

@@ -0,0 +1,262 @@
B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Activity
Version=11
@EndOfDesignText@
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
End Sub
Sub Globals
Dim jobname As String
Dim SV As ScrollView
Dim BtnClose As Button
Dim Header As Panel
Dim Table As Panel
Dim NumberOfColumns, RowHeight, ColumnWidth As Int
Dim HeaderColor, TableColor, FontColor, HeaderFontColor As Int
Dim FontSize As Float
Dim Alignment As Int
Dim SelectedRow As Int
Dim SelectedRowColor As Int
'Table settings
HeaderColor = Colors.Gray
NumberOfColumns = 2
RowHeight = 30dip
TableColor = Colors.White
FontColor = Colors.Black
HeaderFontColor = Colors.White
FontSize = 11
Alignment = Gravity.CENTER 'change to Gravity.LEFT or Gravity.RIGHT for other alignments.
SelectedRowColor = Colors.Blue
Dim list1 As List
End Sub
Sub Activity_Create(FirstTime As Boolean)
init_view
End Sub
Sub init_view
SV.Initialize(0)
Activity.LoadLayout("LData")
Table = SV.Panel
Table.Color = TableColor
Activity.AddView(SV, 5%x, 10%y, 90%x, 80%y)
Activity.Title="Chargen"
ColumnWidth = SV.Width / NumberOfColumns
SelectedRow = -1
'add header
SetHeader(Array As String("ID", "Patient"))
'add rows
Get_Data
Activity.Title="Daten " & AllgFnkt.PatName
End Sub
Sub Get_Data
Dim job As HttpJob
jobname="GetData"
job.Initialize(jobname, Me)
job.Download(AllgFnkt.sURL&"/DPMService/api/Service_View_Pat/search/"&AllgFnkt.searchstring)
End Sub
Sub JobDone(Job As HttpJob)
ProgressDialogHide
If Job.Success Then
Dim res As String
res = Job.GetString
Dim parser As JSONParser
parser.Initialize(res)
Log("Response from server: " & res)
Select Job.JobName
Case "GetData"
list1 = parser.NextArray
Dim i As Int
For i=0 To list1.Size-1
Dim map1 As Map
map1=list1.Get(i)
Dim s1 As String
Dim s2 As String
s1=map1.Get("id")
s2=map1.Get("pat")
AddRow(Array As String(s1,s2))
Next
If list1.Size<1 Then
ToastMessageShow("Keine Daten vorhanden.",True)
Return
End If
End Select
End If
End Sub
Sub Cell_LongClick
Dim rc As RowCol
Dim l As Label
Dim x As String
x=""
l = Sender
rc = l.Tag
SelectRow(rc.Row)
' Activity.Title = "Cell clicked: (" & rc.Row & ", " & rc.Col &")"
For i=0 To list1.Size-1
If i=rc.Row Then
Dim map1 As Map
map1=list1.Get(i)
x=map1.Get("id")
'ToastMessageShow(map1.Get("id"),False)
End If
Next
AllgFnkt.PID=x
Activity.Finish
End Sub
Sub Cell_Click
Dim rc As RowCol
Dim l As Label
l = Sender
rc = l.Tag
SelectRow(rc.Row)
' Activity.Title = "Cell clicked: (" & rc.Row & ", " & rc.Col &")"
For i=0 To list1.Size-1
If i=rc.Row Then
Dim map1 As Map
map1=list1.Get(i)
'ToastMessageShow(map1.Get("id"),False)
End If
Next
End Sub
Sub Header_Click
Dim l As Label
Dim col As Int
l = Sender
col = l.Tag
' Activity.Title = "Header clicked: " & col
End Sub
Sub SelectRow(Row As Int)
'remove the color of previously selected row
If SelectedRow > -1 Then
For col = 0 To NumberOfColumns - 1
GetView(SelectedRow, col).Color = Colors.Transparent
Next
End If
SelectedRow = Row
For col = 0 To NumberOfColumns - 1
GetView(Row, col).Color = SelectedRowColor
Next
End Sub
Sub GetView(Row As Int, Col As Int) As Label
Dim l As Label
l = Table.GetView(Row * NumberOfColumns + Col)
Return l
End Sub
Sub AddRow(Values() As String)
If Values.Length <> NumberOfColumns Then
Log("Wrong number of values.")
Return
End If
Dim lastRow As Int
lastRow = NumberOfRows
For i = 0 To NumberOfColumns - 1
Dim l As Label
l.Initialize("cell")
l.Text = Values(i)
l.Gravity = Alignment
If i=1 Then l.Gravity=Bit.Or(Gravity.FILL, Gravity.CENTER_HORIZONTAL)
l.TextSize = FontSize
l.TextColor = FontColor
Dim rc As RowCol
rc.Initialize
rc.Col = i
rc.Row = lastRow
l.Tag = rc
Dim leftpos As Int
Dim colwi As Int
If i=0 Then
leftpos=0
colwi=20%x
End If
If i=1 Then
leftpos=20%x
colwi=80%x
End If
Table.AddView(l, leftpos, RowHeight * lastRow, colwi, RowHeight)
'Table.AddView(l, ColumnWidth * i, RowHeight * lastRow, ColumnWidth, RowHeight)
Next
Table.Height = NumberOfRows * RowHeight
End Sub
Sub SetHeader(Values() As String)
If Header.IsInitialized Then Return 'should only be called once
Header.Initialize("")
For i = 0 To NumberOfColumns - 1
Dim l As Label
l.Initialize("header")
l.Text = Values(i)
l.Gravity = Gravity.CENTER
If i=1 Then l.Gravity=Bit.Or(Gravity.FILL, Gravity.CENTER_HORIZONTAL)
l.TextSize = FontSize
l.Color = HeaderColor
l.TextColor = HeaderFontColor
l.Tag = i
Dim leftpos As Int
Dim colwi As Int
If i=0 Then
leftpos=0
colwi=20%x
End If
If i=1 Then
leftpos=20%x
colwi=80%x
End If
'Header.AddView(l, ColumnWidth , 0, ColumnWidth, RowHeight)
Header.AddView(l, leftpos , 0, colwi, RowHeight)
Next
Activity.AddView(Header, SV.Left, SV.Top - RowHeight, SV.Width, RowHeight)
End Sub
Sub NumberOfRows As Int
Return Table.NumberOfViews / NumberOfColumns
End Sub
Sub SetCell(Row As Int, Col As Int, Value As String)
GetView(Row, Col).Text = Value
End Sub
Sub GetCell(Row As Int, Col As Int) As String
Return GetView(Row, Col).Text
End Sub
Sub ClearAll
For i = Table.NumberOfViews -1 To 0 Step -1
Table.RemoveViewAt(i)
Next
Table.Height = 0
SelectedRow = -1
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Private Sub bClose_Click
Activity.Finish
'StartActivity("Main")
End Sub

View File

@@ -0,0 +1,128 @@
B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Class
Version=11
@EndOfDesignText@
Sub Class_Globals
Dim AActivity As Activity
Dim pnl,mnupnl,pnlfooter As Panel
Dim appimage, menuimage, backimage As ImageView
Dim Title, footer As Label
Dim Titletext As String
Dim menulist As List
Public lvMenu As ListView
Dim BarSize As Int=5%y
End Sub
'Initializes the object. You can add parameters to this method if needed.
public Sub setpanel
pnl.Top=0
pnl.Left=0
pnl.Width=100%x
pnl.Height=BarSize+2
End Sub
Public Sub Initialize
appimage.Initialize("")
menuimage.Initialize("menu")
backimage.Initialize("back")
menuimage.Visible=False
backimage.Visible=False
pnl.Initialize("")
pnl.Top=0
pnl.Left=0
pnl.Width=100%x
pnl.Height=BarSize+2
pnl.Color=Colors.DarkGray
appimage.Bitmap=LoadBitmapResize(File.DirAssets,"icon.png",BarSize,BarSize,True)
Title.Initialize("")
Title.Text=Titletext
Title.TextColor=Colors.White
Title.TextSize=20
menuimage.Bitmap=LoadBitmapResize(File.DirAssets,"menuicon.png",BarSize,BarSize,True)
backimage.Bitmap=LoadBitmapResize(File.DirAssets,"arrowback.png",BarSize,BarSize,True)
Dim pc As ColorDrawable
pc.Initialize2(0xFF077AFF,1,1,0xFF077AFF)
pnl.Background=pc
pnl.AddView(appimage,0,0,BarSize,BarSize)
pnl.AddView(menuimage,100%x-BarSize,1,BarSize,BarSize)
pnl.AddView(backimage,100%x-BarSize,1,BarSize,BarSize)
pnl.AddView(Title,appimage.Width+2%X,appimage.Top+2,60%X,BarSize)
pnlfooter.Initialize("")
footer.Initialize("")
pnlfooter.Height=BarSize/3
pnlfooter.Background=pc
footer.Text=Chr(0x00A9)& "2021 - Stefan Hutter Unternehmensberatung"
footer.Gravity=Gravity.CENTER
footer.Width=100%x
pnlfooter.AddView(footer,1,1,pnlfooter.Width,pnlfooter.Height)
End Sub
public Sub Initialize2
AActivity.AddView(pnl,0,0,pnl.Width,BarSize)
AActivity.AddView(pnlfooter,0,100%y-pnlfooter.Height,100%x,pnlfooter.Height)
End Sub
Public Sub AddMenu
lvMenu.Initialize("lvmenu")
lvMenu.AddSingleLine("Einstellungen")
lvMenu.AddSingleLine("Über...")
lvMenu.SingleLineLayout.Label.Textcolor=Colors.Black
menulist.Initialize()
mnupnl.Initialize("")
mnupnl.Width=60%x
mnupnl.Height=lvMenu.Size*BarSize*2
mnupnl.Color=Colors.LightGray
mnupnl.Top=BarSize+1
mnupnl.Left=100%x-mnupnl.Width
mnupnl.AddView(lvMenu,1,1,mnupnl.Width,mnupnl.Height)$
Dim c As ColorDrawable
c.Initialize2(Colors.White,5dip,3dip,Colors.DarkGray)
mnupnl.Background = c
mnupnl.Visible=False
AActivity.AddView(mnupnl,100%x-mnupnl.Width,BarSize+1,mnupnl.Width,mnupnl.Height)
backimage.Visible=False
menuimage.Visible=True
End Sub
Sub menu_click
If mnupnl.Visible=False Then mnupnl.Visible=True Else mnupnl.Visible=False
End Sub
Private Sub lvmenu_ItemClick (Position As Int, Value As Object)
If Value="Einstellungen" Then StartActivity("Parameter")
If Value="Über..." Then StartActivity("About")
mnupnl.Visible=False
End Sub
Public Sub SetTitle
Title.Text=Titletext
End Sub
Public Sub HideMenu
menuimage.Visible=False
backimage.Visible=True
End Sub
Public Sub Back_Click
AActivity.Finish
End Sub

View File

@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="shub.dpm"
android:versionCode="1"
android:versionName="Initial"
android:installLocation="internalOnly">
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="29"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>
<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-feature android:name="android.hardware.camera.flash" android:required="false" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.hardware.camera"/>
<uses-permission android:name="android.hardware.camera.autofocus"/>
<uses-permission android:name="android.permission.FLASHLIGHT"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<application
android:name="androidx.multidex.MultiDexApplication"
android:icon="@drawable/icon"
android:label="DPM Mobile"
android:networkSecurityConfig="@xml/network_security_config">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.gms.vision.DEPENDENCIES"
android:value="barcode" />
<activity
android:windowSoftInputMode="stateHidden"
android:launchMode="singleTop"
android:name=".main"
android:label="DPM Mobile"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:windowSoftInputMode="stateHidden"
android:launchMode="singleTop"
android:name=".parameter"
android:label="DPM Mobile"
android:screenOrientation="portrait">
</activity>
<activity
android:windowSoftInputMode="stateHidden"
android:launchMode="singleTop"
android:name=".about"
android:label="DPM Mobile"
android:screenOrientation="portrait">
</activity>
<activity
android:windowSoftInputMode="stateHidden"
android:launchMode="singleTop"
android:name=".barcodescanner"
android:label="DPM Mobile"
android:screenOrientation="portrait">
</activity>
<activity
android:windowSoftInputMode="stateHidden"
android:launchMode="singleTop"
android:name=".listdata"
android:label="DPM Mobile"
android:screenOrientation="portrait">
</activity>
<service android:name=".starter">
</service>
<receiver android:name=".starter$starter_BR">
</receiver>
<activity
android:windowSoftInputMode="stateHidden"
android:launchMode="singleTop"
android:name=".listpat"
android:label="DPM Mobile"
android:screenOrientation="portrait">
</activity>
<service android:name=".httputils2service">
</service>
<receiver android:name=".httputils2service$httputils2service_BR">
</receiver>
</application>
</manifest>

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More