mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-19 22:49:48 +01:00
Android: Fixes screen sizing and attempts to improve timer destruction
git-svn-id: trunk@34281 -
This commit is contained in:
parent
001954f566
commit
454c19a3d7
@ -34,13 +34,16 @@ public class LCLActivity extends Activity
|
||||
//Log.i("lclapp", "onDraw started");
|
||||
int lWidth = getWidth();
|
||||
int lHeight = getHeight();
|
||||
|
||||
// Check if we rotated in the draw event, OnConfigurationChanged can't return the new form width =(
|
||||
// see http://stackoverflow.com/questions/2524683/how-to-get-new-width-height-of-root-layout-in-onconfigurationchanged
|
||||
if (lWidth != lclformwidth) LCLOnConfigurationChanged(lclxdpi, lWidth); // we send xdpi because thats what the LCL uses for Screen.PixelsPerInch
|
||||
int oldlclformwidth = lclformwidth;
|
||||
|
||||
lclformwidth = lWidth;
|
||||
lclformheight = lHeight;
|
||||
lclscreenwidth = lclformwidth;
|
||||
lclscreenheight = lclformheight;
|
||||
|
||||
// Check if we rotated in the draw event, OnConfigurationChanged can't return the new form width =(
|
||||
// see http://stackoverflow.com/questions/2524683/how-to-get-new-width-height-of-root-layout-in-onconfigurationchanged
|
||||
if (lWidth != oldlclformwidth) LCLOnConfigurationChanged(lclxdpi, lWidth); // we send xdpi because thats what the LCL uses for Screen.PixelsPerInch
|
||||
|
||||
//Log.v("lclproject", "LCLSurface.onDraw width=" + Integer.toString(lWidth)
|
||||
// + " height=" + Integer.toString(lHeight));
|
||||
@ -251,19 +254,23 @@ public class LCLActivity extends Activity
|
||||
|
||||
private Handler LocalHandler = new Handler();
|
||||
|
||||
private class LCLRunnable implements Runnable
|
||||
{
|
||||
public boolean Destroyed = false;
|
||||
|
||||
public void run()
|
||||
{
|
||||
int eventResult = LCLOnTimer(this);
|
||||
if (((eventResult | 1) != 0) && (lclsurface != null)) lclsurface.postInvalidate();
|
||||
if (this.Destroyed == false) LocalHandler.postDelayed(this, lcltimerinterval);
|
||||
}
|
||||
};
|
||||
|
||||
// input: int lcltimerinterval in milliseconds
|
||||
// output: Runnable lcltimerid
|
||||
public void LCLDoCreateTimer()
|
||||
{
|
||||
lcltimerid = new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
int eventResult = LCLOnTimer(this);
|
||||
if (((eventResult | 1) != 0) && (lclsurface != null)) lclsurface.postInvalidate();
|
||||
LocalHandler.postDelayed(this, lcltimerinterval);
|
||||
}
|
||||
};
|
||||
lcltimerid = new LCLRunnable();
|
||||
|
||||
LocalHandler.removeCallbacks(lcltimerid);
|
||||
LocalHandler.postDelayed(lcltimerid, lcltimerinterval);
|
||||
@ -273,6 +280,7 @@ public class LCLActivity extends Activity
|
||||
public void LCLDoDestroyTimer()
|
||||
{
|
||||
LocalHandler.removeCallbacks(lcltimerid);
|
||||
((LCLRunnable) lcltimerid).Destroyed = true;
|
||||
};
|
||||
|
||||
public void LCLDoHideVirtualKeyboard()
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
object Form1: TForm1
|
||||
Left = 313
|
||||
Left = 326
|
||||
Height = 251
|
||||
Top = 186
|
||||
Top = 166
|
||||
Width = 220
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 251
|
||||
|
||||
@ -807,6 +807,7 @@ function TCDWidgetSet.DestroyTimer(TimerHandle: THandle) : boolean;
|
||||
var
|
||||
lTimer: TCDTimer;
|
||||
begin
|
||||
DebugLn('[TCDWidgetSet.DestroyTimer]');
|
||||
Result := False;
|
||||
|
||||
lTimer := TCDTimer(TimerHandle);
|
||||
|
||||
@ -91,6 +91,7 @@ begin
|
||||
lForm.LCLForm.AutoAdjustLayout(lapAutoAdjustWithoutHorizontalScrolling,
|
||||
lForm.LCLForm.DesignTimeDPI,
|
||||
Screen.PixelsPerInch, lForm.LCLForm.Width, Screen.Width);
|
||||
LCLIntf.InvalidateRect(HWND(lForm), nil, False);
|
||||
// if necessary adjust the form coordinates
|
||||
if not (lForm.LCLForm.BorderStyle in [bsDialog, bsNone]) then
|
||||
begin
|
||||
|
||||
Loading…
Reference in New Issue
Block a user