mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 06:20:45 +02:00
Adds the Android example to the lazarus repository
git-svn-id: trunk@33818 -
This commit is contained in:
parent
147eb696f1
commit
fb4a6b3045
13
.gitattributes
vendored
13
.gitattributes
vendored
@ -3348,6 +3348,19 @@ examples/anchordocking/minide/simplefrm.lfm svneol=native#text/plain
|
||||
examples/anchordocking/minide/simplefrm.pas svneol=native#text/plain
|
||||
examples/anchordocking/minide/unit1.lfm svneol=native#text/plain
|
||||
examples/anchordocking/minide/unit1.pas svneol=native#text/plain
|
||||
examples/androidlcl/android/AndroidManifest.xml svneol=native#text/plain
|
||||
examples/androidlcl/android/build.properties svneol=native#text/plain
|
||||
examples/androidlcl/android/build.xml svneol=native#text/plain
|
||||
examples/androidlcl/android/default.properties svneol=native#text/plain
|
||||
examples/androidlcl/android/local.properties svneol=native#text/plain
|
||||
examples/androidlcl/android/res/drawable-ldpi/icon.png -text svneol=unset#image/png
|
||||
examples/androidlcl/android/res/drawable-lhpi/icon.png -text svneol=unset#image/png
|
||||
examples/androidlcl/android/res/drawable-lmpi/icon.png -text svneol=unset#image/png
|
||||
examples/androidlcl/android/res/values/strings.xml svneol=native#text/plain
|
||||
examples/androidlcl/androidlcltest.lpi svneol=native#text/plain
|
||||
examples/androidlcl/androidlcltest.lpr svneol=native#text/pascal
|
||||
examples/androidlcl/mainform.lfm svneol=native#text/plain
|
||||
examples/androidlcl/mainform.pas svneol=native#text/pascal
|
||||
examples/autosize/childsizinglayout/childsizinglayout.lpi svneol=native#text/plain
|
||||
examples/autosize/childsizinglayout/childsizinglayout.lpr svneol=native#text/plain
|
||||
examples/autosize/childsizinglayout/mainunit.lfm svneol=native#text/plain
|
||||
|
22
examples/androidlcl/android/AndroidManifest.xml
Normal file
22
examples/androidlcl/android/AndroidManifest.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.pascal.lcltest"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true" />
|
||||
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" />
|
||||
<application android:label="@string/app_name"
|
||||
android:icon="@drawable/icon"
|
||||
android:debuggable="True">
|
||||
<activity android:name="LCLActivity"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
17
examples/androidlcl/android/build.properties
Normal file
17
examples/androidlcl/android/build.properties
Normal file
@ -0,0 +1,17 @@
|
||||
# This file is used to override default values used by the Ant build system.
|
||||
#
|
||||
# This file must be checked in Version Control Systems, as it is
|
||||
# integral to the build system of your project.
|
||||
|
||||
# This file is only used by the Ant script.
|
||||
|
||||
# You can use this to override default values such as
|
||||
# 'source.dir' for the location of your java source folder and
|
||||
# 'out.dir' for the location of your output folder.
|
||||
|
||||
# You can also use it define how the release builds are signed by declaring
|
||||
# the following properties:
|
||||
# 'key.store' for the location of your keystore and
|
||||
# 'key.alias' for the name of the key to use.
|
||||
# The password will be asked during the build when you use the 'release' target.
|
||||
|
85
examples/androidlcl/android/build.xml
Normal file
85
examples/androidlcl/android/build.xml
Normal file
@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="LCLExample" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<loadproperties srcFile="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="default.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
|
||||
<!-- extension targets. Uncomment the ones where you want to do custom work
|
||||
in between standard targets -->
|
||||
<!--
|
||||
<target name="-pre-build">
|
||||
</target>
|
||||
<target name="-pre-compile">
|
||||
</target>
|
||||
|
||||
/* This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir} */
|
||||
<target name="-post-compile">
|
||||
</target>
|
||||
-->
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
11
examples/androidlcl/android/default.properties
Normal file
11
examples/androidlcl/android/default.properties
Normal file
@ -0,0 +1,11 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system use,
|
||||
# "build.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-8
|
10
examples/androidlcl/android/local.properties
Normal file
10
examples/androidlcl/android/local.properties
Normal file
@ -0,0 +1,10 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must *NOT* be checked in Version Control Systems,
|
||||
# as it contains information specific to your local configuration.
|
||||
|
||||
# location of the SDK. This is only used by Ant
|
||||
# For customization when using a Version Control System, please read the
|
||||
# header note.
|
||||
sdk.dir=/home/felipe/Programas/android-sdk-linux
|
BIN
examples/androidlcl/android/res/drawable-ldpi/icon.png
Normal file
BIN
examples/androidlcl/android/res/drawable-ldpi/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
BIN
examples/androidlcl/android/res/drawable-lhpi/icon.png
Normal file
BIN
examples/androidlcl/android/res/drawable-lhpi/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
BIN
examples/androidlcl/android/res/drawable-lmpi/icon.png
Normal file
BIN
examples/androidlcl/android/res/drawable-lmpi/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
4
examples/androidlcl/android/res/values/strings.xml
Normal file
4
examples/androidlcl/android/res/values/strings.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">LCL Test</string>
|
||||
</resources>
|
103
examples/androidlcl/androidlcltest.lpi
Normal file
103
examples/androidlcl/androidlcltest.lpi
Normal file
@ -0,0 +1,103 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="androidlcltest"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<MacroValues Count="1">
|
||||
<Macro1 Name="LCLWidgetType" Value="customdrawn"/>
|
||||
</MacroValues>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="1">
|
||||
<Item1>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item1>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="androidlcltest.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="androidlcltest"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="mainform.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="mainform"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<Target>
|
||||
<Filename Value="android/libs/armeabi/liblclapp.so"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<Libraries Value="/home/felipe/Programas/android-ndk-r5/platforms/android-8/arch-arm/usr/lib/;/home/felipe/Programas/android-ndk-r5/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/lib/gcc/arm-eabi/4.4.0/"/>
|
||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<RelocatableUnit Value="True"/>
|
||||
<TargetCPU Value="arm"/>
|
||||
<TargetOS Value="linux"/>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf2"/>
|
||||
<StripSymbols Value="True"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<ExecutableType Value="Library"/>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerMessages>
|
||||
<UseMsgFile Value="True"/>
|
||||
</CompilerMessages>
|
||||
<CustomOptions Value="-dANDROID -Xd -Cccdecl"/>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
36
examples/androidlcl/androidlcltest.lpr
Normal file
36
examples/androidlcl/androidlcltest.lpr
Normal file
@ -0,0 +1,36 @@
|
||||
library androidlcltest;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
{$define Android}
|
||||
|
||||
uses
|
||||
{$ifdef Android}
|
||||
cmem,
|
||||
{$ifdef CD_Android_NativeApp}
|
||||
android_native_app_glue,
|
||||
{$else}
|
||||
customdrawnint,
|
||||
{$endif}
|
||||
{$endif}
|
||||
Interfaces,
|
||||
Forms,
|
||||
mainform;
|
||||
|
||||
{$ifdef CD_Android_NativeApp}
|
||||
exports //android_main name 'android_main',
|
||||
ANativeActivity_onCreate name 'ANativeActivity_onCreate';
|
||||
{$else}
|
||||
exports
|
||||
Java_com_pascal_lclproject_LCLActivity_stringFromJNI name 'Java_com_pascal_lcltest_LCLActivity_stringFromJNI',
|
||||
Java_com_pascal_lclproject_LCLActivity_intFromJNI name 'Java_com_pascal_lcltest_LCLActivity_intFromJNI',
|
||||
Java_com_pascal_lclproject_LCLActivity_LCLDrawToBitmap name 'Java_com_pascal_lcltest_LCLActivity_LCLDrawToBitmap',
|
||||
JNI_OnLoad name 'JNI_OnLoad',
|
||||
JNI_OnUnload name 'JNI_OnUnload';
|
||||
{$endif}
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
9
examples/androidlcl/mainform.lfm
Normal file
9
examples/androidlcl/mainform.lfm
Normal file
@ -0,0 +1,9 @@
|
||||
object Form1: TForm1
|
||||
Left = 313
|
||||
Height = 240
|
||||
Top = 186
|
||||
Width = 320
|
||||
Caption = 'Form1'
|
||||
OnPaint = FormPaint
|
||||
LCLVersion = '0.9.31'
|
||||
end
|
40
examples/androidlcl/mainform.pas
Normal file
40
examples/androidlcl/mainform.pas
Normal file
@ -0,0 +1,40 @@
|
||||
unit mainform;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
procedure FormPaint(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.FormPaint(Sender: TObject);
|
||||
begin
|
||||
Canvas.Brush.Color := clWhite;
|
||||
Canvas.Rectangle(10, 10, 100, 100);
|
||||
Canvas.Brush.Color := clRed;
|
||||
Canvas.Rectangle(100, 100, 100, 100);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user