You've already forked lazarus-ccr
Adds support for String and interfaces
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1811 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -39,7 +39,7 @@
|
|||||||
<PackageName Value="LCL"/>
|
<PackageName Value="LCL"/>
|
||||||
</Item2>
|
</Item2>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="23">
|
<Units Count="26">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="android_bindings_generator.pas"/>
|
<Filename Value="android_bindings_generator.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
@ -48,7 +48,7 @@
|
|||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<CursorPos X="15" Y="14"/>
|
<CursorPos X="15" Y="14"/>
|
||||||
<UsageCount Value="35"/>
|
<UsageCount Value="38"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit0>
|
</Unit0>
|
||||||
<Unit1>
|
<Unit1>
|
||||||
@ -60,8 +60,8 @@
|
|||||||
<EditorIndex Value="0"/>
|
<EditorIndex Value="0"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="6"/>
|
<TopLine Value="6"/>
|
||||||
<CursorPos X="1" Y="51"/>
|
<CursorPos X="80" Y="15"/>
|
||||||
<UsageCount Value="35"/>
|
<UsageCount Value="38"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
<LoadedDesigner Value="True"/>
|
<LoadedDesigner Value="True"/>
|
||||||
</Unit1>
|
</Unit1>
|
||||||
@ -117,12 +117,11 @@
|
|||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="android_sdk_bindings_gen"/>
|
<UnitName Value="android_sdk_bindings_gen"/>
|
||||||
<IsVisibleTab Value="True"/>
|
|
||||||
<EditorIndex Value="3"/>
|
<EditorIndex Value="3"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="563"/>
|
<TopLine Value="162"/>
|
||||||
<CursorPos X="16" Y="600"/>
|
<CursorPos X="32" Y="176"/>
|
||||||
<UsageCount Value="35"/>
|
<UsageCount Value="38"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit8>
|
</Unit8>
|
||||||
<Unit9>
|
<Unit9>
|
||||||
@ -201,9 +200,9 @@
|
|||||||
<Filename Value="sdk_level_7/android_all.txt"/>
|
<Filename Value="sdk_level_7/android_all.txt"/>
|
||||||
<EditorIndex Value="4"/>
|
<EditorIndex Value="4"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="27"/>
|
<TopLine Value="99"/>
|
||||||
<CursorPos X="1" Y="38"/>
|
<CursorPos X="25" Y="145"/>
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="12"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
<DefaultSyntaxHighlighter Value="None"/>
|
<DefaultSyntaxHighlighter Value="None"/>
|
||||||
</Unit18>
|
</Unit18>
|
||||||
@ -230,7 +229,7 @@
|
|||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<CursorPos X="26" Y="9"/>
|
<CursorPos X="26" Y="9"/>
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="12"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit21>
|
</Unit21>
|
||||||
<Unit22>
|
<Unit22>
|
||||||
@ -241,124 +240,157 @@
|
|||||||
<UsageCount Value="10"/>
|
<UsageCount Value="10"/>
|
||||||
<DefaultSyntaxHighlighter Value="Java"/>
|
<DefaultSyntaxHighlighter Value="Java"/>
|
||||||
</Unit22>
|
</Unit22>
|
||||||
|
<Unit23>
|
||||||
|
<Filename Value="../../../lazarus/lcl/interfaces/android/android_all.pas"/>
|
||||||
|
<UnitName Value="android_all"/>
|
||||||
|
<IsVisibleTab Value="True"/>
|
||||||
|
<EditorIndex Value="5"/>
|
||||||
|
<WindowIndex Value="0"/>
|
||||||
|
<TopLine Value="654"/>
|
||||||
|
<CursorPos X="1" Y="682"/>
|
||||||
|
<UsageCount Value="12"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit23>
|
||||||
|
<Unit24>
|
||||||
|
<Filename Value="../../../lazarus/lcl/interfaces/android/androidpipescomm.pas"/>
|
||||||
|
<UnitName Value="androidpipescomm"/>
|
||||||
|
<EditorIndex Value="6"/>
|
||||||
|
<WindowIndex Value="0"/>
|
||||||
|
<TopLine Value="222"/>
|
||||||
|
<CursorPos X="10" Y="139"/>
|
||||||
|
<UsageCount Value="12"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit24>
|
||||||
|
<Unit25>
|
||||||
|
<Filename Value="../../../lazarus/lcl/interfaces/android/androidapp.pas"/>
|
||||||
|
<UnitName Value="androidapp"/>
|
||||||
|
<WindowIndex Value="0"/>
|
||||||
|
<TopLine Value="74"/>
|
||||||
|
<CursorPos X="1" Y="1"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
</Unit25>
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="29" HistoryIndex="28">
|
<JumpHistory Count="30" HistoryIndex="29">
|
||||||
<Position1>
|
<Position1>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="22" Column="29" TopLine="1"/>
|
<Caret Line="1" Column="1" TopLine="1"/>
|
||||||
</Position1>
|
</Position1>
|
||||||
<Position2>
|
<Position2>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="23" Column="15" TopLine="1"/>
|
<Caret Line="777" Column="49" TopLine="737"/>
|
||||||
</Position2>
|
</Position2>
|
||||||
<Position3>
|
<Position3>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="106" Column="72" TopLine="106"/>
|
<Caret Line="826" Column="47" TopLine="786"/>
|
||||||
</Position3>
|
</Position3>
|
||||||
<Position4>
|
<Position4>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="212" Column="35" TopLine="184"/>
|
<Caret Line="835" Column="67" TopLine="795"/>
|
||||||
</Position4>
|
</Position4>
|
||||||
<Position5>
|
<Position5>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="375" Column="65" TopLine="351"/>
|
<Caret Line="2" Column="5" TopLine="1"/>
|
||||||
</Position5>
|
</Position5>
|
||||||
<Position6>
|
<Position6>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="374" Column="50" TopLine="351"/>
|
<Caret Line="57" Column="25" TopLine="17"/>
|
||||||
</Position6>
|
</Position6>
|
||||||
<Position7>
|
<Position7>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="36" Column="19" TopLine="3"/>
|
<Caret Line="1" Column="1" TopLine="1"/>
|
||||||
</Position7>
|
</Position7>
|
||||||
<Position8>
|
<Position8>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="689" Column="24" TopLine="664"/>
|
<Caret Line="40" Column="36" TopLine="8"/>
|
||||||
</Position8>
|
</Position8>
|
||||||
<Position9>
|
<Position9>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="375" Column="1" TopLine="352"/>
|
<Caret Line="836" Column="33" TopLine="835"/>
|
||||||
</Position9>
|
</Position9>
|
||||||
<Position10>
|
<Position10>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="40" Column="18" TopLine="3"/>
|
<Caret Line="40" Column="48" TopLine="40"/>
|
||||||
</Position10>
|
</Position10>
|
||||||
<Position11>
|
<Position11>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="713" Column="13" TopLine="689"/>
|
<Caret Line="41" Column="58" TopLine="3"/>
|
||||||
</Position11>
|
</Position11>
|
||||||
<Position12>
|
<Position12>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="41" Column="53" TopLine="3"/>
|
<Caret Line="321" Column="29" TopLine="304"/>
|
||||||
</Position12>
|
</Position12>
|
||||||
<Position13>
|
<Position13>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="sdk_level_7/android_all.txt"/>
|
||||||
<Caret Line="677" Column="1" TopLine="673"/>
|
<Caret Line="76" Column="28" TopLine="41"/>
|
||||||
</Position13>
|
</Position13>
|
||||||
<Position14>
|
<Position14>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="153" Column="40" TopLine="134"/>
|
<Caret Line="582" Column="99" TopLine="507"/>
|
||||||
</Position14>
|
</Position14>
|
||||||
<Position15>
|
<Position15>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="171" Column="31" TopLine="134"/>
|
<Caret Line="524" Column="1" TopLine="507"/>
|
||||||
</Position15>
|
</Position15>
|
||||||
<Position16>
|
<Position16>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="385" Column="1" TopLine="370"/>
|
<Caret Line="525" Column="1" TopLine="507"/>
|
||||||
</Position16>
|
</Position16>
|
||||||
<Position17>
|
<Position17>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="325" Column="22" TopLine="309"/>
|
<Caret Line="528" Column="1" TopLine="507"/>
|
||||||
</Position17>
|
</Position17>
|
||||||
<Position18>
|
<Position18>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="727" Column="32" TopLine="722"/>
|
<Caret Line="529" Column="1" TopLine="507"/>
|
||||||
</Position18>
|
</Position18>
|
||||||
<Position19>
|
<Position19>
|
||||||
<Filename Value="mainform.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="38" Column="34" TopLine="1"/>
|
<Caret Line="532" Column="1" TopLine="507"/>
|
||||||
</Position19>
|
</Position19>
|
||||||
<Position20>
|
<Position20>
|
||||||
<Filename Value="mainform.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="40" Column="32" TopLine="2"/>
|
<Caret Line="535" Column="1" TopLine="507"/>
|
||||||
</Position20>
|
</Position20>
|
||||||
<Position21>
|
<Position21>
|
||||||
<Filename Value="mainform.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="48" Column="62" TopLine="2"/>
|
<Caret Line="539" Column="1" TopLine="507"/>
|
||||||
</Position21>
|
</Position21>
|
||||||
<Position22>
|
<Position22>
|
||||||
<Filename Value="mainform.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="49" Column="15" TopLine="5"/>
|
<Caret Line="541" Column="1" TopLine="507"/>
|
||||||
</Position22>
|
</Position22>
|
||||||
<Position23>
|
<Position23>
|
||||||
<Filename Value="sdk_level_7/android_all.txt"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="63" Column="42" TopLine="51"/>
|
<Caret Line="542" Column="36" TopLine="526"/>
|
||||||
</Position23>
|
</Position23>
|
||||||
<Position24>
|
<Position24>
|
||||||
<Filename Value="../../../lazarus/lcl/interfaces/lcl.pas"/>
|
<Filename Value="sdk_level_7/android_all.txt"/>
|
||||||
<Caret Line="1" Column="1" TopLine="1"/>
|
<Caret Line="145" Column="23" TopLine="99"/>
|
||||||
</Position24>
|
</Position24>
|
||||||
<Position25>
|
<Position25>
|
||||||
<Filename Value="../../../lazarus/lcl/interfaces/lcl.pas"/>
|
<Filename Value="sdk_level_7/android_all.txt"/>
|
||||||
<Caret Line="10" Column="1" TopLine="1"/>
|
<Caret Line="1" Column="1" TopLine="1"/>
|
||||||
</Position25>
|
</Position25>
|
||||||
<Position26>
|
<Position26>
|
||||||
<Filename Value="../../../lazarus/lcl/interfaces/lcl.pas"/>
|
<Filename Value="sdk_level_7/android_all.txt"/>
|
||||||
<Caret Line="20" Column="81" TopLine="1"/>
|
<Caret Line="143" Column="21" TopLine="99"/>
|
||||||
</Position26>
|
</Position26>
|
||||||
<Position27>
|
<Position27>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="sdk_level_7/android_all.txt"/>
|
||||||
<Caret Line="789" Column="1" TopLine="760"/>
|
<Caret Line="145" Column="23" TopLine="99"/>
|
||||||
</Position27>
|
</Position27>
|
||||||
<Position28>
|
<Position28>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
<Caret Line="623" Column="3" TopLine="593"/>
|
<Caret Line="42" Column="20" TopLine="3"/>
|
||||||
</Position28>
|
</Position28>
|
||||||
<Position29>
|
<Position29>
|
||||||
<Filename Value="android_sdk_bindings_gen.pas"/>
|
<Filename Value="../../../lazarus/lcl/interfaces/android/android_all.pas"/>
|
||||||
<Caret Line="667" Column="1" TopLine="644"/>
|
<Caret Line="666" Column="17" TopLine="653"/>
|
||||||
</Position29>
|
</Position29>
|
||||||
|
<Position30>
|
||||||
|
<Filename Value="android_sdk_bindings_gen.pas"/>
|
||||||
|
<Caret Line="864" Column="22" TopLine="858"/>
|
||||||
|
</Position30>
|
||||||
</JumpHistory>
|
</JumpHistory>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
@ -23,7 +23,7 @@ type
|
|||||||
procedure GenerateJavaFile(ASourceFile: string; ADest: TStringList);
|
procedure GenerateJavaFile(ASourceFile: string; ADest: TStringList);
|
||||||
procedure ProcessModelFile(ASourceFile, APasOutputFile, AJavaOutputFile: string);
|
procedure ProcessModelFile(ASourceFile, APasOutputFile, AJavaOutputFile: string);
|
||||||
procedure ProcessModelLine(ASourceLine: string);
|
procedure ProcessModelLine(ASourceLine: string);
|
||||||
procedure ProcessModelClass(ASourceLine: string);
|
procedure ProcessModelClass(ASourceLine: string; AIsInterface: Boolean);
|
||||||
procedure ProcessModelMethod(ASourceLine: string; AIsField: Boolean);
|
procedure ProcessModelMethod(ASourceLine: string; AIsField: Boolean);
|
||||||
procedure ProcessModelConstructor(ASourceLine: string);
|
procedure ProcessModelConstructor(ASourceLine: string);
|
||||||
procedure ProcessModelConst(ASourceLine: string);
|
procedure ProcessModelConst(ASourceLine: string);
|
||||||
@ -37,7 +37,9 @@ type
|
|||||||
function GetJavaTypeConverter(AType: string): string;
|
function GetJavaTypeConverter(AType: string): string;
|
||||||
function GetIDString(AMethodName: string): string;
|
function GetIDString(AMethodName: string): string;
|
||||||
procedure AddOutputIDs(AIDString: string);
|
procedure AddOutputIDs(AIDString: string);
|
||||||
|
function ConvertJavaSpecialCharsToUnderline(AStr: string): string;
|
||||||
function ConvertPointToUnderline(AStr: string): string;
|
function ConvertPointToUnderline(AStr: string): string;
|
||||||
|
function JavaRemoveGeneric(AStr: string): string;
|
||||||
function IsBasicJavaType(AStr: string): Boolean;
|
function IsBasicJavaType(AStr: string): Boolean;
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
@ -164,10 +166,14 @@ begin
|
|||||||
ADest.Add(' DisplayMetrics param_self_DisplayMetrics;');
|
ADest.Add(' DisplayMetrics param_self_DisplayMetrics;');
|
||||||
ADest.Add(' CompoundButton param_self_CompoundButton;');
|
ADest.Add(' CompoundButton param_self_CompoundButton;');
|
||||||
ADest.Add(' WindowManager param_self_WindowManager;');
|
ADest.Add(' WindowManager param_self_WindowManager;');
|
||||||
|
ADest.Add(' AbsSpinner param_self_AbsSpinner;');
|
||||||
|
ADest.Add(' ArrayAdapter<String> param_self_ArrayAdapter_String_;');
|
||||||
ADest.Add(' // Params');
|
ADest.Add(' // Params');
|
||||||
ADest.Add(' ViewGroup.LayoutParams lViewGroup_LayoutParams_1, lViewGroup_LayoutParams_2;');
|
ADest.Add(' ViewGroup.LayoutParams lViewGroup_LayoutParams_1, lViewGroup_LayoutParams_2;');
|
||||||
|
ADest.Add(' SpinnerAdapter lSpinnerAdapter_1;');
|
||||||
ADest.Add(' DisplayMetrics lDisplayMetrics_1;');
|
ADest.Add(' DisplayMetrics lDisplayMetrics_1;');
|
||||||
ADest.Add(' CharSequence lCharSequence_1;');
|
ADest.Add(' CharSequence lCharSequence_1;');
|
||||||
|
ADest.Add(' String lString_1;');
|
||||||
ADest.Add(' View lView_1;');
|
ADest.Add(' View lView_1;');
|
||||||
ADest.Add(' int lint_1, lint_2, lint_3, lint_4;');
|
ADest.Add(' int lint_1, lint_2, lint_3, lint_4;');
|
||||||
ADest.Add(' float lfloat_1, lfloat_2;');
|
ADest.Add(' float lfloat_1, lfloat_2;');
|
||||||
@ -240,7 +246,14 @@ begin
|
|||||||
// Starting a new class
|
// Starting a new class
|
||||||
if ASourceLine[1] = '[' then
|
if ASourceLine[1] = '[' then
|
||||||
begin
|
begin
|
||||||
ProcessModelClass(ASourceLine);
|
ProcessModelClass(ASourceLine, False);
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// Starting a new interface
|
||||||
|
if ASourceLine[1] = '{' then
|
||||||
|
begin
|
||||||
|
ProcessModelClass(ASourceLine, True);
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -279,10 +292,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TAndroidSDKBindingsGen.ProcessModelClass(ASourceLine: string);
|
procedure TAndroidSDKBindingsGen.ProcessModelClass(ASourceLine: string; AIsInterface: Boolean);
|
||||||
var
|
var
|
||||||
lReaderPos: Integer = 1;
|
lReaderPos: Integer = 1;
|
||||||
lCurWord, lParentClassName: string;
|
lCurWord, lParentClassName, lTmpParent: string;
|
||||||
begin
|
begin
|
||||||
if ASourceLine = '' then Exit;
|
if ASourceLine = '' then Exit;
|
||||||
|
|
||||||
@ -296,10 +309,31 @@ begin
|
|||||||
|
|
||||||
FClassNamePas := GetPascalTypeName(lCurWord);
|
FClassNamePas := GetPascalTypeName(lCurWord);
|
||||||
FClassName := lCurWord;
|
FClassName := lCurWord;
|
||||||
lParentClassName := GetNextWord(ASourceLine, lReaderPos);
|
lTmpParent := GetNextWord(ASourceLine, lReaderPos);
|
||||||
lParentClassName := GetPascalTypeName(lParentClassName);
|
lParentClassName := GetPascalTypeName(lTmpParent);
|
||||||
FPasOutputClasses.Add(Format(' %s = class(%s)', [FClassNamePas, lParentClassName]));
|
|
||||||
FPasOutputClasses.Add(' public');
|
// Read all parents
|
||||||
|
while lTmpParent <> '' do
|
||||||
|
begin
|
||||||
|
lTmpParent := GetNextWord(ASourceLine, lReaderPos);
|
||||||
|
if lTmpParent <> '' then
|
||||||
|
lParentClassName := lParentClassName + ', ' + GetPascalTypeName(lTmpParent);
|
||||||
|
end;
|
||||||
|
|
||||||
|
// Java classes can implement interfaces, so based on a safe ground
|
||||||
|
if lParentClassName = '' then
|
||||||
|
if AIsInterface then
|
||||||
|
lParentClassName := 'IJavaInterface'
|
||||||
|
else
|
||||||
|
lParentClassName := 'TInterfacedObject';
|
||||||
|
|
||||||
|
if AIsInterface then
|
||||||
|
FPasOutputClasses.Add(Format(' %s = interface(%s)', [FClassNamePas, lParentClassName]))
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
FPasOutputClasses.Add(Format(' %s = class(%s)', [FClassNamePas, lParentClassName]));
|
||||||
|
FPasOutputClasses.Add(' public');
|
||||||
|
end;
|
||||||
lCurWord := GetNextWord(ASourceLine, lReaderPos);
|
lCurWord := GetNextWord(ASourceLine, lReaderPos);
|
||||||
Inc(FClassNum);
|
Inc(FClassNum);
|
||||||
FMethodNum := 0;
|
FMethodNum := 0;
|
||||||
@ -307,7 +341,10 @@ begin
|
|||||||
FPasOutputIDs.Add(' // ' + FClassNamePas);
|
FPasOutputIDs.Add(' // ' + FClassNamePas);
|
||||||
FJavaOutputIDs.Add(' // ' + FClassName);
|
FJavaOutputIDs.Add(' // ' + FClassName);
|
||||||
FPasOutputConsts.Add(' { ' + FClassNamePas + ' }');
|
FPasOutputConsts.Add(' { ' + FClassNamePas + ' }');
|
||||||
FPasOutputClassesForward.Add(' ' + FClassNamePas + ' = class;')
|
if AIsInterface then
|
||||||
|
FPasOutputClassesForward.Add(' ' + FClassNamePas + ' = interface;')
|
||||||
|
else
|
||||||
|
FPasOutputClassesForward.Add(' ' + FClassNamePas + ' = class;')
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TAndroidSDKBindingsGen.ProcessModelMethod(
|
procedure TAndroidSDKBindingsGen.ProcessModelMethod(
|
||||||
@ -346,7 +383,7 @@ begin
|
|||||||
FPasOutputImpl.Add(' vAndroidPipesComm.SendInt(' + lIDString + ');');
|
FPasOutputImpl.Add(' vAndroidPipesComm.SendInt(' + lIDString + ');');
|
||||||
FPasOutputImpl.Add(' vAndroidPipesComm.SendInt(Index); // Self, Java Pointer');
|
FPasOutputImpl.Add(' vAndroidPipesComm.SendInt(Index); // Self, Java Pointer');
|
||||||
|
|
||||||
lJavaParamSelf := 'param_self_' + FClassName;
|
lJavaParamSelf := 'param_self_' + JavaRemoveGeneric(FClassName);
|
||||||
FJavaOutputMethods.Add(' // ' + ASourceLine);
|
FJavaOutputMethods.Add(' // ' + ASourceLine);
|
||||||
FJavaOutputMethods.Add(' case ' + lIDString + ':');
|
FJavaOutputMethods.Add(' case ' + lIDString + ':');
|
||||||
FJavaOutputMethods.Add(' DebugOut("' + lIDString + '");');
|
FJavaOutputMethods.Add(' DebugOut("' + lIDString + '");');
|
||||||
@ -505,6 +542,7 @@ begin
|
|||||||
if (lParamType = 'Activity') then
|
if (lParamType = 'Activity') then
|
||||||
begin
|
begin
|
||||||
HasActivityParam := True;
|
HasActivityParam := True;
|
||||||
|
lParamName := 'ReturnToRepeat';
|
||||||
Continue;
|
Continue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -704,7 +742,7 @@ end;
|
|||||||
function TAndroidSDKBindingsGen.GetNextWord(ALine: string;
|
function TAndroidSDKBindingsGen.GetNextWord(ALine: string;
|
||||||
var AStartPos: Integer): string;
|
var AStartPos: Integer): string;
|
||||||
const
|
const
|
||||||
WordSeparators = [' ','(',')','[',']',',',';',':',#9{TAB}];
|
WordSeparators = [' ','(',')','[',']','{','}',',',';',':',#9{TAB}];
|
||||||
var
|
var
|
||||||
lState: Integer = 0;
|
lState: Integer = 0;
|
||||||
begin
|
begin
|
||||||
@ -744,12 +782,12 @@ begin
|
|||||||
else if ABaseName = 'boolean' then Result := 'Boolean'
|
else if ABaseName = 'boolean' then Result := 'Boolean'
|
||||||
else if ABaseName = 'float' then Result := 'Single'
|
else if ABaseName = 'float' then Result := 'Single'
|
||||||
else if ABaseName = 'void' then Result := ABaseName
|
else if ABaseName = 'void' then Result := ABaseName
|
||||||
else if ABaseName = 'CharSequence' then Result := 'string'
|
else if (ABaseName = 'CharSequence') or (ABaseName = 'String') then Result := 'string'
|
||||||
else if ABaseName = 'TJavaObject' then Result := ABaseName
|
else if ABaseName = 'TJavaObject' then Result := ABaseName
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
Result := 'T' + ABaseName;
|
Result := 'T' + ABaseName;
|
||||||
Result := StringReplace(Result, '.', '_', [rfReplaceAll]);
|
Result := ConvertJavaSpecialCharsToUnderline(Result);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -790,7 +828,7 @@ begin
|
|||||||
if AType = 'boolean' then Exit('lBool')
|
if AType = 'boolean' then Exit('lBool')
|
||||||
else if AType = 'int' then Exit('lInt')
|
else if AType = 'int' then Exit('lInt')
|
||||||
else if AType = 'float' then Exit('lFloat')
|
else if AType = 'float' then Exit('lFloat')
|
||||||
else if AType = 'CharSequence' then
|
else if (AType = 'CharSequence') or (AType = 'String') then
|
||||||
Result := Format('(%s) MyJavaLang.LangElements.get(lInt)', [AType])
|
Result := Format('(%s) MyJavaLang.LangElements.get(lInt)', [AType])
|
||||||
else Result := Format('(%s) ViewElements.get(lInt)', [AType]);
|
else Result := Format('(%s) ViewElements.get(lInt)', [AType]);
|
||||||
end;
|
end;
|
||||||
@ -798,7 +836,7 @@ end;
|
|||||||
function TAndroidSDKBindingsGen.GetIDString(AMethodName: string): string;
|
function TAndroidSDKBindingsGen.GetIDString(AMethodName: string): string;
|
||||||
begin
|
begin
|
||||||
Result := 'amkUI_' + FClassNamePas + '_' + AMethodName;;
|
Result := 'amkUI_' + FClassNamePas + '_' + AMethodName;;
|
||||||
Result := StringReplace(Result, '.', '_', [rfReplaceAll]);
|
Result := ConvertJavaSpecialCharsToUnderline(Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TAndroidSDKBindingsGen.AddOutputIDs(AIDString: string);
|
procedure TAndroidSDKBindingsGen.AddOutputIDs(AIDString: string);
|
||||||
@ -807,9 +845,22 @@ begin
|
|||||||
FJavaOutputIDs.Add(' static final int ' + AIDString + ' = 0x' + IntToHex(FClassNum*$1000+FMethodNum, 8) + ';');
|
FJavaOutputIDs.Add(' static final int ' + AIDString + ' = 0x' + IntToHex(FClassNum*$1000+FMethodNum, 8) + ';');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TAndroidSDKBindingsGen.ConvertJavaSpecialCharsToUnderline(AStr: string): string;
|
||||||
|
begin
|
||||||
|
Result := StringReplace(AStr, '.', '_', [rfReplaceAll, rfIgnoreCase]);
|
||||||
|
Result := StringReplace(Result, '<', '_', [rfReplaceAll]);
|
||||||
|
Result := StringReplace(Result, '>', '_', [rfReplaceAll]);
|
||||||
|
end;
|
||||||
|
|
||||||
function TAndroidSDKBindingsGen.ConvertPointToUnderline(AStr: string): string;
|
function TAndroidSDKBindingsGen.ConvertPointToUnderline(AStr: string): string;
|
||||||
begin
|
begin
|
||||||
Result := SysUtils.StringReplace(AStr, '.', '_', [rfReplaceAll, rfIgnoreCase]);
|
Result := StringReplace(AStr, '.', '_', [rfReplaceAll, rfIgnoreCase]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TAndroidSDKBindingsGen.JavaRemoveGeneric(AStr: string): string;
|
||||||
|
begin
|
||||||
|
Result := StringReplace(AStr, '<', '_', [rfReplaceAll]);
|
||||||
|
Result := StringReplace(Result, '>', '_', [rfReplaceAll]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TAndroidSDKBindingsGen.IsBasicJavaType(AStr: string): Boolean;
|
function TAndroidSDKBindingsGen.IsBasicJavaType(AStr: string): Boolean;
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
#
|
||||||
|
# Declaration of classes:
|
||||||
|
# [ClassName] Parent Interface1 Interface2
|
||||||
|
# declarations of fields, contructors, methods, consts, etc
|
||||||
|
#
|
||||||
|
# For Interfaces:
|
||||||
|
# {InterfaceName} Parent1 Parent2 Parent3
|
||||||
|
#
|
||||||
|
|
||||||
#[MenuItem] TJavaObject
|
#[MenuItem] TJavaObject
|
||||||
#classcallback MenuItem.OnMenuItemClickListener boolean onMenuItemClick (MenuItem item)
|
#classcallback MenuItem.OnMenuItemClickListener boolean onMenuItemClick (MenuItem item)
|
||||||
#method MenuItem setOnMenuItemClickListener (MenuItem.OnMenuItemClickListener menuItemClickListener)
|
#method MenuItem setOnMenuItemClickListener (MenuItem.OnMenuItemClickListener menuItemClickListener)
|
||||||
@ -101,7 +110,37 @@ constructor Create(Activity)
|
|||||||
[AdapterView] ViewGroup
|
[AdapterView] ViewGroup
|
||||||
|
|
||||||
[AbsSpinner] AdapterView
|
[AbsSpinner] AdapterView
|
||||||
|
# SpinnerAdapter getAdapter()
|
||||||
|
method int getCount()
|
||||||
|
# View getSelectedView()
|
||||||
|
# void onRestoreInstanceState(Parcelable state)
|
||||||
|
# Parcelable onSaveInstanceState()
|
||||||
|
# int pointToPosition(int x, int y)
|
||||||
|
# void requestLayout()
|
||||||
|
method void setAdapter(SpinnerAdapter adapter)
|
||||||
|
# void setSelection(int position, boolean animate)
|
||||||
|
# void setSelection(int position)
|
||||||
|
|
||||||
[Spinner] AbsSpinner
|
[Spinner] AbsSpinner
|
||||||
constructor Create(Activity);
|
constructor Create(Activity);
|
||||||
|
|
||||||
|
#
|
||||||
|
# For info about the Adapter of a spinner see:
|
||||||
|
# http://stackoverflow.com/questions/2784081/android-create-spinner-programmatically-from-array
|
||||||
|
#
|
||||||
|
{Filterable}
|
||||||
|
|
||||||
|
{Adapter}
|
||||||
|
|
||||||
|
{ListAdapter} Adapter
|
||||||
|
|
||||||
|
{SpinnerAdapter} Adapter
|
||||||
|
|
||||||
|
# android.widget.BaseAdapter
|
||||||
|
[BaseAdapter] TJavaObject ListAdapter SpinnerAdapter
|
||||||
|
|
||||||
|
# android.widget.ArrayAdapter<T>
|
||||||
|
[ArrayAdapter<String>] BaseAdapter Filterable
|
||||||
|
constructor Create(Activity, int textViewResourceId)
|
||||||
|
method void add(String aobject)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user