Kaydet (Commit) 1b530664 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Bin the 'DocumentLoader' Android test app

It is the wrong approach, from the time before tiled rendering, and has
not been built for a long time.
üst dae9a386
......@@ -352,18 +352,10 @@ And here is an (quite old) autogen.input for Android on X86:
--enable-ccache
--with-distro=LibreOfficeAndroidX86
There are a couple of (more or less) interactive apps that you can run
on the emulator or on a device that use LibreOffice code. Look in
android/experimental. DocumentLoader is just a testbench, really for
code to load a document (just Writer ones so far) and display one page
at a time. LibreOffice4Android is what resulted from a Google Summer
of Code project in 2012, a document viewer. desktop is a totally
different app, where the actual LibreOffice desktop GUI is present.
Note that none of these apps in any way are claimed to be ready for
end-users. No "beta testing" offers needed, it is painfully obvious
what problems they have.
To run some of the apps, do "make install" followed by either "make run" or
A LibreOffice app for Android is being developed progress in the
android/experimental/LOAndroid3 directory.
To run the app, do "make install" followed by either "make run" or
starting it from Android itself. You most likely want to have an "adb logcat"
running in another window. To debug, run "make debugrun".
......
<?xml version="1.0" encoding="utf-8"?> <!-- -*- indent-tabs-mode: nil -*- -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.libreoffice.android.examples"
android:installLocation="preferExternal"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="15"
android:targetSdkVersion="15"/>
<application android:label="LO Experimental DocumentLoader"
android:debuggable="true"
android:largeHeap="true"
android:hardwareAccelerated="true">
<activity android:name=".DocumentLoader"
android:label="LO DocumentLoader"
android:configChanges="keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
<!-- vim:set expandtab: -->
ifeq ($(BUILDDIR),)
include ../../../config_host.mk
endif
# The default target just builds.
all: build-ant
# The package of this app
APP_PACKAGE=org.libreoffice.android.examples
BOOTSTRAPDIR=../../Bootstrap
include $(BOOTSTRAPDIR)/Makefile.shared
native-code.cxx: $(SRCDIR)/solenv/bin/native-code.py
$< \
-g core -g writer \
> $@
build-ant: android_version_setup copy-stuff link-so properties
#
# 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
#
unset JAVA_HOME && $(ANT) $(if $(VERBOSE)$(verbose),,-quiet) debug
run:
adb shell am start -n org.libreoffice.android.examples/.DocumentLoader -e input /assets/test1.odt
<?xml version="1.0" encoding="UTF-8"?>
<project name="LibreOfficeDocumentLoader" 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: custom -->
<import file="${android.library.reference.1}/no-resource-compress.xml" />
</project>
<?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.android.examples/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>
# Needed just to satisfy ndk-gdb for now, but maybe later we will actually add
# some JNI code here
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include $(BUILD_SHARED_LIBRARY)
# 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
# Use the Bootstrap class
android.library.reference.1=../../Bootstrap
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/go_to_page"
android:title="@string/go_to_page"/>
</menu>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="go_to_page">Go to page</string>
</resources>
/*
* Copyright (c) 2012 Jason Polites
*
* 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.
*/
package com.polites.android;
public interface Animation {
/**
* Transforms the view.
* @param view
* @param diffTime
* @return true if this animation should remain active. False otherwise.
*/
public boolean update(GestureImageView view, long time);
}
/*
* Copyright (c) 2012 Jason Polites
*
* 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.
*/
package com.polites.android;
public class Animator extends Thread {
private GestureImageView view;
private Animation animation;
private boolean running = false;
private boolean active = false;
private long lastTime = -1L;
public Animator(GestureImageView view, String threadName) {
super(threadName);
this.view = view;
}
@Override
public void run() {
running = true;
while(running) {
while(active && animation != null) {
long time = System.currentTimeMillis();
active = animation.update(view, time - lastTime);
view.redraw();
lastTime = time;
while(active) {
try {
if(view.waitForDraw(32)) { // 30Htz
break;
}
}
catch (InterruptedException ignore) {
active = false;
}
}
}
synchronized(this) {
if(running) {
try {
wait();
}
catch (InterruptedException ignore) {}
}
}
}
}
public synchronized void finish() {
running = false;
active = false;
notifyAll();
}
public void play(Animation transformer) {
if(active) {
cancel();
}
this.animation = transformer;
activate();
}
public synchronized void activate() {
lastTime = System.currentTimeMillis();
active = true;
notifyAll();
}
public void cancel() {
active = false;
}
}
/*
* Copyright (c) 2012 Jason Polites
*
* 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.
*/
package com.polites.android;
public class FlingAnimation implements Animation {
private float velocityX;
private float velocityY;
private float factor = 0.85f;
private float threshold = 10;
private FlingAnimationListener listener;
/* (non-Javadoc)
* @see com.polites.android.Transformer#update(com.polites.android.GestureImageView, long)
*/
@Override
public boolean update(GestureImageView view, long time) {
float seconds = (float) time / 1000.0f;
float dx = velocityX * seconds;
float dy = velocityY * seconds;
velocityX *= factor;
velocityY *= factor;
boolean active = (Math.abs(velocityX) > threshold && Math.abs(velocityY) > threshold);
if(listener != null) {
listener.onMove(dx, dy);
if(!active) {
listener.onComplete();
}
}
return active;
}
public void setVelocityX(float velocityX) {
this.velocityX = velocityX;
}
public void setVelocityY(float velocityY) {
this.velocityY = velocityY;
}
public void setFactor(float factor) {
this.factor = factor;
}
public void setListener(FlingAnimationListener listener) {
this.listener = listener;
}
}
/*
* Copyright (c) 2012 Jason Polites
*
* 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.
*/
package com.polites.android;
public interface FlingAnimationListener {
public void onMove(float x, float y);
public void onComplete();
}
/*
* Copyright (c) 2012 Jason Polites
*
* 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.
*/
package com.polites.android;
public interface GestureImageViewListener {
public void onTouch(float x, float y);
public void onScale(float scale);
public void onPosition(float x, float y);
}
/*
* Copyright (c) 2012 Jason Polites
*
* 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.
*/
package com.polites.android;
import android.graphics.PointF;
import android.util.FloatMath;
import android.view.MotionEvent;
public class MathUtils {
public static float distance(MotionEvent event) {
float x = event.getX(0) - event.getX(1);
float y = event.getY(0) - event.getY(1);
return FloatMath.sqrt(x * x + y * y);
}
public static float distance(PointF p1, PointF p2) {
float x = p1.x - p2.x;
float y = p1.y - p2.y;
return FloatMath.sqrt(x * x + y * y);
}
public static float distance(float x1, float y1, float x2, float y2) {
float x = x1 - x2;
float y = y1 - y2;
return FloatMath.sqrt(x * x + y * y);
}
public static void midpoint(MotionEvent event, PointF point) {
float x1 = event.getX(0);
float y1 = event.getY(0);
float x2 = event.getX(1);
float y2 = event.getY(1);
midpoint(x1, y1, x2, y2, point);
}
public static void midpoint(float x1, float y1, float x2, float y2, PointF point) {
point.x = (x1 + x2) / 2.0f;
point.y = (y1 + y2) / 2.0f;
}
/**
* Rotates p1 around p2 by angle degrees.
* @param p1
* @param p2
* @param angle
*/
public void rotate(PointF p1, PointF p2, float angle) {
float px = p1.x;
float py = p1.y;
float ox = p2.x;
float oy = p2.y;
p1.x = (FloatMath.cos(angle) * (px-ox) - FloatMath.sin(angle) * (py-oy) + ox);
p1.y = (FloatMath.sin(angle) * (px-ox) + FloatMath.cos(angle) * (py-oy) + oy);
}
public static float angle(PointF p1, PointF p2) {
return angle(p1.x, p1.y, p2.x, p2.y);
}
public static float angle(float x1, float y1, float x2, float y2) {
return (float) Math.atan2(y2 - y1, x2 - x1);
}
}
/*
* Copyright (c) 2012 Jason Polites
*
* 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