diff --git a/bindings/android-sdk/android_bindings_generator.lpi b/bindings/android-sdk/android_bindings_generator.lpi index 1932ee8dd..8c3415108 100644 --- a/bindings/android-sdk/android_bindings_generator.lpi +++ b/bindings/android-sdk/android_bindings_generator.lpi @@ -39,7 +39,7 @@ - + @@ -117,11 +117,10 @@ - - - + + @@ -201,8 +200,8 @@ - - + + @@ -235,10 +234,11 @@ + - - + + @@ -248,8 +248,8 @@ - - + + @@ -341,127 +341,135 @@ + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/bindings/android-sdk/android_sdk_bindings_gen.pas b/bindings/android-sdk/android_sdk_bindings_gen.pas index 78d1dd942..15fa90782 100644 --- a/bindings/android-sdk/android_sdk_bindings_gen.pas +++ b/bindings/android-sdk/android_sdk_bindings_gen.pas @@ -438,7 +438,7 @@ var lReaderPos: Integer = 1; lParamNum: Integer = 1; lCurWord, lParentClassName: string; - lMethodReturn, lMethodReturnPas, lMethodName, lParamType, lParamTypePas, lParamName, lParamPrefix: string; + lMethodReturn, lMethodReturnPas, lMethodName, lPasMethodName, lParamType, lParamTypePas, lParamName, lParamPrefix: string; lMethodReturnJavaIdentifier: string; DeclarationBase, TmpStr, lIDString: string; lJavaParamVar, lJavaParams, lJavaParamSelf: string; @@ -457,6 +457,8 @@ begin lMethodReturn := GetNextWord(ASourceLine, lReaderPos); lMethodReturnPas := GetPascalTypeName(lMethodReturn); lMethodName := GetNextWord(ASourceLine, lReaderPos); + if lMethodName = 'create' then lPasMethodName := lMethodName + '_' + else lPasMethodName := lMethodName; if lMethodReturn = 'void' then DeclarationBase := 'procedure ' else DeclarationBase := 'function '; @@ -489,16 +491,16 @@ begin AddOutputIDs(lIDString); // Add all parameters - TmpStr := lMethodName + '('; + TmpStr := lPasMethodName + '('; repeat lParamType := GetNextWord(ASourceLine, lReaderPos); // Method modifiers - if (lParamType = 'virtual') or (lParamType = 'override') then Continue; - if (lParamType = 'overload') then + if (lParamType = 'virtual') or (lParamType = 'override') + or (lParamType = 'overload') then begin - lPascalMethodModifiers := ' overload;'; + lPascalMethodModifiers := Format(' %s;', [lParamType]); Continue; end; @@ -552,6 +554,11 @@ begin TmpStr := TmpStr + '): ' + lMethodReturnPas + ';'; FPasOutputImpl.Add(' Result := vAndroidPipesComm.WaitForStringReturn();'); end + else if not IsBasicJavaType(lMethodReturn) then + begin + TmpStr := TmpStr + '): ' + lMethodReturnPas + ';'; + FPasOutputImpl.Add(' Result := ' + lMethodReturnPas + '.Create(vAndroidPipesComm.WaitForIntReturn());'); + end else begin TmpStr := TmpStr + '): ' + lMethodReturnPas + ';'; @@ -612,6 +619,7 @@ var lConstructorPasParams, lConstructorJavaParams, lParamPrefix, lJavaParamVar: string; DeclarationBase, lIDString: string; HasActivityParam: Boolean = False; + lPascalMethodModifiers: String = ''; begin if ASourceLine = '' then Exit; @@ -640,7 +648,11 @@ begin lParamType := GetNextWord(ASourceLine, lReaderPos); // Method modifiers - if (lParamType = 'virtual') or (lParamType = 'override') then Continue; + if (lParamType = 'virtual') or (lParamType = 'override') then + begin + lPascalMethodModifiers := Format(' %s;', [lParamType]); + Continue; + end; // The Activity global object doesn't appear in the Pascal side and //comes as a single word in the txt file @@ -681,7 +693,7 @@ begin // Finalization of the constructor - FPasOutputClasses.Add(Format(' constructor %s(%s);', [lMethodName, lConstructorPasParams])); + FPasOutputClasses.Add(Format(' constructor %s(%s);%s', [lMethodName, lConstructorPasParams, lPascalMethodModifiers])); // FPasOutputImpl.Insert(FPasOutputImplCurLine, Format('constructor %s.%s(%s);', [FClassNamePas, lMethodName, lConstructorPasParams])); diff --git a/bindings/android-sdk/sdk_level_7/android_all.txt b/bindings/android-sdk/sdk_level_7/android_all.txt index 876b35074..0840de6c1 100644 --- a/bindings/android-sdk/sdk_level_7/android_all.txt +++ b/bindings/android-sdk/sdk_level_7/android_all.txt @@ -21,7 +21,7 @@ # android.util.* # [DisplayMetrics] TJavaObject -constructor Create() +constructor Create(); override; field float density field int densityDpi field int heightPixels @@ -35,6 +35,9 @@ field float ydpi # {DialogInterface} type DialogInterface.OnClickListener = void onClick(DialogInterface dialog, int which) +const BUTTON_NEGATIVE = $fffffffe; +const BUTTON_NEUTRAL = $fffffffd; +const BUTTON_POSITIVE = $ffffffff; # # android.app.* @@ -158,7 +161,7 @@ method void setTitle(CharSequence title) method void setView(View view) [AlertDialog.Builder] TJavaObject -constructor Create(Activity) +constructor Create(Activity); override; method AlertDialog create () #public Context getContext () #public AlertDialog.Builder setAdapter (ListAdapter adapter, DialogInterface.OnClickListener listener) @@ -218,20 +221,20 @@ method void addView(View child, int width, int height); overload; type View.OnClickListener = void onClick(View v) [LinearLayout] ViewGroup -constructor Create(Activity); +constructor Create(Activity); override; method void setOrientation(int orientation); const HORIZONTAL = 0; const VERTICAL = 1; [AbsoluteLayout] ViewGroup -constructor Create(Activity); +constructor Create(Activity); override; [AbsoluteLayout.LayoutParams] ViewGroup.LayoutParams constructor Create(int param_width, int param_height, int param_x, int param_y); [TextView] View -constructor Create(Activity); virtual; -method void setText(CharSequence AText); virtual; +constructor Create(Activity); override; +method void setText(CharSequence AText); callbacksetter void setOnClickListener($View.OnClickListener l) method void setTextSize(int unit_; float size); method CharSequence getText() @@ -245,7 +248,7 @@ constructor Create(Activity); override; [FrameLayout] ViewGroup [TimePicker] FrameLayout -constructor Create(Activity); +constructor Create(Activity); override; method int getCurrentHour(); method void setCurrentHour(int currentHour); method int getCurrentMinute; @@ -254,7 +257,7 @@ method boolean is24HourView; method void setIs24HourView(boolean AIs24HourView); [ScrollView] FrameLayout -constructor Create(Activity); +constructor Create(Activity); override; [CompoundButton] Button #constructor Create(Activity) abstract @@ -265,7 +268,7 @@ method void setChecked(boolean checked) method void toggle() [CheckBox] CompoundButton -constructor Create(Activity) +constructor Create(Activity); override; [AdapterView] ViewGroup method int getSelectedItemPosition() @@ -283,7 +286,7 @@ methodo void setSelection(int position, boolean animate); overload; method void setSelection(int position); overload; [Spinner] AbsSpinner -constructor Create(Activity); +constructor Create(Activity); override; # # For info about the Adapter of a spinner see: diff --git a/examples/androidlcl/android/src/com/pascal/androidlcl/AndroidAll.java b/examples/androidlcl/android/src/com/pascal/androidlcl/AndroidAll.java index afde62b34..833f4ca62 100644 --- a/examples/androidlcl/android/src/com/pascal/androidlcl/AndroidAll.java +++ b/examples/androidlcl/android/src/com/pascal/androidlcl/AndroidAll.java @@ -629,7 +629,7 @@ public class AndroidAll ViewElementsTags.add(null); MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1); break; - // method void setText(CharSequence AText); virtual; + // method void setText(CharSequence AText); case amkUI_TTextView_setText_1: DebugOut("amkUI_TTextView_setText_1"); // Self