[Libreoffice-commits] core.git: android/experimental vcl/android
android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java | 21 +++--- vcl/android/androidinst.cxx | 10 +--- 2 files changed, 12 insertions(+), 19 deletions(-) New commits: commit 4ceb66d86f508629bd663d16563809524398551e Author: Tor Lillqvist t...@iki.fi Date: Wed Mar 6 09:27:04 2013 +0200 Drop unused timestamp parameters Change-Id: I1d825c39cde67c204110b4a787b3ffb290331fe5 diff --git a/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java b/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java index 065220a..6d66926 100644 --- a/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java +++ b/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java @@ -47,8 +47,8 @@ public class Desktop /* implementend by vcl */ public static native void renderVCL(Bitmap bitmap); public static native void setViewSize(int width, int height); -public static native void key(char c, short timestamp); -public static native void touch(int action, int x, int y, short timestamp); +public static native void key(char c); +public static native void touch(int action, int x, int y); public static native void zoom(float scale, int x, int y); /** @@ -121,11 +121,6 @@ public class Desktop } } -static short getTimestamp() -{ -return (short) (System.currentTimeMillis() % Short.MAX_VALUE); -} - class BitmapView extends View { @@ -222,16 +217,16 @@ public class Desktop case KeyEvent.KEYCODE_7: case KeyEvent.KEYCODE_8: case KeyEvent.KEYCODE_9: -Desktop.key((char) ('0' + keyCode - KeyEvent.KEYCODE_0), Desktop.getTimestamp()); +Desktop.key((char) ('0' + keyCode - KeyEvent.KEYCODE_0)); return true; case KeyEvent.KEYCODE_DEL: -Desktop.key((char) Key.BACKSPACE, Desktop.getTimestamp()); +Desktop.key((char) Key.BACKSPACE); return true; case KeyEvent.KEYCODE_ENTER: -Desktop.key((char) Key.RETURN, Desktop.getTimestamp()); +Desktop.key((char) Key.RETURN); return true; case KeyEvent.KEYCODE_TAB: -Desktop.key((char) Key.TAB, Desktop.getTimestamp()); +Desktop.key((char) Key.TAB); return true; default: return false; @@ -272,7 +267,7 @@ public class Desktop case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_UP: case MotionEvent.ACTION_MOVE: -Desktop.touch(event.getActionMasked(), (int) event.getX(), (int) event.getY(), Desktop.getTimestamp()); +Desktop.touch(event.getActionMasked(), (int) event.getX(), (int) event.getY()); break; } @@ -302,7 +297,7 @@ public class Desktop @Override public boolean commitText(CharSequence text, int newCursorPosition) { for (int i = 0; i text.length(); i++) { -Desktop.key(text.charAt(i), Desktop.getTimestamp()); +Desktop.key(text.charAt(i)); } return true; } diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index 85ae77c..f742c1b 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -916,12 +916,11 @@ Java_org_libreoffice_experimental_desktop_Desktop_setViewSize(JNIEnv * /* env */ viewHeight = height; } -// public static native void key(char c, short timestamp); +// public static native void key(char c); extern C SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_experimental_desktop_Desktop_key(JNIEnv * /* env */, jobject /* clazz */, - jchar c, - jshort /* timestamp */) + jchar c) { SalFrame *pFocus = AndroidSalInstance::getInstance()-getFocusFrame(); if (pFocus) { @@ -933,14 +932,13 @@ Java_org_libreoffice_experimental_desktop_Desktop_key(JNIEnv * /* env */, LOGW(No focused frame to emit event on); } -// public static native void touch(int action, int x, int y, short timestamp); +// public static native void touch(int action, int x, int y); extern C SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_experimental_desktop_Desktop_touch(JNIEnv * /* env */, jobject /* clazz */, jint action, jint x, -jint
[Libreoffice-commits] core.git: android/experimental vcl/android
android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java | 35 +++- vcl/android/androidinst.cxx | 43 +- 2 files changed, 74 insertions(+), 4 deletions(-) New commits: commit 3cf4f1a13b61592b1af8040692029216d9c90d4c Author: Tor Lillqvist t...@iki.fi Date: Thu Feb 28 00:24:33 2013 +0200 Handle touch events Change-Id: I9c9d200731df9ba48ee61f7c97692ed9b9f06648 diff --git a/android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java b/android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java index 5c54330..ba3d6da 100644 --- a/android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java +++ b/android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java @@ -23,6 +23,7 @@ import android.os.Bundle; import android.text.InputType; import android.util.Log; import android.view.MotionEvent; +import android.view.ScaleGestureDetector; import android.view.View; import android.view.inputmethod.BaseInputConnection; import android.view.inputmethod.EditorInfo; @@ -46,6 +47,7 @@ public class Desktop public static native void renderVCL(Bitmap bitmap); public static native void setViewSize(int width, int height); public static native void key(char c, short timestamp); +public static native void touch(int action, int x, int y, short timestamp); /** * This class contains the state that is initialized once and never changes @@ -152,11 +154,21 @@ public class Desktop { Bitmap mBitmap; boolean renderedOnce; +ScaleGestureDetector gestureDetector; public BitmapView() { super(Desktop.this); setFocusableInTouchMode(true); +gestureDetector = +new ScaleGestureDetector(Desktop.this, + new ScaleGestureDetector.SimpleOnScaleGestureListener() { + @Override public boolean onScale(ScaleGestureDetector detector) + { + Log.i(TAG, onScale: + detector.getScaleFactor()); + return true; + } + }); } @Override protected void onDraw(Canvas canvas) @@ -182,13 +194,32 @@ public class Desktop return super.onTouchEvent(event); super.onTouchEvent(event); -Log.d(TAG, onTOUCH); -if (event.getAction() == MotionEvent.ACTION_UP) { +Log.d(TAG, onTouch ( + event.getX() + , + event.getY() + )); + +// Just temporary hack. We should not show the keyboard +// unconditionally on a ACTION_UP event here. The LO level +// should callback to us requesting showing the keyboard +// if the user taps in a text area. Also, if the device +// has a hardware keyboard, we probably should not show +// the soft one unconditionally? But what if the user +// wants to input in another script than what the hardware +// keyboard covers? +if (event.getActionMasked() == MotionEvent.ACTION_UP) { // show the keyboard so we can enter text InputMethodManager imm = (InputMethodManager) getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(this, InputMethodManager.SHOW_FORCED); } + +switch (event.getActionMasked()) { +case MotionEvent.ACTION_DOWN: +case MotionEvent.ACTION_UP: +case MotionEvent.ACTION_MOVE: +short timestamp = (short) (System.currentTimeMillis() % Short.MAX_VALUE); +Desktop.touch(event.getActionMasked(), (int) event.getX(), (int) event.getY(), timestamp); +break; +} + return true; } diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index b94855d..2773cd3 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -900,10 +900,10 @@ int AndroidSalSystem::ShowNativeDialog( const rtl::OUString rTitle, return 0; } -// Render everything +// public static native void renderVCL(Bitmap bitmap); extern C SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_experimental_desktop_Desktop_renderVCL(JNIEnv *env, -jobject /* dummy */, +jobject /* clazz */, jobject bitmap) { if (!bHitIdle) @@ -963,6 +963,7 @@ typedef struct
[Libreoffice-commits] core.git: android/experimental vcl/android
android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java |8 +++-- vcl/android/androidinst.cxx | 16 ++ 2 files changed, 21 insertions(+), 3 deletions(-) New commits: commit eb37322f14e6ed12a0db0f7fad1af81114a2ed80 Author: Tor Lillqvist t...@iki.fi Date: Mon Feb 25 18:08:01 2013 +0200 Temporary (one hopes) hack to get the actual view size down to SvpSalFrame Change-Id: I0c2a2301de1b0de71fc6724ff2af73fbf6b406ef diff --git a/android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java b/android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java index 8d5b97d..58fe555 100644 --- a/android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java +++ b/android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java @@ -132,6 +132,7 @@ public class Desktop /* implementend by vcl */ public static native void renderVCL(Bitmap bitmap); +public static native void setViewSize(int width, int height); /** * This class contains the state that is initialized once and never changes @@ -278,15 +279,15 @@ public class Desktop if (bootstrapContext == null) initBootstrapContext(); +Log.i(TAG, onCreate - set content view\n); +setContentView(new BitmapView()); + spawnMain(); } catch (Exception e) { e.printStackTrace(System.err); finish(); } - -Log.i(TAG, onCreate - set content view\n); -setContentView(new BitmapView()); } class BitmapView extends android.view.View @@ -305,6 +306,7 @@ public class Desktop if (mBitmap == null) { Log.i(TAG, calling Bitmap.createBitmap( + getWidth() + , + getHeight() + , Bitmap.Config.ARGB_)); mBitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_); +setViewSize(getWidth(), getHeight()); } renderVCL(mBitmap); canvas.drawBitmap(mBitmap, 0, 0, null); diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index 2ed1585..8bd285f 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -43,6 +43,9 @@ static bool bHitIdle = false; +// Horrible hack +static int viewWidth = 1, viewHeight = 1; + class AndroidSalData : public SalGenericData { public: @@ -735,6 +738,8 @@ public: pSysParent ) { enableDamageTracker(); +if (pParent == NULL viewWidth 1 viewHeight 1) +SetPosSize(0, 0, viewWidth, viewHeight, SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT); } virtual void GetWorkArea( Rectangle rRect ) @@ -962,4 +967,15 @@ typedef struct ANativeWindow_Buffer { AndroidBitmap_unlockPixels(env, bitmap); } +extern C SAL_JNI_EXPORT void JNICALL +Java_org_libreoffice_experimental_desktop_Desktop_setViewSize(JNIEnv * /* env */, + jobject /* object */, + jint width, + jint height) +{ +// Horrible +viewWidth = width; +viewHeight = height; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits