[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - 3 commits - android/Bootstrap android/experimental android/.gitignore
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Mon Mar 9 02:45:17 PDT 2015
android/.gitignore | 1
android/Bootstrap/Makefile.shared | 8 ++
android/experimental/LOAndroid3/AndroidManifest.xml.in | 9 +-
android/experimental/LOAndroid3/Makefile | 4 -
android/experimental/LOAndroid3/project.properties | 3
android/experimental/LOAndroid3/res/layout/activity_main.xml | 32 ++++++----
android/experimental/LOAndroid3/res/layout/toolbar.xml | 10 +++
android/experimental/LOAndroid3/res/values-v21/themes.xml | 10 +++
android/experimental/LOAndroid3/res/values/styles.xml | 8 --
android/experimental/LOAndroid3/res/values/themes.xml | 12 +++
android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java | 16 +++++
android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java | 23 +++++--
12 files changed, 102 insertions(+), 34 deletions(-)
New commits:
commit 4e422ee81c5308686ff7a6df8dca2e636cf64514
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon Mar 9 18:29:52 2015 +0900
android: actually use the new toolbar in the application
Change-Id: I221ece32967289104612309faee5d22209a64b25
diff --git a/android/experimental/LOAndroid3/res/layout/activity_main.xml b/android/experimental/LOAndroid3/res/layout/activity_main.xml
index e9a946f..63695e5 100644
--- a/android/experimental/LOAndroid3/res/layout/activity_main.xml
+++ b/android/experimental/LOAndroid3/res/layout/activity_main.xml
@@ -6,26 +6,34 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#fff"
- tools:context=".MainActivity">
+ tools:context=".LibreOfficeMainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
- <RelativeLayout
- android:id="@+id/gecko_layout"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_weight="1">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
- <org.mozilla.gecko.gfx.LayerView
- android:id="@+id/layer_view"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"/>
+ <include layout="@layout/toolbar"/>
- <include layout="@layout/text_selection_handles"/>
+ <RelativeLayout
+ android:id="@+id/gecko_layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
- </RelativeLayout>
+ <org.mozilla.gecko.gfx.LayerView
+ android:id="@+id/layer_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"/>
+
+ <include layout="@layout/text_selection_handles"/>
+
+ </RelativeLayout>
+ </LinearLayout>
<RelativeLayout
android:id="@+id/loadingPanel"
diff --git a/android/experimental/LOAndroid3/res/layout/toolbar.xml b/android/experimental/LOAndroid3/res/layout/toolbar.xml
new file mode 100644
index 0000000..d8faa51
--- /dev/null
+++ b/android/experimental/LOAndroid3/res/layout/toolbar.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<android.support.v7.widget.Toolbar
+ android:id="@+id/toolbar"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:elevation="3dp">
+
+</android.support.v7.widget.Toolbar>
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
index 2f2eada..cd69c1d 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -1,6 +1,5 @@
package org.libreoffice;
-import android.app.Activity;
import android.app.AlertDialog;
import android.content.ContentResolver;
import android.content.Context;
@@ -8,6 +7,9 @@ import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.widget.DrawerLayout;
+import android.support.v7.app.ActionBarActivity;
+import android.support.v7.app.ActionBarDrawerToggle;
+import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
@@ -31,7 +33,7 @@ import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
-public class LibreOfficeMainActivity extends Activity {
+public class LibreOfficeMainActivity extends ActionBarActivity {
private static final String LOGTAG = "LibreOfficeMainActivity";
private static final String DEFAULT_DOC_PATH = "/assets/example.odt";
@@ -44,7 +46,6 @@ public class LibreOfficeMainActivity extends Activity {
public Handler mMainHandler;
private DrawerLayout mDrawerLayout;
- private RelativeLayout mGeckoLayout;
private ListView mDrawerList;
private List<DocumentPartView> mDocumentPartView = new ArrayList<DocumentPartView>();
private DocumentPartViewListAdapter mDocumentPartViewListAdapter;
@@ -53,6 +54,7 @@ public class LibreOfficeMainActivity extends Activity {
private TextCursorLayer mTextCursorLayer;
private File mTempFile = null;
private LOAbout mAbout;
+
public LibreOfficeMainActivity() {
mAbout = new LOAbout(this, false);
}
@@ -116,10 +118,19 @@ public class LibreOfficeMainActivity extends Activity {
setContentView(R.layout.activity_main);
- getActionBar().setDisplayHomeAsUpEnabled(false);
- getActionBar().setHomeButtonEnabled(false);
+ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+ getSupportActionBar().setHomeAsUpIndicator(R.drawable.lo_icon);
+
+ //getSupportActionBar().setHomeAsUpIndicator();
+
+ toolbar.setNavigationOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ onBackPressed();
+ }
+ });
- mGeckoLayout = (RelativeLayout) findViewById(R.id.gecko_layout);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
if (mDocumentPartViewListAdapter == null) {
commit ea818d74d7ff50dfc11be557bbc23ecf721a4ae5
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon Mar 9 18:16:49 2015 +0900
android: make & build appcompat-v7 library, up target to v21
Previously we included the android support library v4 for some
GUI elements like GridView. This commit in addition adds the v7
appcompat library which is needed for the new Lollipop style
Toolbar and many other new GUI elements.
The appcompat v7 library is not distributed as only a jar file
but needs to be build (as it includes additional resources) and
included as a library project. So to do this the content is copied
from SDK and build with the build system. The files also include
the v4 so it doesn't need to be copied from SDK anymore.
The target had to be raised to v21 (Lollipop), however the minimum
SDK version remains unchanged.
Change-Id: I4f1a6ce69e7f6c3f9df784a6835f376a01d4dfdb
diff --git a/android/.gitignore b/android/.gitignore
index dca2c57..0f7e91b 100644
--- a/android/.gitignore
+++ b/android/.gitignore
@@ -5,3 +5,4 @@ libs
obj
local.properties
native-code.cxx
+AppCompat-v7
diff --git a/android/Bootstrap/Makefile.shared b/android/Bootstrap/Makefile.shared
index a215d44..2a8b545 100644
--- a/android/Bootstrap/Makefile.shared
+++ b/android/Bootstrap/Makefile.shared
@@ -18,6 +18,8 @@ APP_DATA_PATH=/data/data/$(APP_PACKAGE)
SODEST=libs/$(ANDROID_APP_ABI)
OBJLOCAL=obj/local/$(ANDROID_APP_ABI)
+APPCOMPATDIR=$(BOOTSTRAPDIR)/../AppCompat-v7
+
define COPYSO
$(error COPYSO should not be used now with DISABLE_DYNLOADING)
endef
@@ -50,6 +52,11 @@ $(BOOTSTRAPDIR)/no-resource-compress.xml : $(ANDROID_SDK_HOME)/tools/ant/build.x
android_version_setup : $(BOOTSTRAPDIR)/no-resource-compress.xml
+prepare-appcompat:
+ mkdir $(APPCOMPATDIR) 2>/dev/null; true
+ cp -rf $(ANDROID_SDK_HOME)/extras/android/support/v7/appcompat/* $(APPCOMPATDIR)
+ $(ANDROID_SDK_HOME)/tools/android update lib-project --target android-21 --path $(APPCOMPATDIR)
+
properties:
echo sdk.dir=$(ANDROID_SDK_HOME) >local.properties
echo sdk.dir=$(ANDROID_SDK_HOME) >../../Bootstrap/local.properties
@@ -70,6 +77,7 @@ clean: android_version_setup properties
$(ANT) $(if $(VERBOSE)$(verbose),,-quiet) -keep-going clean
rm -rf assets libs $(SODEST) $(OBJLOCAL) $(BOOTSTRAPDIR)/no-resource-compress.xml
rm -f native-code.cxx
+ rm -rf $(APPCOMPATDIR)
#
# Build / link the single .so for this app
diff --git a/android/experimental/LOAndroid3/AndroidManifest.xml.in b/android/experimental/LOAndroid3/AndroidManifest.xml.in
index 244c6db..e151172 100644
--- a/android/experimental/LOAndroid3/AndroidManifest.xml.in
+++ b/android/experimental/LOAndroid3/AndroidManifest.xml.in
@@ -7,7 +7,7 @@
<!-- App requires OpenGL ES 2.0 -->
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17"/>
+ <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
@@ -16,14 +16,14 @@
android:icon="@drawable/main"
android:label="@string/app_name"
android:hardwareAccelerated="true"
- android:theme="@style/AppTheme"
android:largeHeap="false">
<!-- Viewer Activity -->
<activity
android:name=".LibreOfficeMainActivity"
android:label="@string/app_name"
- android:configChanges="orientation|keyboard|keyboardHidden|screenLayout|uiMode|screenSize|smallestScreenSize">
+ android:configChanges="orientation|keyboard|keyboardHidden|screenLayout|uiMode|screenSize|smallestScreenSize"
+ android:theme="@style/LibreOfficeTheme">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
@@ -91,7 +91,8 @@
<!-- Document Browser Activity -->
<activity android:name=".ui.LibreOfficeUIActivity"
- android:label="@string/app_name">
+ android:label="@string/app_name"
+ android:theme="@style/BrowserTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
diff --git a/android/experimental/LOAndroid3/Makefile b/android/experimental/LOAndroid3/Makefile
index c5c18c7..ecefd10 100644
--- a/android/experimental/LOAndroid3/Makefile
+++ b/android/experimental/LOAndroid3/Makefile
@@ -17,12 +17,10 @@ include $(BOOTSTRAPDIR)/Makefile.shared
native-code.cxx: $(SRCDIR)/solenv/bin/native-code.py
$< -j -g core -g writer -g calc -g draw -g edit > $@
-build-ant: android_version_setup copy-stuff link-so properties
+build-ant: android_version_setup copy-stuff prepare-appcompat link-so properties
#
# Copy jar files we need
#
- cp $(ANDROID_SDK_HOME)/extras/android/support/v4/android-support-v4.jar libs
-
for F in java_uno \
juh \
jurt \
diff --git a/android/experimental/LOAndroid3/project.properties b/android/experimental/LOAndroid3/project.properties
index 772d3c5..d5ae53d 100644
--- a/android/experimental/LOAndroid3/project.properties
+++ b/android/experimental/LOAndroid3/project.properties
@@ -8,7 +8,8 @@
# project structure.
# Project target.
-target=android-15
+target=android-21
# Use the Bootstrap class
android.library.reference.1=../../Bootstrap
+android.library.reference.2=../../AppCompat-v7
diff --git a/android/experimental/LOAndroid3/res/values-v21/themes.xml b/android/experimental/LOAndroid3/res/values-v21/themes.xml
new file mode 100644
index 0000000..917f41b
--- /dev/null
+++ b/android/experimental/LOAndroid3/res/values-v21/themes.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <style name="LibreOfficeTheme" parent="LibreOfficeTheme.Base">
+ <item name="android:windowContentTransitions">true</item>
+ <item name="android:windowAllowEnterTransitionOverlap">true</item>
+ <item name="android:windowAllowReturnTransitionOverlap">true</item>
+ <item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
+ <item name="android:windowSharedElementExitTransition">@android:transition/move</item>
+ </style>
+</resources>
\ No newline at end of file
diff --git a/android/experimental/LOAndroid3/res/values/styles.xml b/android/experimental/LOAndroid3/res/values/styles.xml
deleted file mode 100644
index ff6c9d2..0000000
--- a/android/experimental/LOAndroid3/res/values/styles.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<resources>
-
- <!-- Base application theme. -->
- <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
- <!-- Customize your theme here. -->
- </style>
-
-</resources>
diff --git a/android/experimental/LOAndroid3/res/values/themes.xml b/android/experimental/LOAndroid3/res/values/themes.xml
new file mode 100644
index 0000000..f0853b8
--- /dev/null
+++ b/android/experimental/LOAndroid3/res/values/themes.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <style name="LibreOfficeTheme" parent="LibreOfficeTheme"/>
+
+ <style name="LibreOfficeTheme.Base" parent="Theme.AppCompat.Light">
+ <item name="android:windowNoTitle">true</item>
+ <item name="windowActionBar">false</item>
+ </style>
+
+ <style name="BrowserTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+ </style>
+</resources>
commit 044b4fb58682b359273cb604c2514692214b73e8
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon Mar 9 16:06:47 2015 +0900
android: add graphic selection
Change-Id: I9bf9193a2130316caca83030c4fb5dd588c5c0e0
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
index 9419782..5ea89be 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
@@ -66,6 +66,9 @@ public class InvalidationHandler implements Document.MessageCallback {
case Document.CALLBACK_CURSOR_VISIBLE:
cursorVisibility(payload);
break;
+ case Document.CALLBACK_GRAPHIC_SELECTION:
+ graphicSelection(payload);
+ break;
case Document.CALLBACK_HYPERLINK_CLICKED:
if (!payload.startsWith("http://") && !payload.startsWith("https://")) {
payload = "http://" + payload;
@@ -221,6 +224,19 @@ public class InvalidationHandler implements Document.MessageCallback {
}
}
+ /**
+ * Handles the graphic selection change message
+ * @param payload
+ */
+ private void graphicSelection(String payload) {
+ if (payload.isEmpty() || payload.equals("EMPTY")) {
+ mTextCursorLayer.changeSelections(Collections.EMPTY_LIST);
+ } else {
+ List<RectF> rects = convertPayloadToRectangles(payload);
+ mTextCursorLayer.changeSelections(rects);
+ }
+ }
+
public synchronized void changeStateTo(OverlayState next) {
changeState(mState, next);
}
More information about the Libreoffice-commits
mailing list