summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2015-05-21 14:21:16 +0100
committerTor Lillqvist <tml@collabora.com>2015-05-21 14:21:16 +0100
commit43ad4c56fabe0304cf7aa133c7778996afbfae23 (patch)
tree4bbea0a271bf1ffa5ff804d042b85b93875c4ff8 /android
parent63b5e078255e7bae26b90ca870d83ca683cd90c8 (diff)
Bin the since long obsolete "desktop" Android app
It was an early approach, indeed experimental, and has been abandoned for quite a while.
Diffstat (limited to 'android')
-rw-r--r--android/CustomTarget_android_desktop.mk36
-rw-r--r--android/experimental/desktop/AndroidManifest.xml21
-rw-r--r--android/experimental/desktop/Makefile68
-rw-r--r--android/experimental/desktop/ant.properties17
-rw-r--r--android/experimental/desktop/build.xml84
-rw-r--r--android/experimental/desktop/fonts.conf154
-rw-r--r--android/experimental/desktop/jni/Android.mk19
-rw-r--r--android/experimental/desktop/project.properties13
-rw-r--r--android/experimental/desktop/res/layout/main.xml12
-rw-r--r--android/experimental/desktop/res/values/strings.xml4
-rw-r--r--android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java379
11 files changed, 0 insertions, 807 deletions
diff --git a/android/CustomTarget_android_desktop.mk b/android/CustomTarget_android_desktop.mk
deleted file mode 100644
index 715fd8c6108a..000000000000
--- a/android/CustomTarget_android_desktop.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-$(eval $(call gb_CustomTarget_CustomTarget,android/desktop))
-
-android_desktop_DIR := $(call gb_CustomTarget_get_workdir,android/experimental/Desktop)
-
-$(call gb_CustomTarget_get_target,android/desktop) : \
- $(android_desktop_DIR)/done
-
-# We want that to be built completely first,
-# so that we can serialize Ant access to Bootstrap, which is used
-# by several LO-android apps. We don't want one Ant to be cleaning
-# out Bootstrap while another is building stuff that depends on it.
-# Yeah, this sucks
-
-$(android_desktop_DIR)/done : $(call gb_Postprocess_get_target,AllModulesButInstsetNative)
- $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),MAK,2)
- cd $(SRCDIR)/android/experimental/desktop && $(MAKE) all
-# Copy to $(BUILDDIR)/instsetoo_native as that is where the tinderbox build script
-# still looks for the .apk, and we want fresh daily builds to be uploaded. Even if
-# the apps as such are mostly useless.
-# Us "foo" instead of the old INPATH
- mkdir -p $(BUILDDIR)/instsetoo_native/foo/bin; \
- cp $(SRCDIR)/android/experimental/desktop/bin/*.apk $(BUILDDIR)/instsetoo_native/foo/bin
-
-$(call gb_CustomTarget_get_clean_target,android/desktop) :
- $(call gb_Output_announce,$(subst $(WORKDIR)/Clean/,,$@),$(false),MAK,2)
- cd $(SRCDIR)/android/experimental/desktop && $(MAKE) clean
-
-# vim: set noet sw=4 ts=4:
diff --git a/android/experimental/desktop/AndroidManifest.xml b/android/experimental/desktop/AndroidManifest.xml
deleted file mode 100644
index d685e17fdb68..000000000000
--- a/android/experimental/desktop/AndroidManifest.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.libreoffice.experimental.desktop"
- android:versionCode="1"
- android:versionName="1.0">
- <uses-sdk android:minSdkVersion="15"
- android:targetSdkVersion="15"/>
- <application android:label="LibreOffice Desktop"
- android:debuggable="true"
- android:largeHeap="true"
- android:hardwareAccelerated="true">
- <activity android:name=".Desktop"
- android:label="LibreOffice Desktop"
- android:configChanges="keyboardHidden">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/android/experimental/desktop/Makefile b/android/experimental/desktop/Makefile
deleted file mode 100644
index 95167371404e..000000000000
--- a/android/experimental/desktop/Makefile
+++ /dev/null
@@ -1,68 +0,0 @@
-ifeq ($(BUILDDIR),)
-include ../../../config_host.mk
-endif
-
-# The default target just builds.
-all: build-ant
-
-# The package of this app
-APP_PACKAGE=org.libreoffice.experimental.desktop
-
-BOOTSTRAPDIR=../../Bootstrap
-include $(BOOTSTRAPDIR)/Makefile.shared
-
-native-code.cxx: $(SRCDIR)/solenv/bin/native-code.py
- $< -j \
- -g core -g edit -g writer \
- > $@
-
-# The name of the Bootstrap activity class
-BOOTSTRAP=org.libreoffice.android.Bootstrap
-
-# The default target just builds.
-
-copy-stuff-desktop:
-# tango artwork / icons
- mkdir -p assets/share/config
- cp -R $(INSTDIR)/$(LIBO_SHARE_FOLDER)/config/images_tango.zip assets/share/config
-# shell / splash images
- mkdir -p assets/program
- cp -r $(SRC_ROOT)/icon-themes/galaxy/brand/* assets/program
-# presets - becomes the users home directory, .stamp forces .zip dir creation
- for D in $(strip autocorr autotext backup basic config gallery \
- psprint/driver template \
- uno_packages/cache wordbook); do \
- mkdir -p assets/presets/$$D ; \
- echo "content" > assets/presets/$$D/stamp; \
- done
-# lofficerc
- mkdir -p assets/program/
- echo "[Bootstrap]" > assets/program/lofficerc
- echo "Logo=1" >> assets/program/lofficerc
- echo "NativeProgress=1" >> assets/program/lofficerc
- echo "URE_BOOTSTRAP=file:///assets/program/fundamentalrc" >> assets/program/lofficerc
- echo "HOME=$(APP_DATA_PATH)/files" >> assets/program/lofficerc
- echo "OSL_SOCKET_PATH=$(APP_DATA_PATH)/files" >> assets/program/lofficerc
-# - this looks useful but breaks more than it fixes ...
-# echo "DISABLE_EXTENSION_SYNCHRONIZATION=1" >> assets/program/lofficerc
-
-setup-jars:
-#
-# Copy jar files we need
-#
- for F in java_uno \
- juh \
- jurt \
- ridl \
- unoloader; do \
- $(call COPYJAR,$(INSTDIR)/$(LIBO_URE_SHARE_JAVA_FOLDER)/$${F}.jar); \
- done
- for F in unoil; do \
- $(call COPYJAR,$(INSTDIR)/$(LIBO_SHARE_JAVA_FOLDER)/$${F}.jar); \
- done
-
-build-ant: android_version_setup copy-stuff copy-stuff-desktop link-so properties setup-jars
- unset JAVA_HOME && $(ANT) $(if $(VERBOSE)$(verbose),,-quiet) debug
-
-run:
- $(ANDROID_SDK_HOME)/platform-tools/adb shell am start -n $(APP_PACKAGE)/.Desktop
diff --git a/android/experimental/desktop/ant.properties b/android/experimental/desktop/ant.properties
deleted file mode 100644
index ee52d86d94a4..000000000000
--- a/android/experimental/desktop/ant.properties
+++ /dev/null
@@ -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.
-
diff --git a/android/experimental/desktop/build.xml b/android/experimental/desktop/build.xml
deleted file mode 100644
index 7f9cbeb76717..000000000000
--- a/android/experimental/desktop/build.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="LibreOfficeExperimentalDesktop" 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="${android.library.reference.1}/no-resource-compress.xml" />
-</project>
diff --git a/android/experimental/desktop/fonts.conf b/android/experimental/desktop/fonts.conf
deleted file mode 100644
index e092541ef75b..000000000000
--- a/android/experimental/desktop/fonts.conf
+++ /dev/null
@@ -1,154 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
-<!-- /etc/fonts/fonts.conf file to configure system font access -->
-<fontconfig>
-
-<!-- Font directory list -->
-
- <dir>/system/fonts</dir>
-
- <alias>
- <family>serif</family>
- <prefer>
- <family>Droid Serif</family>
- </prefer>
- </alias>
- <alias>
- <family>sans-serif</family>
- <prefer>
- <family>Roboto</family>
- <family>Droid Sans Fallback</family>
- </prefer>
- </alias>
- <alias>
- <family>monospace</family>
- <prefer>
- <family>Droid Sans Mono</family>
- </prefer>
- </alias>
-
-<!--
- Accept deprecated 'mono' alias, replacing it with 'monospace'
--->
- <match target="pattern">
- <test qual="any" name="family">
- <string>mono</string>
- </test>
- <edit name="family" mode="assign">
- <string>monospace</string>
- </edit>
- </match>
-
-<!--
- Accept alternate 'sans serif' spelling, replacing it with 'sans-serif'
--->
- <match target="pattern">
- <test qual="any" name="family">
- <string>sans serif</string>
- </test>
- <edit name="family" mode="assign">
- <string>sans-serif</string>
- </edit>
- </match>
-
-<!--
- Accept deprecated 'sans' alias, replacing it with 'sans-serif'
--->
- <match target="pattern">
- <test qual="any" name="family">
- <string>sans</string>
- </test>
- <edit name="family" mode="assign">
- <string>sans-serif</string>
- </edit>
- </match>
-
-<!--
- Load local system customization file
--->
- <include ignore_missing="yes">conf.d</include>
-
-<!-- Font cache directory list -->
-
- <!-- Yeah this hardcoding is wrong of course, will have to fix
- later to patch in proper code in fontonfig on Android to
- find out a good place.
- -->
- <cachedir>/data/data/org.libreoffice.experimental.desktop/fontconfig</cachedir>
-
- <config>
-<!--
- These are the default Unicode chars that are expected to be blank
- in fonts. All other blank chars are assumed to be broken and
- won't appear in the resulting charsets
- -->
- <blank>
- <int>0x0020</int> <!-- SPACE -->
- <int>0x00A0</int> <!-- NO-BREAK SPACE -->
- <int>0x00AD</int> <!-- SOFT HYPHEN -->
- <int>0x034F</int> <!-- COMBINING GRAPHEME JOINER -->
- <int>0x0600</int> <!-- ARABIC NUMBER SIGN -->
- <int>0x0601</int> <!-- ARABIC SIGN SANAH -->
- <int>0x0602</int> <!-- ARABIC FOOTNOTE MARKER -->
- <int>0x0603</int> <!-- ARABIC SIGN SAFHA -->
- <int>0x06DD</int> <!-- ARABIC END OF AYAH -->
- <int>0x070F</int> <!-- SYRIAC ABBREVIATION MARK -->
- <int>0x115F</int> <!-- HANGUL CHOSEONG FILLER -->
- <int>0x1160</int> <!-- HANGUL JUNGSEONG FILLER -->
- <int>0x1680</int> <!-- OGHAM SPACE MARK -->
- <int>0x17B4</int> <!-- KHMER VOWEL INHERENT AQ -->
- <int>0x17B5</int> <!-- KHMER VOWEL INHERENT AA -->
- <int>0x180E</int> <!-- MONGOLIAN VOWEL SEPARATOR -->
- <int>0x2000</int> <!-- EN QUAD -->
- <int>0x2001</int> <!-- EM QUAD -->
- <int>0x2002</int> <!-- EN SPACE -->
- <int>0x2003</int> <!-- EM SPACE -->
- <int>0x2004</int> <!-- THREE-PER-EM SPACE -->
- <int>0x2005</int> <!-- FOUR-PER-EM SPACE -->
- <int>0x2006</int> <!-- SIX-PER-EM SPACE -->
- <int>0x2007</int> <!-- FIGURE SPACE -->
- <int>0x2008</int> <!-- PUNCTUATION SPACE -->
- <int>0x2009</int> <!-- THIN SPACE -->
- <int>0x200A</int> <!-- HAIR SPACE -->
- <int>0x200B</int> <!-- ZERO WIDTH SPACE -->
- <int>0x200C</int> <!-- ZERO WIDTH NON-JOINER -->
- <int>0x200D</int> <!-- ZERO WIDTH JOINER -->
- <int>0x200E</int> <!-- LEFT-TO-RIGHT MARK -->
- <int>0x200F</int> <!-- RIGHT-TO-LEFT MARK -->
- <int>0x2028</int> <!-- LINE SEPARATOR -->
- <int>0x2029</int> <!-- PARAGRAPH SEPARATOR -->
- <int>0x202A</int> <!-- LEFT-TO-RIGHT EMBEDDING -->
- <int>0x202B</int> <!-- RIGHT-TO-LEFT EMBEDDING -->
- <int>0x202C</int> <!-- POP DIRECTIONAL FORMATTING -->
- <int>0x202D</int> <!-- LEFT-TO-RIGHT OVERRIDE -->
- <int>0x202E</int> <!-- RIGHT-TO-LEFT OVERRIDE -->
- <int>0x202F</int> <!-- NARROW NO-BREAK SPACE -->
- <int>0x205F</int> <!-- MEDIUM MATHEMATICAL SPACE -->
- <int>0x2060</int> <!-- WORD JOINER -->
- <int>0x2061</int> <!-- FUNCTION APPLICATION -->
- <int>0x2062</int> <!-- INVISIBLE TIMES -->
- <int>0x2063</int> <!-- INVISIBLE SEPARATOR -->
- <int>0x206A</int> <!-- INHIBIT SYMMETRIC SWAPPING -->
- <int>0x206B</int> <!-- ACTIVATE SYMMETRIC SWAPPING -->
- <int>0x206C</int> <!-- INHIBIT ARABIC FORM SHAPING -->
- <int>0x206D</int> <!-- ACTIVATE ARABIC FORM SHAPING -->
- <int>0x206E</int> <!-- NATIONAL DIGIT SHAPES -->
- <int>0x206F</int> <!-- NOMINAL DIGIT SHAPES -->
- <int>0x2800</int> <!-- BRAILLE PATTERN BLANK -->
- <int>0x3000</int> <!-- IDEOGRAPHIC SPACE -->
- <int>0x3164</int> <!-- HANGUL FILLER -->
- <int>0xFEFF</int> <!-- ZERO WIDTH NO-BREAK SPACE -->
- <int>0xFFA0</int> <!-- HALFWIDTH HANGUL FILLER -->
- <int>0xFFF9</int> <!-- INTERLINEAR ANNOTATION ANCHOR -->
- <int>0xFFFA</int> <!-- INTERLINEAR ANNOTATION SEPARATOR -->
- <int>0xFFFB</int> <!-- INTERLINEAR ANNOTATION TERMINATOR -->
- </blank>
-<!--
- Rescan configuration every 3600 seconds when FcFontSetList is called
- -->
- <rescan>
- <int>3600</int>
- </rescan>
- </config>
-
-</fontconfig>
diff --git a/android/experimental/desktop/jni/Android.mk b/android/experimental/desktop/jni/Android.mk
deleted file mode 100644
index 9a30878a3f29..000000000000
--- a/android/experimental/desktop/jni/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (C) 2009 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/android/experimental/desktop/project.properties b/android/experimental/desktop/project.properties
deleted file mode 100644
index e25a76a466c3..000000000000
--- a/android/experimental/desktop/project.properties
+++ /dev/null
@@ -1,13 +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,
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-
-# Project target.
-target=android-21
-
-android.library.reference.1=../../Bootstrap
diff --git a/android/experimental/desktop/res/layout/main.xml b/android/experimental/desktop/res/layout/main.xml
deleted file mode 100644
index 5839d8cda704..000000000000
--- a/android/experimental/desktop/res/layout/main.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
-<TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="Hello World"
- />
-</LinearLayout>
diff --git a/android/experimental/desktop/res/values/strings.xml b/android/experimental/desktop/res/values/strings.xml
deleted file mode 100644
index 1672493c1606..000000000000
--- a/android/experimental/desktop/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string name="app_name">LibreOffice Viewer test</string>
-</resources>
diff --git a/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java b/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java
deleted file mode 100644
index b84333bd83cc..000000000000
--- a/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java
+++ /dev/null
@@ -1,379 +0,0 @@
-// -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-//
-// This file is part of the LibreOffice project.
-//
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this
-// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-// This is just a testbed for ideas and implementations. (Still, it might turn
-// out to be somewhat useful as such while waiting for "real" apps.)
-
-package org.libreoffice.experimental.desktop;
-
-import android.app.Activity;
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.Point;
-import android.graphics.Rect;
-import android.os.Bundle;
-import android.text.InputType;
-import android.util.Log;
-import android.view.GestureDetector;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-import android.view.ScaleGestureDetector;
-import android.view.View;
-import android.view.inputmethod.BaseInputConnection;
-import android.view.inputmethod.EditorInfo;
-import android.view.inputmethod.InputConnection;
-import android.view.inputmethod.InputMethodManager;
-
-import com.sun.star.awt.Key;
-
-import org.libreoffice.android.AppSupport;
-import org.libreoffice.android.Bootstrap;
-
-public class Desktop
- extends Activity
-{
- private static final String TAG = "LODesktop";
-
- /**
- * This class contains the state that is initialized once and never changes
- * (not specific to a document or a view).
- */
- class BootstrapContext
- {
- }
-
- BootstrapContext bootstrapContext;
-
- private static final Integer ZERO = 0;
-
- private static int normalize(Number value) {
- return ZERO.compareTo(-value.intValue());
- }
-
- private void initBootstrapContext()
- {
- bootstrapContext = new BootstrapContext();
-
- Bootstrap.setup(this);
-
- // To enable the putenv below, which turns on all SAL_INFO
- // logging, do: "adb shell setprop log.tag.LODesktopLogging
- // VERBOSE".
-
- if (Log.isLoggable("LODesktopLogging", Log.VERBOSE))
- Bootstrap.putenv("SAL_LOG=+WARN+INFO");
- }
-
- // This sucks, we need to experiment and think, can an app process
- // have several instances of this Activity active?
- static BitmapView theView;
-
- // This is called back from LO in the LO thread
- static public void callbackDamaged()
- {
- synchronized (theView) {
- if (!invalidatePosted)
- theView.post(new Runnable() {
- @Override public void run() {
- synchronized (theView) {
- theView.invalidate();
- invalidatePosted = false;
- }
- }
- });
- invalidatePosted = true;
- }
- }
- static boolean invalidatePosted;
-
- @Override public void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
-
- Log.i(TAG, "onCreate");
-
- try {
- String input;
-// input = getIntent().getStringExtra("input");
-// if (input == null)
- input = "/assets/test1.odt";
-// input = "--writer";
-
- // We need to fake up an argv, and the argv[0] even needs to
- // point to some file name that we can pretend is the "program".
- // setCommandArgs() will prefix argv[0] with the app's data
- // directory.
-
- String[] argv = { "lo-document-loader", input };
-
- Bootstrap.setCommandArgs(argv);
-
- // To enable the sleep below, do: "adb shell setprop
- // log.tag.LODesktopSleepOnCreate VERBOSE". Yeah, has
- // nothing to do with logging as such.
-
- // This should be after at least one call to something in
- // the Bootstrap class as it is the static initialiser
- // that loads the lo-native-code library, and presumably
- // in ndk-gdb you want to set a breapoint in some native
- // code...
-
- if (Log.isLoggable("LODesktopSleepOnCreate", Log.VERBOSE)) {
- Log.i(TAG, "Sleeping, start ndk-gdb NOW if you intend to debug");
- Thread.sleep(20000);
- }
-
- if (bootstrapContext == null)
- initBootstrapContext();
-
- Log.i(TAG, "onCreate - set content view");
- theView = new BitmapView();
- setContentView(theView);
-
- AppSupport.registerForDamageCallback(getClass());
-
- // Start a Java thread to run soffice_main(). We don't
- // want to start the thread from native code becauce
- // native threads apparently have no Java class loaders in
- // Android, or someghin. So for instance FindClass fails.
-
- // See https://groups.google.com/group/android-ndk/msg/a0793f009e6e71f7?dmode=source
- // .
-
- new Thread(new Runnable() {
- @Override public void run() {
- AppSupport.runMain();
- }
- }).start();
- }
- catch (Exception e) {
- e.printStackTrace(System.err);
- finish();
- }
- }
-
- class BitmapView
- extends View
- {
- Bitmap mBitmap;
- boolean renderedOnce;
-
- GestureDetector gestureDetector;
- ScaleGestureDetector scaleDetector;
-
- boolean scrollInProgress, scalingInProgress;
- float translateX = 0, translateY = 0;
- float accumulatedScale = 1;
- float pivotX = 0, pivotY = 0;
-
- public BitmapView()
- {
- super(Desktop.this);
- setFocusableInTouchMode(true);
-
- gestureDetector =
- new GestureDetector(Desktop.this,
- new GestureDetector.SimpleOnGestureListener() {
- @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
- {
- Log.i(TAG, "onFling: (" + velocityX + ", " + velocityY + ")");
- return false;
- }
-
- @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)
- {
- Log.i(TAG, "onScroll: (" + distanceX + ", " + distanceY + ")");
- translateX += -distanceX;
- translateY += -distanceY;
- scrollInProgress = true;
- invalidate();
- return true;
- }
- });
-
- scaleDetector =
- new ScaleGestureDetector(Desktop.this,
- new ScaleGestureDetector.SimpleOnScaleGestureListener() {
-
- @Override public boolean onScaleBegin(ScaleGestureDetector detector)
- {
- scalingInProgress = true;
- return true;
- }
-
- @Override public boolean onScale(ScaleGestureDetector detector)
- {
- accumulatedScale *= detector.getScaleFactor();
- pivotX = detector.getFocusX();
- pivotY = detector.getFocusY();
- invalidate();
- return true;
- }
-
- @Override public void onScaleEnd(ScaleGestureDetector detector)
- {
- accumulatedScale *= detector.getScaleFactor();
- AppSupport.zoom(accumulatedScale, (int) pivotX, (int) pivotY);
- accumulatedScale = 1;
- pivotX = pivotY = 0;
- scalingInProgress = false;
- invalidate();
- }
- });
- }
-
- @Override protected void onDraw(Canvas canvas)
- {
- if (mBitmap == null) {
- Log.i(TAG, "calling Bitmap.createBitmap(" + getWidth() + ", " + getHeight() + ", Bitmap.Config.ARGB_8888)");
- mBitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
- AppSupport.setViewSize(getWidth(), getHeight());
- }
- AppSupport.renderVCL(mBitmap);
- if (scrollInProgress) {
- canvas.save();
- canvas.translate(translateX, translateY);
- canvas.drawBitmap(mBitmap, 0, 0, null);
- canvas.restore();
- } else if (scalingInProgress) {
- canvas.save();
- canvas.scale(accumulatedScale, accumulatedScale, pivotX, pivotY);
- canvas.drawBitmap(mBitmap, 0, 0, null);
- canvas.restore();
- } else {
- canvas.drawBitmap(mBitmap, 0, 0, null);
- }
- renderedOnce = true;
- }
-
- @Override public boolean onKeyDown(int keyCode, KeyEvent event)
- {
- switch (keyCode) {
- case KeyEvent.KEYCODE_0:
- case KeyEvent.KEYCODE_1:
- case KeyEvent.KEYCODE_2:
- case KeyEvent.KEYCODE_3:
- case KeyEvent.KEYCODE_4:
- case KeyEvent.KEYCODE_5:
- case KeyEvent.KEYCODE_6:
- case KeyEvent.KEYCODE_7:
- case KeyEvent.KEYCODE_8:
- case KeyEvent.KEYCODE_9:
- AppSupport.key((char) ('0' + keyCode - KeyEvent.KEYCODE_0));
- return true;
- case KeyEvent.KEYCODE_DEL:
- AppSupport.key((char) Key.BACKSPACE);
- return true;
- case KeyEvent.KEYCODE_ENTER:
- AppSupport.key((char) Key.RETURN);
- return true;
- case KeyEvent.KEYCODE_TAB:
- AppSupport.key((char) Key.TAB);
- return true;
- default:
- return false;
- }
- }
-
- @Override public boolean onTouchEvent(MotionEvent event)
- {
- boolean scrollJustEnded = false;
- if (event.getPointerCount() == 1 &&
- gestureDetector.onTouchEvent(event)) {
- return true;
- }
-
- // There is no callback in SimpleOnGestureListener for end
- // of scroll. Is this a good way to detect it? Assume that
- // as long as the scrolling gesture is in progress, the
- // Gesturedetector.onTouchEvent() will keep returning
- // true, so if scrollInProgress is true and we get here,
- // the scroll must have ended.
-
- if (scrollInProgress) {
- AppSupport.scroll(normalize(translateX), normalize(translateY));
- translateX = translateY = 0;
- scrollInProgress = false;
- scrollJustEnded = true;
- invalidate();
- } else if (event.getPointerCount() == 2 &&
- scaleDetector.onTouchEvent(event) &&
- scalingInProgress) {
- // If a scaling gesture is in progress no other touch
- // processing should be done.
- return true;
- }
-
- // 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. Unfortunately it seems
- // less than obvious where the correct place to insert
- // such a request is.
-
- // 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 (!scrollJustEnded &&
- event.getPointerCount() == 1 &&
- 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);
- }
-
- if (event.getPointerCount() == 1) {
- switch (event.getActionMasked()) {
- case MotionEvent.ACTION_DOWN:
- case MotionEvent.ACTION_UP:
- case MotionEvent.ACTION_MOVE:
- AppSupport.touch(event.getActionMasked(), (int) event.getX(), (int) event.getY());
- break;
- }
- }
-
- return true;
- }
-
- @Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
- BaseInputConnection fic = new LOInputConnection(this, true);
- outAttrs.actionLabel = null;
- outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
- outAttrs.imeOptions = EditorInfo.IME_ACTION_NONE;
-
- return fic;
- }
-
- @Override public boolean onCheckIsTextEditor() {
- return renderedOnce;
- }
- }
-
- class LOInputConnection
- extends BaseInputConnection
- {
- public LOInputConnection(View targetView, boolean fullEditor) {
- super(targetView, fullEditor);
- }
-
- @Override public boolean commitText(CharSequence text, int newCursorPosition) {
- for (int i = 0; i < text.length(); i++) {
- AppSupport.key(text.charAt(i));
- }
- return true;
- }
- }
-
-}
-
-// vim:set shiftwidth=4 softtabstop=4 expandtab: