summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java8
-rw-r--r--vcl/android/androidinst.cxx16
2 files changed, 21 insertions, 3 deletions
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 8d5b97de03c4..58fe555936da 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_8888)");
mBitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
+ setViewSize(getWidth(), getHeight());
}
renderVCL(mBitmap);
canvas.drawBitmap(mBitmap, 0, 0, null);
diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx
index 2ed158549166..8bd285f1d310 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: */