Commit 38131a60ab1cdc7ad15452bc28e8c41097787c4e

Authored by perry.werneck@gmail.com
1 parent 262679c7

Android - Implementando

src/android/Makefile
... ... @@ -35,5 +35,6 @@ clean:
35 35 @rm -f jni/lib3270jni.h
36 36  
37 37 jni/lib3270jni.h: bin/classes/$(CLASSPATH)/lib3270.class
  38 + @echo $@ ...
38 39 @$(JAVAH) -o $@ -classpath bin/classes $(subst /,.,$(CLASSPATH)).lib3270
39 40  
... ...
src/android/jni/main.cpp
... ... @@ -60,14 +60,24 @@ JNIEXPORT jint JNICALL Java_br_com_bb_pw3270_lib3270_processEvents(JNIEnv *env,
60 60 return 0;
61 61 }
62 62  
63   -JNIEXPORT jboolean JNICALL Java_br_com_bb_pw3270_lib3270_isConnected(JNIEnv *, jobject)
  63 +JNIEXPORT jboolean JNICALL Java_br_com_bb_pw3270_lib3270_isConnected(JNIEnv *env, jobject obj)
64 64 {
65 65 // return (lib3270_connected(lib3270_get_default_session_handle())) ? JNI_TRUE : JNI_FALSE;;
66 66 return JNI_FALSE;
67 67 }
68 68  
69   -JNIEXPORT jboolean JNICALL Java_br_com_bb_pw3270_lib3270_isTerminalReady(JNIEnv *, jobject)
  69 +JNIEXPORT jboolean JNICALL Java_br_com_bb_pw3270_lib3270_isTerminalReady(JNIEnv *env, jobject obj)
70 70 {
71 71 return JNI_FALSE;
72 72 }
73 73  
  74 +JNIEXPORT void JNICALL Java_br_com_bb_pw3270_lib3270_setHost(JNIEnv *env, jobject obj, jstring hostname)
  75 +{
  76 +
  77 +}
  78 +
  79 +JNIEXPORT jstring JNICALL Java_br_com_bb_pw3270_lib3270_getHost(JNIEnv *env, jobject obj)
  80 +{
  81 + return env->NewStringUTF("");
  82 +}
  83 +
... ...
src/android/res/layout/main.xml
... ... @@ -4,10 +4,30 @@
4 4 android:layout_height="fill_parent"
5 5 android:orientation="vertical" >
6 6  
  7 + <LinearLayout
  8 + android:layout_width="match_parent"
  9 + android:layout_height="wrap_content" >
  10 +
  11 + <EditText
  12 + android:id="@+id/editText1"
  13 + android:layout_width="match_parent"
  14 + android:layout_height="match_parent"
  15 + android:layout_weight="1"
  16 + android:ems="10" />
  17 +
  18 + <Button
  19 + android:id="@+id/connect"
  20 + style="?android:attr/buttonStyleSmall"
  21 + android:layout_width="80dp"
  22 + android:layout_height="match_parent"
  23 + android:text="Connect" />
  24 +
  25 + </LinearLayout>
  26 +
7 27 <TextView
8 28 android:id="@+id/text"
9 29 android:layout_width="fill_parent"
10   - android:layout_height="wrap_content"
  30 + android:layout_height="match_parent"
11 31 android:text="@string/hello" />
12 32  
13 33 </LinearLayout>
14 34 \ No newline at end of file
... ...
src/android/src/br/com/bb/pw3270/PW3270Activity.java
... ... @@ -3,6 +3,7 @@ package br.com.bb.pw3270;
3 3 import android.app.Activity;
4 4 import android.os.Bundle;
5 5 import android.widget.TextView;
  6 +import android.widget.Button;
6 7  
7 8 public class PW3270Activity extends Activity {
8 9  
... ... @@ -15,6 +16,9 @@ public class PW3270Activity extends Activity {
15 16 setContentView(R.layout.main);
16 17  
17 18 TextView text = (TextView) findViewById(R.id.text);
  19 + Button btn = (Button) findViewById(R.id.connect);
  20 +
  21 +
18 22  
19 23 host = new lib3270();
20 24  
... ...
src/android/src/br/com/bb/pw3270/lib3270.java
... ... @@ -19,7 +19,7 @@ public class lib3270 extends Thread
19 19 // TODO Auto-generated method stub
20 20  
21 21 }
22   -
  22 +
23 23 /**
24 24 * Connect to host, keep event loop running until disconnected.
25 25 */
... ... @@ -37,11 +37,14 @@ public class lib3270 extends Thread
37 37  
38 38 public native String getVersion();
39 39 public native String getRevision();
40   -
41   - // Connection status
  40 +
  41 + // Connect/Disconnect status
  42 + public native void setHost(String host);
  43 + public native String getHost();
42 44 public native boolean isConnected();
43 45 public native boolean isTerminalReady();
44 46  
45 47  
46 48  
  49 +
47 50 }
... ...