You've already forked lazarus-ccr
Removes the LCL-Android example as this interface was substituted by LCL-CustomDrawn
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2187 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,21 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
package="com.pascal.androidlcl"
|
|
||||||
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="4" android:targetSdkVersion="4" />
|
|
||||||
<application android:label="@string/app_name" android:icon="@drawable/icon"
|
|
||||||
android:debuggable="True">
|
|
||||||
<activity android:name="AndroidLCLTest"
|
|
||||||
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>
|
|
@ -1,17 +0,0 @@
|
|||||||
# 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.
|
|
||||||
|
|
@ -1,85 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project name="AndroidLCLTest" 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="project.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>
|
|
@ -1,11 +0,0 @@
|
|||||||
# 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-4
|
|
@ -1,10 +0,0 @@
|
|||||||
# 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
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.8 KiB |
@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<string name="app_name">LCL Test</string>
|
|
||||||
</resources>
|
|
@ -1,965 +0,0 @@
|
|||||||
package com.pascal.androidlcl;
|
|
||||||
|
|
||||||
import android.app.*;
|
|
||||||
import android.view.*;
|
|
||||||
import android.os.*;
|
|
||||||
import android.util.*;
|
|
||||||
import android.content.*;
|
|
||||||
import android.view.*;
|
|
||||||
import android.widget.*;
|
|
||||||
import android.R.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.lang.*;
|
|
||||||
|
|
||||||
public class AndroidAll
|
|
||||||
{
|
|
||||||
// info from other classes
|
|
||||||
Activity activity;
|
|
||||||
AndroidPipesComm MyAndroidPipesComm;
|
|
||||||
JavaLang MyJavaLang;
|
|
||||||
// lists of variables
|
|
||||||
ArrayList ViewElements;
|
|
||||||
ArrayList ViewElementsTags;
|
|
||||||
|
|
||||||
public AndroidAll(AndroidPipesComm AAndroidPipesComm, Activity AActivity, JavaLang AJavaLang)
|
|
||||||
{
|
|
||||||
activity = AActivity;
|
|
||||||
MyAndroidPipesComm = AAndroidPipesComm;
|
|
||||||
MyJavaLang = AJavaLang;
|
|
||||||
ViewElements = new ArrayList();
|
|
||||||
ViewElementsTags = new ArrayList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DebugOut(String Str)
|
|
||||||
{
|
|
||||||
MyAndroidPipesComm.DebugOut(Str);
|
|
||||||
}
|
|
||||||
|
|
||||||
// DisplayMetrics
|
|
||||||
static final int amkUI_TDisplayMetrics_Create_0 = 0x00101000;
|
|
||||||
static final int amkUI_TDisplayMetrics_density_1 = 0x00101001;
|
|
||||||
static final int amkUI_TDisplayMetrics_densityDpi_2 = 0x00101002;
|
|
||||||
static final int amkUI_TDisplayMetrics_heightPixels_3 = 0x00101003;
|
|
||||||
static final int amkUI_TDisplayMetrics_scaledDensity_4 = 0x00101004;
|
|
||||||
static final int amkUI_TDisplayMetrics_widthPixels_5 = 0x00101005;
|
|
||||||
static final int amkUI_TDisplayMetrics_xdpi_6 = 0x00101006;
|
|
||||||
static final int amkUI_TDisplayMetrics_ydpi_7 = 0x00101007;
|
|
||||||
// DialogInterface
|
|
||||||
// Activity
|
|
||||||
static final int amkUI_TActivity_setTitle_0 = 0x00103000;
|
|
||||||
static final int amkUI_TActivity_getTitle_1 = 0x00103001;
|
|
||||||
// Display
|
|
||||||
static final int amkUI_TDisplay_getMetrics_0 = 0x00104000;
|
|
||||||
// WindowManager
|
|
||||||
static final int amkUI_TWindowManager_getDefaultDisplay_0 = 0x00105000;
|
|
||||||
// Dialog
|
|
||||||
static final int amkUI_TDialog_show_0 = 0x00106000;
|
|
||||||
// AlertDialog
|
|
||||||
static final int amkUI_TAlertDialog_setButton_0 = 0x00107000;
|
|
||||||
static final int amkUI_TAlertDialog_Button_Start_1 = 0x00107001;
|
|
||||||
static final int amkUI_TAlertDialog_Button_Finished_2 = 0x00107002;
|
|
||||||
static final int amkUI_TAlertDialog_setMessage_3 = 0x00107003;
|
|
||||||
static final int amkUI_TAlertDialog_setTitle_4 = 0x00107004;
|
|
||||||
static final int amkUI_TAlertDialog_setView_5 = 0x00107005;
|
|
||||||
// AlertDialog.Builder
|
|
||||||
static final int amkUI_TAlertDialog_Builder_Create_0 = 0x00108000;
|
|
||||||
static final int amkUI_TAlertDialog_Builder_create_1 = 0x00108001;
|
|
||||||
static final int amkUI_TAlertDialog_Builder_setMessage_2 = 0x00108002;
|
|
||||||
static final int amkUI_TAlertDialog_Builder_setTitle_3 = 0x00108003;
|
|
||||||
static final int amkUI_TAlertDialog_Builder_setView_4 = 0x00108004;
|
|
||||||
static final int amkUI_TAlertDialog_Builder_show_5 = 0x00108005;
|
|
||||||
// ViewGroup.LayoutParams
|
|
||||||
static final int amkUI_TViewGroup_LayoutParams_Create_0 = 0x00109000;
|
|
||||||
// View
|
|
||||||
static final int amkUI_TView_setLayoutParams_0 = 0x0010A000;
|
|
||||||
static final int amkUI_TView_setOnClickListener_1 = 0x0010A001;
|
|
||||||
static final int amkUI_TView_OnClickListener_Start_2 = 0x0010A002;
|
|
||||||
static final int amkUI_TView_OnClickListener_Finished_3 = 0x0010A003;
|
|
||||||
static final int amkUI_TView_setVisibility_4 = 0x0010A004;
|
|
||||||
// ViewGroup
|
|
||||||
static final int amkUI_TViewGroup_addView_0 = 0x0010B000;
|
|
||||||
static final int amkUI_TViewGroup_addView_1 = 0x0010B001;
|
|
||||||
static final int amkUI_TViewGroup_addView_2 = 0x0010B002;
|
|
||||||
static final int amkUI_TViewGroup_addView_3 = 0x0010B003;
|
|
||||||
static final int amkUI_TViewGroup_addView_4 = 0x0010B004;
|
|
||||||
// LinearLayout
|
|
||||||
static final int amkUI_TLinearLayout_Create_0 = 0x0010C000;
|
|
||||||
static final int amkUI_TLinearLayout_setOrientation_1 = 0x0010C001;
|
|
||||||
// AbsoluteLayout
|
|
||||||
static final int amkUI_TAbsoluteLayout_Create_0 = 0x0010D000;
|
|
||||||
// AbsoluteLayout.LayoutParams
|
|
||||||
static final int amkUI_TAbsoluteLayout_LayoutParams_Create_0 = 0x0010E000;
|
|
||||||
// TextView
|
|
||||||
static final int amkUI_TTextView_Create_0 = 0x0010F000;
|
|
||||||
static final int amkUI_TTextView_getText_1 = 0x0010F001;
|
|
||||||
static final int amkUI_TTextView_setText_2 = 0x0010F002;
|
|
||||||
static final int amkUI_TTextView_setTextSize_3 = 0x0010F003;
|
|
||||||
// EditText
|
|
||||||
static final int amkUI_TEditText_Create_0 = 0x00110000;
|
|
||||||
// Button
|
|
||||||
static final int amkUI_TButton_Create_0 = 0x00111000;
|
|
||||||
// FrameLayout
|
|
||||||
// TimePicker
|
|
||||||
static final int amkUI_TTimePicker_Create_0 = 0x00113000;
|
|
||||||
static final int amkUI_TTimePicker_getCurrentHour_1 = 0x00113001;
|
|
||||||
static final int amkUI_TTimePicker_setCurrentHour_2 = 0x00113002;
|
|
||||||
static final int amkUI_TTimePicker_getCurrentMinute_3 = 0x00113003;
|
|
||||||
static final int amkUI_TTimePicker_setCurrentMinute_4 = 0x00113004;
|
|
||||||
static final int amkUI_TTimePicker_is24HourView_5 = 0x00113005;
|
|
||||||
static final int amkUI_TTimePicker_setIs24HourView_6 = 0x00113006;
|
|
||||||
// ScrollView
|
|
||||||
static final int amkUI_TScrollView_Create_0 = 0x00114000;
|
|
||||||
// CompoundButton
|
|
||||||
static final int amkUI_TCompoundButton_isChecked_0 = 0x00115000;
|
|
||||||
static final int amkUI_TCompoundButton_performClick_1 = 0x00115001;
|
|
||||||
static final int amkUI_TCompoundButton_setChecked_2 = 0x00115002;
|
|
||||||
static final int amkUI_TCompoundButton_toggle_3 = 0x00115003;
|
|
||||||
// CheckBox
|
|
||||||
static final int amkUI_TCheckBox_Create_0 = 0x00116000;
|
|
||||||
// AdapterView
|
|
||||||
static final int amkUI_TAdapterView_getSelectedItemPosition_0 = 0x00117000;
|
|
||||||
// AbsSpinner
|
|
||||||
static final int amkUI_TAbsSpinner_getCount_0 = 0x00118000;
|
|
||||||
static final int amkUI_TAbsSpinner_setAdapter_1 = 0x00118001;
|
|
||||||
static final int amkUI_TAbsSpinner_setSelection_2 = 0x00118002;
|
|
||||||
// Spinner
|
|
||||||
static final int amkUI_TSpinner_Create_0 = 0x00119000;
|
|
||||||
// Filterable
|
|
||||||
// Adapter
|
|
||||||
// ListAdapter
|
|
||||||
// SpinnerAdapter
|
|
||||||
// BaseAdapter
|
|
||||||
// ArrayAdapter<String>
|
|
||||||
static final int amkUI_TArrayAdapter_String__Create_0 = 0x0011F000;
|
|
||||||
static final int amkUI_TArrayAdapter_String__add_1 = 0x0011F001;
|
|
||||||
static final int amkUI_TArrayAdapter_String__clear_2 = 0x0011F002;
|
|
||||||
static final int amkUI_TArrayAdapter_String__insert_3 = 0x0011F003;
|
|
||||||
static final int amkUI_TArrayAdapter_String__remove_4 = 0x0011F004;
|
|
||||||
// layout
|
|
||||||
|
|
||||||
public boolean ProcessCommand(int Buffer)
|
|
||||||
{
|
|
||||||
//DebugOut("AndroidUI.ProcessCommand Command=" + java.lang.Integer.toHexString(Buffer));
|
|
||||||
//
|
|
||||||
// basic types
|
|
||||||
//
|
|
||||||
int lInt, lIndex, lPascalPointer;
|
|
||||||
boolean lBool;
|
|
||||||
float lFloat;
|
|
||||||
//
|
|
||||||
// Self params
|
|
||||||
//
|
|
||||||
View param_self_View;
|
|
||||||
ViewGroup param_self_ViewGroup;
|
|
||||||
TextView param_self_TextView;
|
|
||||||
Button param_self_Button;
|
|
||||||
EditText param_self_EditText;
|
|
||||||
LinearLayout param_self_LinearLayout;
|
|
||||||
TimePicker param_self_TimePicker;
|
|
||||||
Display param_self_Display;
|
|
||||||
DisplayMetrics param_self_DisplayMetrics;
|
|
||||||
CompoundButton param_self_CompoundButton;
|
|
||||||
WindowManager param_self_WindowManager;
|
|
||||||
AbsSpinner param_self_AbsSpinner;
|
|
||||||
ArrayAdapter<String> param_self_ArrayAdapter_String_;
|
|
||||||
AdapterView param_self_AdapterView;
|
|
||||||
AlertDialog.Builder param_self_AlertDialog_Builder;
|
|
||||||
Dialog param_self_Dialog;
|
|
||||||
AlertDialog param_self_AlertDialog;
|
|
||||||
//
|
|
||||||
// Params
|
|
||||||
//
|
|
||||||
ViewGroup.LayoutParams lViewGroup_LayoutParams_1, lViewGroup_LayoutParams_2, lViewGroup_LayoutParams_3;
|
|
||||||
SpinnerAdapter lSpinnerAdapter_1;
|
|
||||||
DisplayMetrics lDisplayMetrics_1;
|
|
||||||
CharSequence lCharSequence_1, lCharSequence_2;
|
|
||||||
String lString_1;
|
|
||||||
View lView_1;
|
|
||||||
int lint_1, lint_2, lint_3, lint_4;
|
|
||||||
float lfloat_1, lfloat_2;
|
|
||||||
boolean lboolean_1;
|
|
||||||
//
|
|
||||||
// Results
|
|
||||||
//
|
|
||||||
float lResult_float;
|
|
||||||
int lResult_int;
|
|
||||||
boolean lResult_boolean;
|
|
||||||
CharSequence lResult_CharSequence;
|
|
||||||
Display lResult_Display;
|
|
||||||
AlertDialog.Builder lResult_AlertDialog_Builder;
|
|
||||||
AlertDialog lResult_AlertDialog;
|
|
||||||
|
|
||||||
switch (Buffer)
|
|
||||||
{
|
|
||||||
|
|
||||||
case amkUI_TDisplayMetrics_Create_0:
|
|
||||||
DebugOut("amkUI_TDisplayMetrics_Create_0");
|
|
||||||
ViewElements.add(new DisplayMetrics());
|
|
||||||
ViewElementsTags.add(null);
|
|
||||||
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
|
|
||||||
break;
|
|
||||||
// field float density
|
|
||||||
case amkUI_TDisplayMetrics_density_1:
|
|
||||||
DebugOut("amkUI_TDisplayMetrics_density_1");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_DisplayMetrics = (DisplayMetrics) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
lResult_float = param_self_DisplayMetrics.density;
|
|
||||||
MyAndroidPipesComm.SendFloatResult(lResult_float);
|
|
||||||
break;
|
|
||||||
// field int densityDpi
|
|
||||||
case amkUI_TDisplayMetrics_densityDpi_2:
|
|
||||||
DebugOut("amkUI_TDisplayMetrics_densityDpi_2");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_DisplayMetrics = (DisplayMetrics) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
lResult_int = param_self_DisplayMetrics.densityDpi;
|
|
||||||
MyAndroidPipesComm.SendIntResult(lResult_int);
|
|
||||||
break;
|
|
||||||
// field int heightPixels
|
|
||||||
case amkUI_TDisplayMetrics_heightPixels_3:
|
|
||||||
DebugOut("amkUI_TDisplayMetrics_heightPixels_3");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_DisplayMetrics = (DisplayMetrics) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
lResult_int = param_self_DisplayMetrics.heightPixels;
|
|
||||||
MyAndroidPipesComm.SendIntResult(lResult_int);
|
|
||||||
break;
|
|
||||||
// field float scaledDensity
|
|
||||||
case amkUI_TDisplayMetrics_scaledDensity_4:
|
|
||||||
DebugOut("amkUI_TDisplayMetrics_scaledDensity_4");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_DisplayMetrics = (DisplayMetrics) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
lResult_float = param_self_DisplayMetrics.scaledDensity;
|
|
||||||
MyAndroidPipesComm.SendFloatResult(lResult_float);
|
|
||||||
break;
|
|
||||||
// field int widthPixels
|
|
||||||
case amkUI_TDisplayMetrics_widthPixels_5:
|
|
||||||
DebugOut("amkUI_TDisplayMetrics_widthPixels_5");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_DisplayMetrics = (DisplayMetrics) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
lResult_int = param_self_DisplayMetrics.widthPixels;
|
|
||||||
MyAndroidPipesComm.SendIntResult(lResult_int);
|
|
||||||
break;
|
|
||||||
// field float xdpi
|
|
||||||
case amkUI_TDisplayMetrics_xdpi_6:
|
|
||||||
DebugOut("amkUI_TDisplayMetrics_xdpi_6");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_DisplayMetrics = (DisplayMetrics) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
lResult_float = param_self_DisplayMetrics.xdpi;
|
|
||||||
MyAndroidPipesComm.SendFloatResult(lResult_float);
|
|
||||||
break;
|
|
||||||
// field float ydpi
|
|
||||||
case amkUI_TDisplayMetrics_ydpi_7:
|
|
||||||
DebugOut("amkUI_TDisplayMetrics_ydpi_7");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_DisplayMetrics = (DisplayMetrics) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
lResult_float = param_self_DisplayMetrics.ydpi;
|
|
||||||
MyAndroidPipesComm.SendFloatResult(lResult_float);
|
|
||||||
break;
|
|
||||||
// method void setTitle(CharSequence title)
|
|
||||||
case amkUI_TActivity_setTitle_0:
|
|
||||||
DebugOut("amkUI_TActivity_setTitle_0");
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lCharSequence_1 = (CharSequence) MyJavaLang.LangElements.get(lInt);
|
|
||||||
//
|
|
||||||
activity.setTitle(lCharSequence_1);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
// method CharSequence getTitle()
|
|
||||||
case amkUI_TActivity_getTitle_1:
|
|
||||||
DebugOut("amkUI_TActivity_getTitle_1");
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
lResult_CharSequence = activity.getTitle();
|
|
||||||
MyAndroidPipesComm.SendStringResult(lResult_CharSequence);
|
|
||||||
break;
|
|
||||||
// method void getMetrics(DisplayMetrics outMetrics)
|
|
||||||
case amkUI_TDisplay_getMetrics_0:
|
|
||||||
DebugOut("amkUI_TDisplay_getMetrics_0");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_Display = (Display) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lDisplayMetrics_1 = (DisplayMetrics) ViewElements.get(lInt);
|
|
||||||
//
|
|
||||||
param_self_Display.getMetrics(lDisplayMetrics_1);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
// method Display getDefaultDisplay()
|
|
||||||
case amkUI_TWindowManager_getDefaultDisplay_0:
|
|
||||||
DebugOut("amkUI_TWindowManager_getDefaultDisplay_0");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_WindowManager = (WindowManager) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
lResult_Display = param_self_WindowManager.getDefaultDisplay();
|
|
||||||
ViewElements.add(lResult_Display);
|
|
||||||
ViewElementsTags.add(null);
|
|
||||||
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
|
|
||||||
break;
|
|
||||||
// method void show()
|
|
||||||
case amkUI_TDialog_show_0:
|
|
||||||
DebugOut("amkUI_TDialog_show_0");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_Dialog = (Dialog) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
param_self_Dialog.show();
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
// callbacksetter void setButton(int whichButton, CharSequence text, $DialogInterface.OnClickListener listener)
|
|
||||||
case amkUI_TAlertDialog_setButton_0:
|
|
||||||
DebugOut("amkUI_TAlertDialog_setButton_0");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_AlertDialog = (AlertDialog) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lPascalPointer = MyAndroidPipesComm.GetInt();
|
|
||||||
ViewElementsTags.set(lInt, new Integer(lPascalPointer));
|
|
||||||
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lint_1 = lInt;
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lCharSequence_2 = (CharSequence) MyJavaLang.LangElements.get(lInt);
|
|
||||||
// Run the code
|
|
||||||
param_self_AlertDialog.setButton(lint_1, lCharSequence_2, new DialogInterface.OnClickListener()
|
|
||||||
{
|
|
||||||
public void onClick(DialogInterface dialog, int which)
|
|
||||||
{
|
|
||||||
// Perform action
|
|
||||||
DebugOut("START DialogInterface.OnClickListener");
|
|
||||||
MyAndroidPipesComm.SendMessage(AndroidPipesComm.amkUICommand, amkUI_TAlertDialog_Button_Start_1);
|
|
||||||
Integer lTag = (Integer) ViewElementsTags.get(ViewElements.indexOf(dialog));
|
|
||||||
MyAndroidPipesComm.SendInt(lTag.intValue());
|
|
||||||
MyAndroidPipesComm.WaitForPascalMessage(AndroidPipesComm.amkUICommand, amkUI_TAlertDialog_Button_Finished_2);
|
|
||||||
DebugOut("END DialogInterface.OnClickListener");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
// method void setMessage(CharSequence message)
|
|
||||||
case amkUI_TAlertDialog_setMessage_3:
|
|
||||||
DebugOut("amkUI_TAlertDialog_setMessage_3");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_AlertDialog = (AlertDialog) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lCharSequence_1 = (CharSequence) MyJavaLang.LangElements.get(lInt);
|
|
||||||
//
|
|
||||||
param_self_AlertDialog.setMessage(lCharSequence_1);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
// method void setTitle(CharSequence title)
|
|
||||||
case amkUI_TAlertDialog_setTitle_4:
|
|
||||||
DebugOut("amkUI_TAlertDialog_setTitle_4");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_AlertDialog = (AlertDialog) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lCharSequence_1 = (CharSequence) MyJavaLang.LangElements.get(lInt);
|
|
||||||
//
|
|
||||||
param_self_AlertDialog.setTitle(lCharSequence_1);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
// method void setView(View view)
|
|
||||||
case amkUI_TAlertDialog_setView_5:
|
|
||||||
DebugOut("amkUI_TAlertDialog_setView_5");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_AlertDialog = (AlertDialog) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lView_1 = (View) ViewElements.get(lInt);
|
|
||||||
//
|
|
||||||
param_self_AlertDialog.setView(lView_1);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
case amkUI_TAlertDialog_Builder_Create_0:
|
|
||||||
DebugOut("amkUI_TAlertDialog_Builder_Create_0");
|
|
||||||
ViewElements.add(new AlertDialog.Builder(activity));
|
|
||||||
ViewElementsTags.add(null);
|
|
||||||
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
|
|
||||||
break;
|
|
||||||
// method AlertDialog create ()
|
|
||||||
case amkUI_TAlertDialog_Builder_create_1:
|
|
||||||
DebugOut("amkUI_TAlertDialog_Builder_create_1");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_AlertDialog_Builder = (AlertDialog.Builder) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
lResult_AlertDialog = param_self_AlertDialog_Builder.create();
|
|
||||||
ViewElements.add(lResult_AlertDialog);
|
|
||||||
ViewElementsTags.add(null);
|
|
||||||
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
|
|
||||||
break;
|
|
||||||
// method AlertDialog.Builder setMessage (CharSequence message)
|
|
||||||
case amkUI_TAlertDialog_Builder_setMessage_2:
|
|
||||||
DebugOut("amkUI_TAlertDialog_Builder_setMessage_2");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_AlertDialog_Builder = (AlertDialog.Builder) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lCharSequence_1 = (CharSequence) MyJavaLang.LangElements.get(lInt);
|
|
||||||
//
|
|
||||||
lResult_AlertDialog_Builder = param_self_AlertDialog_Builder.setMessage(lCharSequence_1);
|
|
||||||
ViewElements.add(lResult_AlertDialog_Builder);
|
|
||||||
ViewElementsTags.add(null);
|
|
||||||
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
|
|
||||||
break;
|
|
||||||
// method AlertDialog.Builder setTitle (CharSequence title)
|
|
||||||
case amkUI_TAlertDialog_Builder_setTitle_3:
|
|
||||||
DebugOut("amkUI_TAlertDialog_Builder_setTitle_3");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_AlertDialog_Builder = (AlertDialog.Builder) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lCharSequence_1 = (CharSequence) MyJavaLang.LangElements.get(lInt);
|
|
||||||
//
|
|
||||||
lResult_AlertDialog_Builder = param_self_AlertDialog_Builder.setTitle(lCharSequence_1);
|
|
||||||
ViewElements.add(lResult_AlertDialog_Builder);
|
|
||||||
ViewElementsTags.add(null);
|
|
||||||
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
|
|
||||||
break;
|
|
||||||
// method AlertDialog.Builder setView (View view)
|
|
||||||
case amkUI_TAlertDialog_Builder_setView_4:
|
|
||||||
DebugOut("amkUI_TAlertDialog_Builder_setView_4");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_AlertDialog_Builder = (AlertDialog.Builder) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lView_1 = (View) ViewElements.get(lInt);
|
|
||||||
//
|
|
||||||
lResult_AlertDialog_Builder = param_self_AlertDialog_Builder.setView(lView_1);
|
|
||||||
ViewElements.add(lResult_AlertDialog_Builder);
|
|
||||||
ViewElementsTags.add(null);
|
|
||||||
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
|
|
||||||
break;
|
|
||||||
// method AlertDialog show ()
|
|
||||||
case amkUI_TAlertDialog_Builder_show_5:
|
|
||||||
DebugOut("amkUI_TAlertDialog_Builder_show_5");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_AlertDialog_Builder = (AlertDialog.Builder) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
lResult_AlertDialog = param_self_AlertDialog_Builder.show();
|
|
||||||
ViewElements.add(lResult_AlertDialog);
|
|
||||||
ViewElementsTags.add(null);
|
|
||||||
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
|
|
||||||
break;
|
|
||||||
case amkUI_TViewGroup_LayoutParams_Create_0:
|
|
||||||
DebugOut("amkUI_TViewGroup_LayoutParams_Create_0");
|
|
||||||
lint_1 = MyAndroidPipesComm.GetInt();
|
|
||||||
lint_2 = MyAndroidPipesComm.GetInt();
|
|
||||||
ViewElements.add(new ViewGroup.LayoutParams(lint_1, lint_2));
|
|
||||||
ViewElementsTags.add(null);
|
|
||||||
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
|
|
||||||
break;
|
|
||||||
// method void setLayoutParams(ViewGroup.LayoutParams params);
|
|
||||||
case amkUI_TView_setLayoutParams_0:
|
|
||||||
DebugOut("amkUI_TView_setLayoutParams_0");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_View = (View) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lViewGroup_LayoutParams_1 = (ViewGroup.LayoutParams) ViewElements.get(lInt);
|
|
||||||
//
|
|
||||||
param_self_View.setLayoutParams(lViewGroup_LayoutParams_1);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
// callbacksetter void setOnClickListener($View.OnClickListener l)
|
|
||||||
case amkUI_TView_setOnClickListener_1:
|
|
||||||
DebugOut("amkUI_TView_setOnClickListener_1");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_View = (View) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lPascalPointer = MyAndroidPipesComm.GetInt();
|
|
||||||
ViewElementsTags.set(lInt, new Integer(lPascalPointer));
|
|
||||||
|
|
||||||
// Run the code
|
|
||||||
param_self_View.setOnClickListener( new View.OnClickListener()
|
|
||||||
{
|
|
||||||
public void onClick(View v)
|
|
||||||
{
|
|
||||||
// Perform action
|
|
||||||
DebugOut("START View.OnClickListener");
|
|
||||||
MyAndroidPipesComm.SendMessage(AndroidPipesComm.amkUICommand, amkUI_TView_OnClickListener_Start_2);
|
|
||||||
Integer lTag = (Integer) ViewElementsTags.get(ViewElements.indexOf(v));
|
|
||||||
MyAndroidPipesComm.SendInt(lTag.intValue());
|
|
||||||
MyAndroidPipesComm.WaitForPascalMessage(AndroidPipesComm.amkUICommand, amkUI_TView_OnClickListener_Finished_3);
|
|
||||||
DebugOut("END View.OnClickListener");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
// method void setVisibility(int visibility);
|
|
||||||
case amkUI_TView_setVisibility_4:
|
|
||||||
DebugOut("amkUI_TView_setVisibility_4");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_View = (View) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lint_1 = lInt;
|
|
||||||
//
|
|
||||||
param_self_View.setVisibility(lint_1);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
// method void addView(View child, int aindex, ViewGroup.LayoutParams params); overload;
|
|
||||||
case amkUI_TViewGroup_addView_0:
|
|
||||||
DebugOut("amkUI_TViewGroup_addView_0");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_ViewGroup = (ViewGroup) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lView_1 = (View) ViewElements.get(lInt);
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lint_2 = lInt;
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lViewGroup_LayoutParams_3 = (ViewGroup.LayoutParams) ViewElements.get(lInt);
|
|
||||||
//
|
|
||||||
param_self_ViewGroup.addView(lView_1, lint_2, lViewGroup_LayoutParams_3);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
// method void addView(View child, ViewGroup.LayoutParams params); overload;
|
|
||||||
case amkUI_TViewGroup_addView_1:
|
|
||||||
DebugOut("amkUI_TViewGroup_addView_1");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_ViewGroup = (ViewGroup) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lView_1 = (View) ViewElements.get(lInt);
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lViewGroup_LayoutParams_2 = (ViewGroup.LayoutParams) ViewElements.get(lInt);
|
|
||||||
//
|
|
||||||
param_self_ViewGroup.addView(lView_1, lViewGroup_LayoutParams_2);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
// method void addView(View child, int aindex); overload;
|
|
||||||
case amkUI_TViewGroup_addView_2:
|
|
||||||
DebugOut("amkUI_TViewGroup_addView_2");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_ViewGroup = (ViewGroup) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lView_1 = (View) ViewElements.get(lInt);
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lint_2 = lInt;
|
|
||||||
//
|
|
||||||
param_self_ViewGroup.addView(lView_1, lint_2);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
// method void addView(View child); overload;
|
|
||||||
case amkUI_TViewGroup_addView_3:
|
|
||||||
DebugOut("amkUI_TViewGroup_addView_3");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_ViewGroup = (ViewGroup) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lView_1 = (View) ViewElements.get(lInt);
|
|
||||||
//
|
|
||||||
param_self_ViewGroup.addView(lView_1);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
// method void addView(View child, int width, int height); overload;
|
|
||||||
case amkUI_TViewGroup_addView_4:
|
|
||||||
DebugOut("amkUI_TViewGroup_addView_4");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_ViewGroup = (ViewGroup) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lView_1 = (View) ViewElements.get(lInt);
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lint_2 = lInt;
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lint_3 = lInt;
|
|
||||||
//
|
|
||||||
param_self_ViewGroup.addView(lView_1, lint_2, lint_3);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
case amkUI_TLinearLayout_Create_0:
|
|
||||||
DebugOut("amkUI_TLinearLayout_Create_0");
|
|
||||||
ViewElements.add(new LinearLayout(activity));
|
|
||||||
ViewElementsTags.add(null);
|
|
||||||
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
|
|
||||||
break;
|
|
||||||
// method void setOrientation(int orientation);
|
|
||||||
case amkUI_TLinearLayout_setOrientation_1:
|
|
||||||
DebugOut("amkUI_TLinearLayout_setOrientation_1");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_LinearLayout = (LinearLayout) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lint_1 = lInt;
|
|
||||||
//
|
|
||||||
param_self_LinearLayout.setOrientation(lint_1);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
case amkUI_TAbsoluteLayout_Create_0:
|
|
||||||
DebugOut("amkUI_TAbsoluteLayout_Create_0");
|
|
||||||
ViewElements.add(new AbsoluteLayout(activity));
|
|
||||||
ViewElementsTags.add(null);
|
|
||||||
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
|
|
||||||
break;
|
|
||||||
case amkUI_TAbsoluteLayout_LayoutParams_Create_0:
|
|
||||||
DebugOut("amkUI_TAbsoluteLayout_LayoutParams_Create_0");
|
|
||||||
lint_1 = MyAndroidPipesComm.GetInt();
|
|
||||||
lint_2 = MyAndroidPipesComm.GetInt();
|
|
||||||
lint_3 = MyAndroidPipesComm.GetInt();
|
|
||||||
lint_4 = MyAndroidPipesComm.GetInt();
|
|
||||||
ViewElements.add(new AbsoluteLayout.LayoutParams(lint_1, lint_2, lint_3, lint_4));
|
|
||||||
ViewElementsTags.add(null);
|
|
||||||
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
|
|
||||||
break;
|
|
||||||
case amkUI_TTextView_Create_0:
|
|
||||||
DebugOut("amkUI_TTextView_Create_0");
|
|
||||||
ViewElements.add(new TextView(activity));
|
|
||||||
ViewElementsTags.add(null);
|
|
||||||
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
|
|
||||||
break;
|
|
||||||
// method CharSequence getText()
|
|
||||||
case amkUI_TTextView_getText_1:
|
|
||||||
DebugOut("amkUI_TTextView_getText_1");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_TextView = (TextView) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
lResult_CharSequence = param_self_TextView.getText();
|
|
||||||
MyAndroidPipesComm.SendStringResult(lResult_CharSequence);
|
|
||||||
break;
|
|
||||||
// method void setText(CharSequence AText);
|
|
||||||
case amkUI_TTextView_setText_2:
|
|
||||||
DebugOut("amkUI_TTextView_setText_2");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_TextView = (TextView) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lCharSequence_1 = (CharSequence) MyJavaLang.LangElements.get(lInt);
|
|
||||||
//
|
|
||||||
param_self_TextView.setText(lCharSequence_1);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
// method void setTextSize(int unit_; float size);
|
|
||||||
case amkUI_TTextView_setTextSize_3:
|
|
||||||
DebugOut("amkUI_TTextView_setTextSize_3");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_TextView = (TextView) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lint_1 = lInt;
|
|
||||||
lFloat = MyAndroidPipesComm.GetFloat();
|
|
||||||
lfloat_2 = lFloat;
|
|
||||||
//
|
|
||||||
param_self_TextView.setTextSize(lint_1, lfloat_2);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
case amkUI_TEditText_Create_0:
|
|
||||||
DebugOut("amkUI_TEditText_Create_0");
|
|
||||||
ViewElements.add(new EditText(activity));
|
|
||||||
ViewElementsTags.add(null);
|
|
||||||
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
|
|
||||||
break;
|
|
||||||
case amkUI_TButton_Create_0:
|
|
||||||
DebugOut("amkUI_TButton_Create_0");
|
|
||||||
ViewElements.add(new Button(activity));
|
|
||||||
ViewElementsTags.add(null);
|
|
||||||
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
|
|
||||||
break;
|
|
||||||
case amkUI_TTimePicker_Create_0:
|
|
||||||
DebugOut("amkUI_TTimePicker_Create_0");
|
|
||||||
ViewElements.add(new TimePicker(activity));
|
|
||||||
ViewElementsTags.add(null);
|
|
||||||
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
|
|
||||||
break;
|
|
||||||
// method int getCurrentHour();
|
|
||||||
case amkUI_TTimePicker_getCurrentHour_1:
|
|
||||||
DebugOut("amkUI_TTimePicker_getCurrentHour_1");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_TimePicker = (TimePicker) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
lResult_int = param_self_TimePicker.getCurrentHour();
|
|
||||||
MyAndroidPipesComm.SendIntResult(lResult_int);
|
|
||||||
break;
|
|
||||||
// method void setCurrentHour(int currentHour);
|
|
||||||
case amkUI_TTimePicker_setCurrentHour_2:
|
|
||||||
DebugOut("amkUI_TTimePicker_setCurrentHour_2");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_TimePicker = (TimePicker) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lint_1 = lInt;
|
|
||||||
//
|
|
||||||
param_self_TimePicker.setCurrentHour(lint_1);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
// method int getCurrentMinute;
|
|
||||||
case amkUI_TTimePicker_getCurrentMinute_3:
|
|
||||||
DebugOut("amkUI_TTimePicker_getCurrentMinute_3");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_TimePicker = (TimePicker) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
lResult_int = param_self_TimePicker.getCurrentMinute();
|
|
||||||
MyAndroidPipesComm.SendIntResult(lResult_int);
|
|
||||||
break;
|
|
||||||
// method void setCurrentMinute(int currentMinute);
|
|
||||||
case amkUI_TTimePicker_setCurrentMinute_4:
|
|
||||||
DebugOut("amkUI_TTimePicker_setCurrentMinute_4");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_TimePicker = (TimePicker) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lint_1 = lInt;
|
|
||||||
//
|
|
||||||
param_self_TimePicker.setCurrentMinute(lint_1);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
// method boolean is24HourView;
|
|
||||||
case amkUI_TTimePicker_is24HourView_5:
|
|
||||||
DebugOut("amkUI_TTimePicker_is24HourView_5");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_TimePicker = (TimePicker) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
lResult_boolean = param_self_TimePicker.is24HourView();
|
|
||||||
MyAndroidPipesComm.SendBoolResult(lResult_boolean);
|
|
||||||
break;
|
|
||||||
// method void setIs24HourView(boolean AIs24HourView);
|
|
||||||
case amkUI_TTimePicker_setIs24HourView_6:
|
|
||||||
DebugOut("amkUI_TTimePicker_setIs24HourView_6");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_TimePicker = (TimePicker) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lBool = MyAndroidPipesComm.GetBool();
|
|
||||||
lboolean_1 = lBool;
|
|
||||||
//
|
|
||||||
param_self_TimePicker.setIs24HourView(lboolean_1);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
case amkUI_TScrollView_Create_0:
|
|
||||||
DebugOut("amkUI_TScrollView_Create_0");
|
|
||||||
ViewElements.add(new ScrollView(activity));
|
|
||||||
ViewElementsTags.add(null);
|
|
||||||
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
|
|
||||||
break;
|
|
||||||
// method boolean isChecked()
|
|
||||||
case amkUI_TCompoundButton_isChecked_0:
|
|
||||||
DebugOut("amkUI_TCompoundButton_isChecked_0");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_CompoundButton = (CompoundButton) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
lResult_boolean = param_self_CompoundButton.isChecked();
|
|
||||||
MyAndroidPipesComm.SendBoolResult(lResult_boolean);
|
|
||||||
break;
|
|
||||||
// method boolean performClick()
|
|
||||||
case amkUI_TCompoundButton_performClick_1:
|
|
||||||
DebugOut("amkUI_TCompoundButton_performClick_1");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_CompoundButton = (CompoundButton) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
lResult_boolean = param_self_CompoundButton.performClick();
|
|
||||||
MyAndroidPipesComm.SendBoolResult(lResult_boolean);
|
|
||||||
break;
|
|
||||||
// method void setChecked(boolean checked)
|
|
||||||
case amkUI_TCompoundButton_setChecked_2:
|
|
||||||
DebugOut("amkUI_TCompoundButton_setChecked_2");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_CompoundButton = (CompoundButton) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lBool = MyAndroidPipesComm.GetBool();
|
|
||||||
lboolean_1 = lBool;
|
|
||||||
//
|
|
||||||
param_self_CompoundButton.setChecked(lboolean_1);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
// method void toggle()
|
|
||||||
case amkUI_TCompoundButton_toggle_3:
|
|
||||||
DebugOut("amkUI_TCompoundButton_toggle_3");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_CompoundButton = (CompoundButton) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
param_self_CompoundButton.toggle();
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
case amkUI_TCheckBox_Create_0:
|
|
||||||
DebugOut("amkUI_TCheckBox_Create_0");
|
|
||||||
ViewElements.add(new CheckBox(activity));
|
|
||||||
ViewElementsTags.add(null);
|
|
||||||
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
|
|
||||||
break;
|
|
||||||
// method int getSelectedItemPosition()
|
|
||||||
case amkUI_TAdapterView_getSelectedItemPosition_0:
|
|
||||||
DebugOut("amkUI_TAdapterView_getSelectedItemPosition_0");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_AdapterView = (AdapterView) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
lResult_int = param_self_AdapterView.getSelectedItemPosition();
|
|
||||||
MyAndroidPipesComm.SendIntResult(lResult_int);
|
|
||||||
break;
|
|
||||||
// method int getCount()
|
|
||||||
case amkUI_TAbsSpinner_getCount_0:
|
|
||||||
DebugOut("amkUI_TAbsSpinner_getCount_0");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_AbsSpinner = (AbsSpinner) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
lResult_int = param_self_AbsSpinner.getCount();
|
|
||||||
MyAndroidPipesComm.SendIntResult(lResult_int);
|
|
||||||
break;
|
|
||||||
// method void setAdapter(SpinnerAdapter adapter)
|
|
||||||
case amkUI_TAbsSpinner_setAdapter_1:
|
|
||||||
DebugOut("amkUI_TAbsSpinner_setAdapter_1");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_AbsSpinner = (AbsSpinner) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lSpinnerAdapter_1 = (SpinnerAdapter) ViewElements.get(lInt);
|
|
||||||
//
|
|
||||||
param_self_AbsSpinner.setAdapter(lSpinnerAdapter_1);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
// method void setSelection(int position); overload;
|
|
||||||
case amkUI_TAbsSpinner_setSelection_2:
|
|
||||||
DebugOut("amkUI_TAbsSpinner_setSelection_2");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_AbsSpinner = (AbsSpinner) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lint_1 = lInt;
|
|
||||||
//
|
|
||||||
param_self_AbsSpinner.setSelection(lint_1);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
case amkUI_TSpinner_Create_0:
|
|
||||||
DebugOut("amkUI_TSpinner_Create_0");
|
|
||||||
ViewElements.add(new Spinner(activity));
|
|
||||||
ViewElementsTags.add(null);
|
|
||||||
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
|
|
||||||
break;
|
|
||||||
case amkUI_TArrayAdapter_String__Create_0:
|
|
||||||
DebugOut("amkUI_TArrayAdapter_String__Create_0");
|
|
||||||
lint_1 = MyAndroidPipesComm.GetInt();
|
|
||||||
ViewElements.add(new ArrayAdapter<String>(activity, lint_1));
|
|
||||||
ViewElementsTags.add(null);
|
|
||||||
MyAndroidPipesComm.SendIntResult(ViewElements.size() - 1);
|
|
||||||
break;
|
|
||||||
// method void add(String aobject)
|
|
||||||
case amkUI_TArrayAdapter_String__add_1:
|
|
||||||
DebugOut("amkUI_TArrayAdapter_String__add_1");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_ArrayAdapter_String_ = (ArrayAdapter<String>) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lString_1 = (String) MyJavaLang.LangElements.get(lInt);
|
|
||||||
//
|
|
||||||
param_self_ArrayAdapter_String_.add(lString_1);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
// method void clear()
|
|
||||||
case amkUI_TArrayAdapter_String__clear_2:
|
|
||||||
DebugOut("amkUI_TArrayAdapter_String__clear_2");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_ArrayAdapter_String_ = (ArrayAdapter<String>) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
//
|
|
||||||
param_self_ArrayAdapter_String_.clear();
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
// method void insert(String aobject, int aindex)
|
|
||||||
case amkUI_TArrayAdapter_String__insert_3:
|
|
||||||
DebugOut("amkUI_TArrayAdapter_String__insert_3");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_ArrayAdapter_String_ = (ArrayAdapter<String>) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lString_1 = (String) MyJavaLang.LangElements.get(lInt);
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lint_2 = lInt;
|
|
||||||
//
|
|
||||||
param_self_ArrayAdapter_String_.insert(lString_1, lint_2);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
// method void remove(String aobject)
|
|
||||||
case amkUI_TArrayAdapter_String__remove_4:
|
|
||||||
DebugOut("amkUI_TArrayAdapter_String__remove_4");
|
|
||||||
// Self
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
param_self_ArrayAdapter_String_ = (ArrayAdapter<String>) ViewElements.get(lInt);
|
|
||||||
// params
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
lString_1 = (String) MyJavaLang.LangElements.get(lInt);
|
|
||||||
//
|
|
||||||
param_self_ArrayAdapter_String_.remove(lString_1);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
package com.pascal.androidlcl;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.os.*;
|
|
||||||
import android.util.*;
|
|
||||||
import android.content.*;
|
|
||||||
import android.view.*;
|
|
||||||
import android.widget.*;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class AndroidApp
|
|
||||||
{
|
|
||||||
// info from other classes
|
|
||||||
Activity activity;
|
|
||||||
AndroidPipesComm MyAndroidPipesComm;
|
|
||||||
JavaLang MyJavaLang;
|
|
||||||
AndroidAll MyAndroidAll;
|
|
||||||
|
|
||||||
// lists of variables
|
|
||||||
ArrayList ViewElements;
|
|
||||||
|
|
||||||
//
|
|
||||||
// android.app.*
|
|
||||||
static final int amkUI_Activity_setContentView = 0x0000;
|
|
||||||
static final int amkUI_Activity_getWindowManager = 0x0080;
|
|
||||||
|
|
||||||
public AndroidApp(AndroidPipesComm AAndroidPipesComm, Activity AActivity, JavaLang AJavaLang, AndroidAll AAndroidAll)
|
|
||||||
{
|
|
||||||
activity = AActivity;
|
|
||||||
MyAndroidPipesComm = AAndroidPipesComm;
|
|
||||||
MyJavaLang = AJavaLang;
|
|
||||||
MyAndroidAll = AAndroidAll;
|
|
||||||
ViewElements = AAndroidAll.ViewElements;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DebugOut(String Str)
|
|
||||||
{
|
|
||||||
MyAndroidPipesComm.DebugOut(Str);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean ProcessCommand(int Buffer)
|
|
||||||
{
|
|
||||||
//DebugOut("AndroidUI.ProcessCommand");
|
|
||||||
//DebugOut("AndroidUI.ProcessCommand Command=" + java.lang.Integer.toHexString(Buffer));
|
|
||||||
|
|
||||||
int lInt, lIndex, lPascalPointer;
|
|
||||||
Integer lTag;
|
|
||||||
TextView lTextView;
|
|
||||||
CharSequence lChars;
|
|
||||||
//
|
|
||||||
WindowManager param_self_WindowManager;
|
|
||||||
//
|
|
||||||
|
|
||||||
switch (Buffer)
|
|
||||||
{
|
|
||||||
// android.app.Activity
|
|
||||||
// public void setContentView (View view)
|
|
||||||
case amkUI_Activity_setContentView:
|
|
||||||
DebugOut("amkUI_Activity_setContentView");
|
|
||||||
lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
View lView = (View) ViewElements.get(lInt);
|
|
||||||
activity.setContentView(lView);
|
|
||||||
MyAndroidPipesComm.SendResult();
|
|
||||||
break;
|
|
||||||
/* case amkUI_Activity_getWindowManager:
|
|
||||||
DebugOut("amkUI_Activity_getWindowManager");
|
|
||||||
WindowManagerElements.add(activity.getWindowManager());
|
|
||||||
MyAndroidPipesComm.SendIntResult(WindowManagerElements.size() - 1);
|
|
||||||
break;*/
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,273 +0,0 @@
|
|||||||
package com.pascal.androidlcl;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.os.*;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.content.*;
|
|
||||||
import android.view.*;
|
|
||||||
import android.widget.*;
|
|
||||||
import java.io.*;
|
|
||||||
|
|
||||||
public class AndroidLCLTest extends Activity
|
|
||||||
{
|
|
||||||
AndroidPipesComm MyAndroidPipesComm;
|
|
||||||
String ExecutablePath;
|
|
||||||
// Debug
|
|
||||||
boolean DEBUG_PASCAL4ANDROID = true;
|
|
||||||
|
|
||||||
// Android Message subtype
|
|
||||||
static int ams_ActivityCallback_onCreateStarted = 0x0001;
|
|
||||||
static int ams_ActivityCallback_onStartStarted = 0x0002;
|
|
||||||
static int ams_ActivityCallback_onRestartStarted = 0x0003;
|
|
||||||
static int ams_ActivityCallback_onResumeStarted = 0x0004;
|
|
||||||
static int ams_ActivityCallback_onPauseStarted = 0x0005;
|
|
||||||
static int ams_ActivityCallback_onStopStarted = 0x0006;
|
|
||||||
static int ams_ActivityCallback_onDestroyStarted = 0x0007;
|
|
||||||
static int ams_ActivityCallback_onCreateOptionsMenuStarted = 0x0008;
|
|
||||||
static int ams_ActivityCallback_onKeyUpStarted = 0x0010;
|
|
||||||
|
|
||||||
static int ams_ActivityCallback_onCreateFinished = 0x1001;
|
|
||||||
static int ams_ActivityCallback_onStartFinished = 0x1002;
|
|
||||||
static int ams_ActivityCallback_onRestartFinished = 0x1003;
|
|
||||||
static int ams_ActivityCallback_onResumeFinished = 0x1004;
|
|
||||||
static int ams_ActivityCallback_onPauseFinished = 0x1005;
|
|
||||||
static int ams_ActivityCallback_onStopFinished = 0x1006;
|
|
||||||
static int ams_ActivityCallback_onDestroyFinished = 0x1007;
|
|
||||||
static int ams_ActivityCallback_onCreateOptionsMenuFinished = 0x1008;
|
|
||||||
static int ams_ActivityCallback_onKeyUpFinished = 0x1010;
|
|
||||||
|
|
||||||
Button.OnClickListener buttonClickCallback = new Button.OnClickListener()
|
|
||||||
{
|
|
||||||
public void onClick(View v)
|
|
||||||
{
|
|
||||||
MyAndroidPipesComm.DebugOut("Click!");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Called when the activity is first created. */
|
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle savedInstanceState)
|
|
||||||
{
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
MyAndroidPipesComm = new AndroidPipesComm(this);
|
|
||||||
|
|
||||||
// Prepare the application
|
|
||||||
ExecutablePath = getApplicationContext().getFilesDir() + "/androidlcltest";
|
|
||||||
|
|
||||||
String LibraryPathPath = "/data/data/com.pascal.androidlcl/lib/libandroidlcltest.so";
|
|
||||||
|
|
||||||
MyAndroidPipesComm.DebugOut("Executing application " + LibraryPathPath + " copied to " + ExecutablePath);
|
|
||||||
|
|
||||||
String Str = FileCopy(LibraryPathPath, ExecutablePath);
|
|
||||||
|
|
||||||
String Str2 = RunProgram("/system/bin/chmod", "755", ExecutablePath);
|
|
||||||
|
|
||||||
// Run the application
|
|
||||||
RunPascalProgram(ExecutablePath);
|
|
||||||
|
|
||||||
// Waits until the Pascal side finishes its initialization
|
|
||||||
MyAndroidPipesComm.DebugOut("WaitForPascalMessage(amkActivityCallback, ams_ActivityCallback_onCreateFinished)");
|
|
||||||
MyAndroidPipesComm.WaitForPascalMessage(MyAndroidPipesComm.amkActivityCallback, ams_ActivityCallback_onCreateFinished);
|
|
||||||
MyAndroidPipesComm.DebugOut("END onCreate");
|
|
||||||
}
|
|
||||||
|
|
||||||
/** */
|
|
||||||
@Override
|
|
||||||
protected void onStart()
|
|
||||||
{
|
|
||||||
MyAndroidPipesComm.DebugOut("START onStart");
|
|
||||||
super.onStart();
|
|
||||||
MyAndroidPipesComm.SendMessage(MyAndroidPipesComm.amkActivityCallback, ams_ActivityCallback_onStartStarted);
|
|
||||||
MyAndroidPipesComm.WaitForPascalMessage(MyAndroidPipesComm.amkActivityCallback, ams_ActivityCallback_onStartFinished);
|
|
||||||
MyAndroidPipesComm.DebugOut("END onStart");
|
|
||||||
}
|
|
||||||
|
|
||||||
/** */
|
|
||||||
@Override
|
|
||||||
protected void onRestart()
|
|
||||||
{
|
|
||||||
MyAndroidPipesComm.DebugOut("START onRestart");
|
|
||||||
super.onRestart();
|
|
||||||
MyAndroidPipesComm.SendMessage(MyAndroidPipesComm.amkActivityCallback, ams_ActivityCallback_onRestartStarted);
|
|
||||||
MyAndroidPipesComm.WaitForPascalMessage(MyAndroidPipesComm.amkActivityCallback, ams_ActivityCallback_onRestartFinished);
|
|
||||||
MyAndroidPipesComm.DebugOut("END onRestart");
|
|
||||||
}
|
|
||||||
|
|
||||||
/** */
|
|
||||||
@Override
|
|
||||||
protected void onResume()
|
|
||||||
{
|
|
||||||
MyAndroidPipesComm.DebugOut("START onResume");
|
|
||||||
super.onResume();
|
|
||||||
MyAndroidPipesComm.SendMessage(MyAndroidPipesComm.amkActivityCallback, ams_ActivityCallback_onResumeStarted);
|
|
||||||
MyAndroidPipesComm.WaitForPascalMessage(MyAndroidPipesComm.amkActivityCallback, ams_ActivityCallback_onResumeFinished);
|
|
||||||
MyAndroidPipesComm.DebugOut("END onResume");
|
|
||||||
}
|
|
||||||
|
|
||||||
/** */
|
|
||||||
@Override
|
|
||||||
protected void onPause()
|
|
||||||
{
|
|
||||||
MyAndroidPipesComm.DebugOut("START onPause");
|
|
||||||
super.onPause();
|
|
||||||
MyAndroidPipesComm.SendMessage(MyAndroidPipesComm.amkActivityCallback, ams_ActivityCallback_onPauseStarted);
|
|
||||||
MyAndroidPipesComm.WaitForPascalMessage(MyAndroidPipesComm.amkActivityCallback, ams_ActivityCallback_onPauseFinished);
|
|
||||||
MyAndroidPipesComm.DebugOut("END onPause");
|
|
||||||
}
|
|
||||||
|
|
||||||
/** */
|
|
||||||
@Override
|
|
||||||
protected void onStop()
|
|
||||||
{
|
|
||||||
MyAndroidPipesComm.DebugOut("START onStop");
|
|
||||||
super.onStop();
|
|
||||||
MyAndroidPipesComm.SendMessage(MyAndroidPipesComm.amkActivityCallback, ams_ActivityCallback_onStopStarted);
|
|
||||||
MyAndroidPipesComm.WaitForPascalMessage(MyAndroidPipesComm.amkActivityCallback, ams_ActivityCallback_onStopFinished);
|
|
||||||
MyAndroidPipesComm.DebugOut("END onStop");
|
|
||||||
}
|
|
||||||
|
|
||||||
/** */
|
|
||||||
@Override
|
|
||||||
protected void onDestroy()
|
|
||||||
{
|
|
||||||
MyAndroidPipesComm.DebugOut("START onDestroy");
|
|
||||||
super.onDestroy();
|
|
||||||
MyAndroidPipesComm.SendMessage(MyAndroidPipesComm.amkActivityCallback, ams_ActivityCallback_onStartStarted);
|
|
||||||
MyAndroidPipesComm.WaitForPascalMessage(MyAndroidPipesComm.amkActivityCallback, ams_ActivityCallback_onStartFinished);
|
|
||||||
MyAndroidPipesComm.DebugOut("END onDestroy");
|
|
||||||
}
|
|
||||||
|
|
||||||
// public boolean onCreateOptionsMenu (Menu menu)
|
|
||||||
/*@Override
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu)
|
|
||||||
{
|
|
||||||
if (DEBUG_PASCAL4ANDROID == true) MyAndroidPipesComm.DebugOut("START onCreateOptionsMenu");
|
|
||||||
MyAndroidPipesComm.SendMessage(MyAndroidPipesComm.amkActivityCallback, ams_ActivityCallback_onCreateOptionsMenuStarted);
|
|
||||||
MyAndroidPipesComm.MyAndroidMenu.MenuElements.add(menu);
|
|
||||||
int lMenuIndex = MyAndroidPipesComm.MyAndroidMenu.MenuElements.size() - 1;
|
|
||||||
MyAndroidPipesComm.SendInt(lMenuIndex);
|
|
||||||
MyAndroidPipesComm.WaitForPascalMessage(MyAndroidPipesComm.amkActivityCallback, ams_ActivityCallback_onCreateOptionsMenuFinished);
|
|
||||||
int lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
// ToDo: If we start supporting object deletion then we need to use indexOf to get the new index
|
|
||||||
MyAndroidPipesComm.MyAndroidMenu.MenuElements.remove(lMenuIndex);
|
|
||||||
if (DEBUG_PASCAL4ANDROID == true) MyAndroidPipesComm.DebugOut("END onCreateOptionsMenu");
|
|
||||||
return (lInt != 0);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// generic Key Listener
|
|
||||||
@Override
|
|
||||||
public boolean onKeyUp(int keyCode, KeyEvent event)
|
|
||||||
{
|
|
||||||
if (DEBUG_PASCAL4ANDROID == true) MyAndroidPipesComm.DebugOut("START onKeyUp");
|
|
||||||
MyAndroidPipesComm.SendMessage(MyAndroidPipesComm.amkActivityCallback, ams_ActivityCallback_onKeyUpStarted);
|
|
||||||
MyAndroidPipesComm.SendInt(keyCode);
|
|
||||||
// ToDo: Also send the KeyEvent
|
|
||||||
//MyAndroidPipesComm.MyAndroidMenu.MenuElements.add(menu);
|
|
||||||
//int lMenuIndex = MyAndroidPipesComm.MyAndroidMenu.MenuElements.size() - 1;
|
|
||||||
MyAndroidPipesComm.WaitForPascalMessage(MyAndroidPipesComm.amkActivityCallback, ams_ActivityCallback_onKeyUpFinished);
|
|
||||||
int lInt = MyAndroidPipesComm.GetInt();
|
|
||||||
if (DEBUG_PASCAL4ANDROID == true) MyAndroidPipesComm.DebugOut("END onCreateOptionsMenu");
|
|
||||||
if (lInt != 0) return true;
|
|
||||||
return super.onKeyUp(keyCode, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
private static String FileCopy(String srFile, String dtFile)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
File f1 = new File(srFile);
|
|
||||||
File f2 = new File(dtFile);
|
|
||||||
InputStream in = new FileInputStream(f1);
|
|
||||||
|
|
||||||
//For Overwrite the file.
|
|
||||||
OutputStream out = new FileOutputStream(f2, true);
|
|
||||||
|
|
||||||
byte[] buf = new byte[1024];
|
|
||||||
int len;
|
|
||||||
while ((len = in.read(buf)) > 0){
|
|
||||||
out.write(buf, 0, len);
|
|
||||||
}
|
|
||||||
in.close();
|
|
||||||
out.close();
|
|
||||||
|
|
||||||
return "Success dest=" + dtFile;
|
|
||||||
}
|
|
||||||
catch(FileNotFoundException e)
|
|
||||||
{
|
|
||||||
return "Error=FileNotFoundException=" + e.getMessage();
|
|
||||||
}
|
|
||||||
catch(IOException e)
|
|
||||||
{
|
|
||||||
return "Error=IOException=" + e.getMessage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Simple method for running external applications.
|
|
||||||
It waits until the program finishes running.
|
|
||||||
it uses Runtime.getRuntime()
|
|
||||||
*/
|
|
||||||
public String RunProgram(String cmd, String param1, String param2)
|
|
||||||
{
|
|
||||||
String output = "";
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (param1 == null) param1 = "";
|
|
||||||
if (param2 == null) param2 = "";
|
|
||||||
|
|
||||||
// Runs the application
|
|
||||||
java.lang.Process process = Runtime.getRuntime().exec(cmd + " " + param1 + " " + param2);
|
|
||||||
|
|
||||||
// Now connects pipes to it
|
|
||||||
DataInputStream reader = new DataInputStream(process.getInputStream());
|
|
||||||
|
|
||||||
// Waits until it finishes
|
|
||||||
process.waitFor();
|
|
||||||
|
|
||||||
// And stores the result of the pipes in the result of the function
|
|
||||||
String line;
|
|
||||||
String separator = System.getProperty("line.separator");
|
|
||||||
while ((line = reader.readLine()) != null)
|
|
||||||
{
|
|
||||||
output += line + separator;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
output += "error=IOException=" + e.getMessage();
|
|
||||||
}
|
|
||||||
catch (InterruptedException e)
|
|
||||||
{
|
|
||||||
output += "error=InterruptedException=" + e.getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
This function will run a Pascal program and interact with it via pipes
|
|
||||||
Uses Runtime.getRuntime()
|
|
||||||
*/
|
|
||||||
public void RunPascalProgram(String cmd)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Runs the application
|
|
||||||
MyAndroidPipesComm.PascalProcess = Runtime.getRuntime().exec(cmd);
|
|
||||||
|
|
||||||
// Now connects pipes to it
|
|
||||||
MyAndroidPipesComm.writer = new DataOutputStream(
|
|
||||||
MyAndroidPipesComm.PascalProcess.getOutputStream());
|
|
||||||
MyAndroidPipesComm.reader = new DataInputStream(
|
|
||||||
MyAndroidPipesComm.PascalProcess.getInputStream());
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
MyAndroidPipesComm.DebugOut("error=IOException=" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,353 +0,0 @@
|
|||||||
package com.pascal.androidlcl;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.os.*;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.content.*;
|
|
||||||
import android.view.*;
|
|
||||||
import android.widget.*;
|
|
||||||
import java.io.*;
|
|
||||||
|
|
||||||
public class AndroidPipesComm
|
|
||||||
{
|
|
||||||
// info from other classes
|
|
||||||
Activity activity;
|
|
||||||
|
|
||||||
// Data pool accessed by many methods
|
|
||||||
java.lang.Process PascalProcess;
|
|
||||||
DataOutputStream writer;
|
|
||||||
DataInputStream reader;
|
|
||||||
// Data pool to solve the lack of passing parameter by reference
|
|
||||||
byte lType = 0;
|
|
||||||
int lSubtype = 0;
|
|
||||||
|
|
||||||
// Android Message Kind
|
|
||||||
static byte amkStringResult = 14;
|
|
||||||
static byte amkFloatResult = 13;
|
|
||||||
static byte amkIntResult = 12;
|
|
||||||
static byte amkResult = 11;
|
|
||||||
static byte amkActivityCallback = 0;
|
|
||||||
static byte amkLog = 1;
|
|
||||||
static byte amkUICommand = 2;
|
|
||||||
static byte amkJavaLangCall = 3;
|
|
||||||
static byte amkTimer = 4;
|
|
||||||
|
|
||||||
// Add / remove modules here
|
|
||||||
public JavaLang MyJavaLang;
|
|
||||||
public AndroidAll MyAndroidAll;
|
|
||||||
public AndroidApp MyAndroidApp;
|
|
||||||
|
|
||||||
public AndroidPipesComm(Activity AActivity)
|
|
||||||
{
|
|
||||||
activity = AActivity;
|
|
||||||
MyJavaLang = new JavaLang(this);
|
|
||||||
MyAndroidAll = new AndroidAll(this, activity, MyJavaLang);
|
|
||||||
MyAndroidApp = new AndroidApp(this, activity, MyJavaLang, MyAndroidAll);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DebugOut(String Str)
|
|
||||||
{
|
|
||||||
Log.v("AndroidPipesComm:", Str);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ErrorOut(String Str)
|
|
||||||
{
|
|
||||||
Log.v("AndroidPipesComm:", Str);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void TerminateApplication()
|
|
||||||
{
|
|
||||||
System.exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PrintPascalException(byte Buffer)
|
|
||||||
{
|
|
||||||
String PascalMessage = "" + (char) Buffer;
|
|
||||||
byte curChar;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
curChar = reader.readByte();
|
|
||||||
// Output line by line
|
|
||||||
if (curChar == 0x10)
|
|
||||||
{
|
|
||||||
ErrorOut(PascalMessage);
|
|
||||||
PascalMessage = "";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PascalMessage = PascalMessage + (char) curChar;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
ErrorOut("[PrintPascalException] Exception while obtaining the Pascal Exception, printing the rest of the buffer");
|
|
||||||
ErrorOut(PascalMessage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Waits for a particular Pascal message.
|
|
||||||
// In the mean time processes any other incoming messages
|
|
||||||
public void WaitForPascalMessage(byte AExpectedMessageType, int AExpectedMessageSubtype)
|
|
||||||
{
|
|
||||||
DebugOut("START WaitForPascalMessage AExpectedMessageType=" + AExpectedMessageType
|
|
||||||
+ " AExpectedMessageSubtype=" + java.lang.Integer.toHexString(AExpectedMessageSubtype));
|
|
||||||
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
WaitAndProcessPascalMessage();
|
|
||||||
//DebugOut("MID_END WaitForPascalMessage lType=" + lType + " lSubtype=" + java.lang.Integer.toHexString(lSubtype));
|
|
||||||
if ((lType == AExpectedMessageType) && (lSubtype == AExpectedMessageSubtype)) return;
|
|
||||||
if ((lType == amkActivityCallback) && (AExpectedMessageType == amkActivityCallback)) return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Waits for and processes a Pascal message
|
|
||||||
public void WaitAndProcessPascalMessage()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//DebugOut("WaitAndProcessPascalMessage");
|
|
||||||
byte Buffer = reader.readByte(); // blocking read
|
|
||||||
lType = Buffer;
|
|
||||||
lSubtype = 0;
|
|
||||||
|
|
||||||
if (Buffer == amkActivityCallback)
|
|
||||||
{
|
|
||||||
DebugOut("amkActivityCallback");
|
|
||||||
// lSubtype = reader.readInt(); // blocking read
|
|
||||||
}
|
|
||||||
else if (Buffer == amkLog)
|
|
||||||
{
|
|
||||||
DebugOut("amkLog");
|
|
||||||
char[] lChars = GetString();
|
|
||||||
DebugOut(new String(lChars));
|
|
||||||
}
|
|
||||||
else if (Buffer == amkUICommand)
|
|
||||||
{
|
|
||||||
DebugOut("amkUICommand");
|
|
||||||
lSubtype = reader.readInt(); // blocking read
|
|
||||||
if (MyAndroidAll.ProcessCommand(lSubtype) == true) ;
|
|
||||||
else if (MyAndroidApp.ProcessCommand(lSubtype) == true) ;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ErrorOut("Unknown UI Command!!! This is normal in the end of a callback" + java.lang.Integer.toHexString(lSubtype));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else if (Buffer == amkJavaLangCall)
|
|
||||||
{
|
|
||||||
DebugOut("amkJavaLangCall");
|
|
||||||
lSubtype = reader.readInt(); // blocking read
|
|
||||||
MyJavaLang.ProcessCommand(lSubtype);
|
|
||||||
}
|
|
||||||
// else if (Buffer == amkTimer)
|
|
||||||
// {
|
|
||||||
// DebugOut("amkTimer");
|
|
||||||
// lSubtype = reader.readInt(); // blocking read
|
|
||||||
// MyAndroidTimer.ProcessCommand(lSubtype);
|
|
||||||
// }
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ErrorOut("[WaitAndProcessPascalMessage] Unknown Pascal message!!! " + java.lang.Integer.toHexString(Buffer));
|
|
||||||
|
|
||||||
// If we get an Unknown Pascal message, it might be an error printed to the console, so lets print it and quit
|
|
||||||
PrintPascalException(Buffer);
|
|
||||||
TerminateApplication();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (EOFException e)
|
|
||||||
{
|
|
||||||
ErrorOut("[WaitAndProcessPascalMessage] EOFException=" + e.getMessage());
|
|
||||||
TerminateApplication();
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
ErrorOut("[WaitAndProcessPascalMessage] IOException=" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Receiving data
|
|
||||||
|
|
||||||
public byte GetByte()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return reader.readByte();
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
ErrorOut("[GetByte] IOException=" + e.getMessage());
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int GetInt()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return reader.readInt();
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
ErrorOut("[GetInt] IOException=" + e.getMessage());
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean GetBool()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int Tmp = reader.readInt();
|
|
||||||
if (Tmp == 0) return false;
|
|
||||||
else return true;
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
ErrorOut("[GetBool] IOException=" + e.getMessage());
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float GetFloat()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return reader.readFloat();
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
ErrorOut("[GetFloat] IOException=" + e.getMessage());
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public char[] GetString()
|
|
||||||
{
|
|
||||||
char[] lChars;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int lInt = reader.readInt(); // Length
|
|
||||||
lChars = new char[lInt];
|
|
||||||
for (int i = 0; i < lInt; i++)
|
|
||||||
{
|
|
||||||
lChars[i] = (char) reader.readByte();
|
|
||||||
}
|
|
||||||
return lChars;
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
ErrorOut("[GetString] IOException=" + e.getMessage());
|
|
||||||
}
|
|
||||||
return new char[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sending results
|
|
||||||
|
|
||||||
public void SendResult()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
writer.writeByte(amkResult);
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
ErrorOut("[SendResult] IOException=" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SendIntResult(int Result)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
writer.writeByte(amkIntResult);
|
|
||||||
writer.writeInt(Result);
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
ErrorOut("[SendIntResult] IOException=" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SendFloatResult(float Result)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
writer.writeByte(amkFloatResult);
|
|
||||||
writer.writeFloat(Result);
|
|
||||||
// writer.writeInt(Float.floatToIntBits(Result));
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
ErrorOut("[SendFloatResult] IOException=" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SendStringResult(CharSequence Result)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
writer.writeByte(amkStringResult);
|
|
||||||
int lInt = Result.length();
|
|
||||||
writer.writeInt(lInt); // Length
|
|
||||||
for (int i = 0; i < lInt; i++)
|
|
||||||
{
|
|
||||||
writer.writeByte(Result.charAt(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
ErrorOut("[SendStringResult] IOException=" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sending data
|
|
||||||
|
|
||||||
// Convenience routine, uses SendIntResult
|
|
||||||
public void SendBoolResult(boolean Result)
|
|
||||||
{
|
|
||||||
if (Result == false) SendIntResult(0);
|
|
||||||
else SendIntResult(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SendInt(int AData)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
writer.writeInt(AData);
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
ErrorOut("[SendBoolResult] IOException=" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SendMessage(byte AMessageKind, int AMessageSubtype)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
writer.writeByte(AMessageKind);
|
|
||||||
writer.writeInt(AMessageSubtype);
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
ErrorOut("[SendMessage] IOException=" + e.getMessage());
|
|
||||||
TerminateApplication();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// String separator = System.getProperty("line.separator");
|
|
||||||
/* // Displays a dialog with the result of the operation
|
|
||||||
AlertDialog alertDialog;
|
|
||||||
alertDialog = new AlertDialog.Builder(this).create();
|
|
||||||
alertDialog.setTitle("Result of cp");
|
|
||||||
alertDialog.setMessage(Str + "||" + Str2 + "||" + Str3);
|
|
||||||
alertDialog.show();*/
|
|
||||||
// Waits until it finishes
|
|
||||||
// process.waitFor();
|
|
||||||
// Thread.currentThread().sleep(1000);
|
|
||||||
}
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
|||||||
package com.pascal.androidlcl;
|
|
||||||
|
|
||||||
import java.lang.*;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class JavaLang
|
|
||||||
{
|
|
||||||
// info from other classes
|
|
||||||
AndroidPipesComm MyAndroidPipesComm;
|
|
||||||
|
|
||||||
// lists of variables
|
|
||||||
ArrayList LangElements = new ArrayList();
|
|
||||||
|
|
||||||
//
|
|
||||||
static final int amkJavaLang_New_String = 0x0000;
|
|
||||||
|
|
||||||
public JavaLang(AndroidPipesComm AAndroidPipesComm)
|
|
||||||
{
|
|
||||||
MyAndroidPipesComm = AAndroidPipesComm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DebugOut(String Str)
|
|
||||||
{
|
|
||||||
MyAndroidPipesComm.DebugOut(Str);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ProcessCommand(int Buffer)
|
|
||||||
{
|
|
||||||
// DebugOut("<before readByte>");
|
|
||||||
int lInt;
|
|
||||||
|
|
||||||
switch (Buffer)
|
|
||||||
{
|
|
||||||
// java.lang.String
|
|
||||||
// String(char[] data)
|
|
||||||
case amkJavaLang_New_String:
|
|
||||||
DebugOut("amkJavaLang_New_String");
|
|
||||||
lInt = MyAndroidPipesComm.GetInt(); // Length
|
|
||||||
char[] lChars = new char[lInt];
|
|
||||||
for (int i = 0; i < lInt; i++)
|
|
||||||
{
|
|
||||||
lChars[i] = (char) MyAndroidPipesComm.GetByte();
|
|
||||||
}
|
|
||||||
LangElements.add(new String(lChars));
|
|
||||||
MyAndroidPipesComm.SendIntResult(LangElements.size() - 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 134 KiB |
@ -1,190 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<CONFIG>
|
|
||||||
<ProjectOptions>
|
|
||||||
<Version Value="9"/>
|
|
||||||
<General>
|
|
||||||
<SessionStorage Value="InProjectDir"/>
|
|
||||||
<MainUnit Value="0"/>
|
|
||||||
<UseXPManifest Value="True"/>
|
|
||||||
<Icon Value="0"/>
|
|
||||||
</General>
|
|
||||||
<i18n>
|
|
||||||
<EnableI18N LFM="False"/>
|
|
||||||
</i18n>
|
|
||||||
<VersionInfo>
|
|
||||||
<StringTable ProductVersion=""/>
|
|
||||||
</VersionInfo>
|
|
||||||
<MacroValues Count="1">
|
|
||||||
<Macro1 Name="LCLWidgetType" Value="android"/>
|
|
||||||
</MacroValues>
|
|
||||||
<BuildModes Count="4">
|
|
||||||
<Item1 Name="Android" Default="True"/>
|
|
||||||
<Item2 Name="Desktop">
|
|
||||||
<MacroValues Count="1">
|
|
||||||
<Macro1 Name="LCLWidgetType" Value="gtk2"/>
|
|
||||||
</MacroValues>
|
|
||||||
<CompilerOptions>
|
|
||||||
<Version Value="10"/>
|
|
||||||
<Target>
|
|
||||||
<Filename Value="androidlcltest"/>
|
|
||||||
</Target>
|
|
||||||
<SearchPaths>
|
|
||||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
|
||||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
|
||||||
</SearchPaths>
|
|
||||||
<Linking>
|
|
||||||
<Options>
|
|
||||||
<Win32>
|
|
||||||
<GraphicApplication Value="True"/>
|
|
||||||
</Win32>
|
|
||||||
</Options>
|
|
||||||
</Linking>
|
|
||||||
<Other>
|
|
||||||
<CompilerMessages>
|
|
||||||
<UseMsgFile Value="True"/>
|
|
||||||
</CompilerMessages>
|
|
||||||
<CompilerPath Value="$(CompPath)"/>
|
|
||||||
</Other>
|
|
||||||
</CompilerOptions>
|
|
||||||
</Item2>
|
|
||||||
<Item3 Name="Android-Desktop">
|
|
||||||
<MacroValues Count="1">
|
|
||||||
<Macro1 Name="LCLWidgetType" Value="android"/>
|
|
||||||
</MacroValues>
|
|
||||||
<CompilerOptions>
|
|
||||||
<Version Value="10"/>
|
|
||||||
<Target>
|
|
||||||
<Filename Value="androidlcltest"/>
|
|
||||||
</Target>
|
|
||||||
<SearchPaths>
|
|
||||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
|
||||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
|
||||||
</SearchPaths>
|
|
||||||
<Linking>
|
|
||||||
<Options>
|
|
||||||
<Win32>
|
|
||||||
<GraphicApplication Value="True"/>
|
|
||||||
</Win32>
|
|
||||||
</Options>
|
|
||||||
</Linking>
|
|
||||||
<Other>
|
|
||||||
<CompilerMessages>
|
|
||||||
<UseMsgFile Value="True"/>
|
|
||||||
</CompilerMessages>
|
|
||||||
<CompilerPath Value="$(CompPath)"/>
|
|
||||||
</Other>
|
|
||||||
</CompilerOptions>
|
|
||||||
</Item3>
|
|
||||||
<Item4 Name="Android-Debug">
|
|
||||||
<MacroValues Count="1">
|
|
||||||
<Macro1 Name="LCLWidgetType" Value="android"/>
|
|
||||||
</MacroValues>
|
|
||||||
<CompilerOptions>
|
|
||||||
<Version Value="10"/>
|
|
||||||
<Target>
|
|
||||||
<Filename Value="android/libs/armeabi/libandroidlcltest.so"/>
|
|
||||||
</Target>
|
|
||||||
<SearchPaths>
|
|
||||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
|
||||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
|
||||||
</SearchPaths>
|
|
||||||
<CodeGeneration>
|
|
||||||
<TargetCPU Value="arm"/>
|
|
||||||
<TargetOS Value="linux"/>
|
|
||||||
</CodeGeneration>
|
|
||||||
<Linking>
|
|
||||||
<Debugging>
|
|
||||||
<GenerateDebugInfo Value="True"/>
|
|
||||||
<GenerateDwarf Value="True"/>
|
|
||||||
</Debugging>
|
|
||||||
<Options>
|
|
||||||
<Win32>
|
|
||||||
<GraphicApplication Value="True"/>
|
|
||||||
</Win32>
|
|
||||||
</Options>
|
|
||||||
</Linking>
|
|
||||||
<Other>
|
|
||||||
<CompilerMessages>
|
|
||||||
<UseMsgFile Value="True"/>
|
|
||||||
</CompilerMessages>
|
|
||||||
<CompilerPath Value="$(CompPath)"/>
|
|
||||||
</Other>
|
|
||||||
</CompilerOptions>
|
|
||||||
</Item4>
|
|
||||||
</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"/>
|
|
||||||
<LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
|
||||||
</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="Form2"/>
|
|
||||||
<ResourceBaseClass Value="Form"/>
|
|
||||||
<UnitName Value="mainform"/>
|
|
||||||
</Unit1>
|
|
||||||
</Units>
|
|
||||||
</ProjectOptions>
|
|
||||||
<CompilerOptions>
|
|
||||||
<Version Value="10"/>
|
|
||||||
<Target>
|
|
||||||
<Filename Value="android/libs/armeabi/libandroidlcltest.so"/>
|
|
||||||
</Target>
|
|
||||||
<SearchPaths>
|
|
||||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
|
||||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
|
||||||
</SearchPaths>
|
|
||||||
<CodeGeneration>
|
|
||||||
<TargetCPU Value="arm"/>
|
|
||||||
<TargetOS Value="linux"/>
|
|
||||||
</CodeGeneration>
|
|
||||||
<Linking>
|
|
||||||
<Debugging>
|
|
||||||
<UseLineInfoUnit Value="False"/>
|
|
||||||
<StripSymbols Value="True"/>
|
|
||||||
</Debugging>
|
|
||||||
<Options>
|
|
||||||
<Win32>
|
|
||||||
<GraphicApplication Value="True"/>
|
|
||||||
</Win32>
|
|
||||||
</Options>
|
|
||||||
</Linking>
|
|
||||||
<Other>
|
|
||||||
<CompilerMessages>
|
|
||||||
<UseMsgFile Value="True"/>
|
|
||||||
</CompilerMessages>
|
|
||||||
<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>
|
|
@ -1,20 +0,0 @@
|
|||||||
program androidlcltest;
|
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
|
||||||
|
|
||||||
uses
|
|
||||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
|
||||||
cthreads,
|
|
||||||
{$ENDIF}{$ENDIF}
|
|
||||||
Interfaces, // this includes the LCL widgetset
|
|
||||||
Forms, mainform
|
|
||||||
{ you can add units after this };
|
|
||||||
|
|
||||||
//{$R *.res}
|
|
||||||
|
|
||||||
begin
|
|
||||||
Application.Initialize;
|
|
||||||
Application.CreateForm(TForm2, Form2);
|
|
||||||
Application.Run;
|
|
||||||
end.
|
|
||||||
|
|
Binary file not shown.
@ -1,74 +0,0 @@
|
|||||||
object Form2: TForm2
|
|
||||||
Left = 181
|
|
||||||
Height = 276
|
|
||||||
Top = 137
|
|
||||||
Width = 320
|
|
||||||
Caption = 'Form2'
|
|
||||||
ClientHeight = 276
|
|
||||||
ClientWidth = 320
|
|
||||||
LCLVersion = '0.9.31'
|
|
||||||
object Button1: TButton
|
|
||||||
Left = 33
|
|
||||||
Height = 25
|
|
||||||
Top = 48
|
|
||||||
Width = 87
|
|
||||||
Caption = 'Button1'
|
|
||||||
OnClick = Button1Click
|
|
||||||
TabOrder = 0
|
|
||||||
end
|
|
||||||
object CheckBox1: TCheckBox
|
|
||||||
Left = 33
|
|
||||||
Height = 21
|
|
||||||
Top = 101
|
|
||||||
Width = 94
|
|
||||||
Caption = 'CheckBox1'
|
|
||||||
TabOrder = 1
|
|
||||||
end
|
|
||||||
object Edit1: TEdit
|
|
||||||
Left = 33
|
|
||||||
Height = 25
|
|
||||||
Top = 157
|
|
||||||
Width = 99
|
|
||||||
TabOrder = 2
|
|
||||||
Text = 'Edit1'
|
|
||||||
end
|
|
||||||
object StaticText1: TStaticText
|
|
||||||
Left = 147
|
|
||||||
Height = 17
|
|
||||||
Top = 49
|
|
||||||
Width = 65
|
|
||||||
Caption = 'StaticText1'
|
|
||||||
TabOrder = 3
|
|
||||||
end
|
|
||||||
object ComboBox1: TComboBox
|
|
||||||
Left = 136
|
|
||||||
Height = 27
|
|
||||||
Top = 101
|
|
||||||
Width = 112
|
|
||||||
ItemHeight = 0
|
|
||||||
Items.Strings = (
|
|
||||||
'Item1'
|
|
||||||
'Item2'
|
|
||||||
'Item3'
|
|
||||||
)
|
|
||||||
TabOrder = 4
|
|
||||||
Text = 'ComboBox1'
|
|
||||||
end
|
|
||||||
object Edit2: TEdit
|
|
||||||
Left = 147
|
|
||||||
Height = 25
|
|
||||||
Top = 157
|
|
||||||
Width = 80
|
|
||||||
TabOrder = 5
|
|
||||||
Text = 'Edit2'
|
|
||||||
end
|
|
||||||
object Button2: TButton
|
|
||||||
Left = 35
|
|
||||||
Height = 25
|
|
||||||
Top = 199
|
|
||||||
Width = 75
|
|
||||||
Caption = 'InputBox'
|
|
||||||
OnClick = Button2Click
|
|
||||||
TabOrder = 6
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,74 +0,0 @@
|
|||||||
unit mainform;
|
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
|
||||||
|
|
||||||
interface
|
|
||||||
|
|
||||||
uses
|
|
||||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
|
||||||
StdCtrls, DbCtrls, ExtCtrls, InterfaceBase;
|
|
||||||
|
|
||||||
type
|
|
||||||
|
|
||||||
{ TForm2 }
|
|
||||||
|
|
||||||
TForm2 = class(TForm)
|
|
||||||
Button1: TButton;
|
|
||||||
Button2: TButton;
|
|
||||||
CheckBox1: TCheckBox;
|
|
||||||
ComboBox1: TComboBox;
|
|
||||||
Edit1: TEdit;
|
|
||||||
Edit2: TEdit;
|
|
||||||
StaticText1: TStaticText;
|
|
||||||
procedure Button1Click(Sender: TObject);
|
|
||||||
procedure Button2Click(Sender: TObject);
|
|
||||||
private
|
|
||||||
{ private declarations }
|
|
||||||
public
|
|
||||||
{ public declarations }
|
|
||||||
end;
|
|
||||||
|
|
||||||
var
|
|
||||||
Form2: TForm2;
|
|
||||||
|
|
||||||
implementation
|
|
||||||
|
|
||||||
{ TForm2 }
|
|
||||||
|
|
||||||
procedure TForm2.Button1Click(Sender: TObject);
|
|
||||||
var
|
|
||||||
lChecked, lEdit1Text: String;
|
|
||||||
lComboBox: String;
|
|
||||||
begin
|
|
||||||
if CheckBox1.Checked then lChecked := 'True'
|
|
||||||
else lChecked := 'False';
|
|
||||||
|
|
||||||
WidgetSet.DebugLogLn('3');
|
|
||||||
lEdit1Text := Edit1.Text;
|
|
||||||
|
|
||||||
WidgetSet.DebugLogLn('4');
|
|
||||||
lComboBox := IntToStr(ComboBox1.ItemIndex);
|
|
||||||
|
|
||||||
WidgetSet.DebugLogLn('5');
|
|
||||||
|
|
||||||
Edit2.Text :=
|
|
||||||
'Edit1.Text='+lEdit1Text+LineEnding+
|
|
||||||
'Caption='+Caption+LineEnding+
|
|
||||||
'Checked?='+lChecked+LineEnding+
|
|
||||||
'ComboBox='+lComboBox;
|
|
||||||
|
|
||||||
Caption := lEdit1Text;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TForm2.Button2Click(Sender: TObject);
|
|
||||||
begin
|
|
||||||
WidgetSet.DebugLogLn('TForm2.Button2Click');
|
|
||||||
InputBox('Caption', 'Prompt', 'Default');
|
|
||||||
WidgetSet.DebugLogLn('TForm2.Button2Click 2');
|
|
||||||
end;
|
|
||||||
|
|
||||||
initialization
|
|
||||||
{$I mainform.lrs}
|
|
||||||
|
|
||||||
end.
|
|
||||||
|
|
Reference in New Issue
Block a user