Can your CustomDrawn Android app run correctly on devices using Android 5 and above?
Hello Handoko,
thats a good question! I didn't know about that issue. And searching through the forum for that topic doesn't bring up an hint that it is solved or even worked on. I couldn't test as I don't have any Android 5 device by hands.
Have the CustomDrawn Android 5/+ issue been solved?
@all: Does someone know about it?
You can try to make a hello world demo and send the apk file file to this forum. Or you can email the apk file to me, I have an Android 5 phone.
About the screen issue, my module does not use scroll bars but it will scale it down. I will consider scrolling as an option, I started to write the module to solve screen output issue on different computer screen resolutions and aspect ratios.
So far the module now already has these working components:
- TgsRectangle
- TgsLabel
- TgsButton
- TgsEdit
All the visual components are inherited from TgsItem. On the object creation, it will automatically calculate its actual x, y positions:
constructor TgsItem.Create(const Screen: TGraphicsScreen; const X, Y, W, H: integer);
begin
with Screen do
begin
FXint := X;
FXreal := X * FRatioX;
FYint := Y;
FYreal := Y * FRatioY;
FWint := W;
FWreal := W * FRatioX;
FHint := H;
FHreal := H * FRatioY;
end;
FFocusAllowed := False;
FFocusSupported := False;
FGraphicsScreen := Screen;
end;
And to start using the module programmer has to call TGraphicsScreen.Create to initialize the position, size and resolution:
constructor TGraphicsScreen.Create(const Form: TForm;
const X, Y, W, H, ResolutionX, ResolutionY: integer);
begin
// Strict private data
// FBackgroundR, FBackgroundG, FBackgroundB initialized by -> SetBackgroundColor
FCurrentFocus := nil;
FForm := Form;
with FForm do
begin
KeyPreview := True;
FSavedFormKeyDown := OnKeyDown;
FSavedFormKeyPress := OnKeyPress;
OnKeyDown := @EventFormKeyDown;
OnKeyPress := @EventFormKeyPress;
end;
FItems := TFPObjectList.Create(False);
FPainting := False;
FSavedApplicationUserInput := Application.OnUserInput;
FScreenHeight := ResolutionX;
FScreenWidth := ResolutionY;
FTargetTime := Now;
// For items uniformity
FgsBorderThickness := 3;
FgsColorBackground := GetAllowedColor(clForm);
FgsColorBorder := GetAllowedColor(clWindowText);
FgsColorBorderFocus := GetAllowedColor(clHighlight);
FgsColorText := GetAllowedColor(clWindowText);
// Main data
FOutput := TOpenGLControl.Create(Form);
with FOutput do
begin
;
Left := X;
Top := Y;
Width := W;
Height := H;
Anchors := [akBottom] + [akLeft] + [akRight] + [akTop];
AutoResizeViewport := True;
MultiSampling := 4;
Parent := Form;
OnPaint := @EvenOpenGLControlPaint;
OnResize := @EvenOpenGLControl1Resize;
end;
FOutputAspect := W / H;
FRatioX := 2 / ResolutionX;
FRatioY := 2 / ResolutionY;
// Additionals
SetBackgroundColor(FgsColorBackground);
end;
The code was
actually originally written to run on Windows and Linux. But because it uses OpenGL for drawing and I already tried and know some basic of OpenGL ES2 drawing using LAMW, I'm sure with some modifications it can support Android too.