mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-13 05:29:26 +02:00
LCL-CustomDrawn-Android: Changes the hardcoded package name to a variable which user software can change
git-svn-id: trunk@37099 -
This commit is contained in:
parent
15b8f2e5c3
commit
125a10ca75
@ -28,7 +28,7 @@ REM Resource compilation
|
||||
call aapt p -v -f -M AndroidManifest.xml -F bin\%APP_NAME%.ap_ -I %APK_SDK_PLATFORM%\android.jar -S res -m -J gen raw
|
||||
|
||||
REM Java compiler
|
||||
call javac -verbose -classpath %APK_SDK_PLATFORM%\android.jar -d bin\classes src\com\pascal\lcltest\LCLActivity.java
|
||||
call javac -verbose -encoding UTF8 -classpath %APK_SDK_PLATFORM%\android.jar -d bin\classes src\com\pascal\lcltest\LCLActivity.java
|
||||
|
||||
REM DX to convert the java bytecode to dalvik bytecode
|
||||
call dx --dex --verbose --output=%APK_PROJECT_PATH%\bin\classes.dex %APK_PROJECT_PATH%\bin\classes
|
||||
|
@ -312,7 +312,7 @@ public class LCLActivity extends Activity implements SensorEventListener, Locati
|
||||
// -------------------------------------------
|
||||
public native int LCLDrawToBitmap(int width, int height, Bitmap bitmap);
|
||||
public native int LCLOnTouch(float x, float y, int action);
|
||||
public native int LCLOnCreate(LCLActivity lclactivity);
|
||||
public native int LCLOnCreate(Activity lclactivity);
|
||||
public native int LCLOnMessageBoxFinished(int Result, int DialogType);
|
||||
public native int LCLOnKey(int kind, int keyCode, KeyEvent event, int AChar);
|
||||
public native int LCLOnTimer(Runnable timerid);
|
||||
|
@ -31,6 +31,7 @@ begin
|
||||
end;
|
||||
|
||||
begin
|
||||
CDWidgetset.ActivityClassName := 'com/pascal/lcltest/LCLActivity';
|
||||
CDWidgetset.ActivityOnCreate := @MyActivityOnCreate;
|
||||
end.
|
||||
|
||||
|
@ -268,6 +268,7 @@ type
|
||||
|
||||
// Android Activity callbacks
|
||||
ActivityOnCreate: TProcedure;
|
||||
ActivityClassName: string;
|
||||
|
||||
constructor Create; override;
|
||||
destructor Destroy; override;
|
||||
|
@ -313,7 +313,7 @@ begin
|
||||
{$endif}
|
||||
|
||||
// Very strangely in the emulator it crashes if we don't refresh the Activity class here
|
||||
javaActivityClass := javaEnvRef^^.FindClass(javaEnvRef,'com/pascal/lcltest/LCLActivity');
|
||||
javaActivityClass := javaEnvRef^^.FindClass(javaEnvRef, PChar(CDWidgetset.ActivityClassName));
|
||||
|
||||
// ad.setSingleChoiceItems( adapter, -1, MyOnClickListener);
|
||||
// DialogInterface.OnClickListener lclselectitemcallback;
|
||||
|
@ -127,6 +127,8 @@ begin
|
||||
FTerminating := False;
|
||||
DefaultFontSize := 10;
|
||||
|
||||
ActivityClassName := 'com/pascal/lcltest/LCLActivity';
|
||||
|
||||
FClipBoardFormats := TStringList.Create;
|
||||
FClipBoardFormats.Add('foo'); // 0 is reserved
|
||||
|
||||
|
@ -350,7 +350,7 @@ begin
|
||||
Result := 0;
|
||||
|
||||
// Very strangely in the emulator it crashes if we don't refresh the Activity class here
|
||||
javaActivityClass := javaEnvRef^^.FindClass(javaEnvRef,'com/pascal/lcltest/LCLActivity');
|
||||
javaActivityClass := javaEnvRef^^.FindClass(javaEnvRef, PChar(CDWidgetset.ActivityClassName));
|
||||
|
||||
//{$ifdef VerboseCDEvents}
|
||||
DebugLn(Format('LCLOnMenuAction called kind=%d itemIndex=%d', [kind, itemIndex]));
|
||||
@ -441,7 +441,7 @@ const NativeMethods: array[0..8] of JNINativeMethod=
|
||||
signature:'(FFI)I';
|
||||
fnPtr:@Java_com_pascal_lclproject_LCLActivity_LCLOnTouch;),
|
||||
(name:'LCLOnCreate';
|
||||
signature:'(Lcom/pascal/lcltest/LCLActivity;)I'; //android/app/Activity;
|
||||
signature:'(Landroid/app/Activity;)I'; // Don't use a name which includes the package name like com/pascal/lcltest/LCLActivity;
|
||||
fnPtr:@Java_com_pascal_lclproject_LCLActivity_LCLOnCreate;),
|
||||
(name:'LCLOnMessageBoxFinished';
|
||||
signature:'(II)I';
|
||||
@ -484,7 +484,7 @@ begin
|
||||
|
||||
// Find our activity class
|
||||
__android_log_write(ANDROID_LOG_INFO,'lclapp','Reading our Activity Class');
|
||||
javaActivityClass := javaEnvRef^^.FindClass(javaEnvRef,'com/pascal/lcltest/LCLActivity');
|
||||
javaActivityClass := javaEnvRef^^.FindClass(javaEnvRef, PChar(CDWidgetset.ActivityClassName));
|
||||
if not assigned(javaActivityClass) then
|
||||
begin
|
||||
__android_log_write(ANDROID_LOG_FATAL, 'lclapp', 'javaEnvRef^.FindClass failed');
|
||||
|
Loading…
Reference in New Issue
Block a user