android-sdk: Fixes string methods

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1787 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2011-08-08 14:48:15 +00:00
parent 0a1f27ea2a
commit 36b5c94eb9
3 changed files with 37 additions and 9 deletions

View File

@ -39,7 +39,7 @@
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="20">
<Units Count="21">
<Unit0>
<Filename Value="android_bindings_generator.pas"/>
<IsPartOfProject Value="True"/>
@ -117,11 +117,10 @@
<Filename Value="android_sdk_bindings_gen.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="android_sdk_bindings_gen"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="2"/>
<WindowIndex Value="0"/>
<TopLine Value="134"/>
<CursorPos X="90" Y="139"/>
<TopLine Value="388"/>
<CursorPos X="114" Y="402"/>
<UsageCount Value="34"/>
<Loaded Value="True"/>
</Unit8>
@ -199,10 +198,13 @@
</Unit17>
<Unit18>
<Filename Value="sdk_level_7/android_all.txt"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="4"/>
<WindowIndex Value="0"/>
<TopLine Value="16"/>
<CursorPos X="3" Y="46"/>
<TopLine Value="38"/>
<CursorPos X="9" Y="46"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
<DefaultSyntaxHighlighter Value="None"/>
</Unit18>
<Unit19>
@ -213,6 +215,16 @@
<CursorPos X="54" Y="525"/>
<UsageCount Value="10"/>
</Unit19>
<Unit20>
<Filename Value="../../../test/androidlcl/android/src/com/pascal/androidlcl/AndroidAll.java"/>
<EditorIndex Value="3"/>
<WindowIndex Value="0"/>
<TopLine Value="365"/>
<CursorPos X="63" Y="381"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
<DefaultSyntaxHighlighter Value="Java"/>
</Unit20>
</Units>
<JumpHistory Count="21" HistoryIndex="20">
<Position1>

View File

@ -320,6 +320,8 @@ var
DeclarationBase, TmpStr, lIDString: string;
FPasOutputImplCurLine: Integer;
lJavaParamVar, lJavaParams, lJavaParamSelf: string;
// For adding the var for string params
HasStringParam: Boolean = False;
begin
if ASourceLine = '' then Exit;
@ -373,6 +375,14 @@ begin
TmpStr := TmpStr + lParamPrefix + lParamName + ': ' + lParamTypePas + '; ';
// Pascal parameter sending
if lParamTypePas = 'string' then
begin
FPasOutputImpl.Add(Format(' lString := TString.Create(%s);', [lParamName]));
FPasOutputImpl.Add(' vAndroidPipesComm.SendInt(lString.Index); // text');
FPasOutputImpl.Add(' lString.Free;');
HasStringParam := True;
end
else
FPasOutputImpl.Add(' vAndroidPipesComm.SendInt(Integer(' + lParamName + '));');
// Java parameter reading
@ -404,8 +414,14 @@ begin
FPasOutputImpl.Add(' Result := ' + lMethodReturnPas + '(vAndroidPipesComm.WaitForIntReturn());');
end;
// Insert the start
FPasOutputClasses.Add(' ' + DeclarationBase + TmpStr);
FPasOutputImpl.Insert(FPasOutputImplCurLine, DeclarationBase + FClassNamePas + '.' + TmpStr);
if HasStringParam then
begin
FPasOutputImpl.Insert(FPasOutputImplCurLine+1, 'var');
FPasOutputImpl.Insert(FPasOutputImplCurLine+2, ' lString: TString;');
end;
FPasOutputImpl.Add('end;');
FPasOutputImpl.Add('');

View File

@ -42,8 +42,8 @@ const INVISIBLE = 4;
const GONE = 8;
[ViewGroup] View
procedure addView(View child, LayoutParams params);
procedure addView(View child);
method void addView(View child, ViewGroup.LayoutParams params);
# method void addView(View child);
[LinearLayout] ViewGroup
constructor Create(Activity);