[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - 10 commits - android/README android/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.com
Fri Nov 13 03:10:00 PST 2015
android/README | 9
android/source/AndroidManifest.xml | 5
android/source/res/drawable-hdpi/ic_format_bold.xml | 5
android/source/res/drawable-hdpi/ic_format_italic.xml | 5
android/source/res/drawable-hdpi/ic_format_strikethrough.xml | 5
android/source/res/drawable-hdpi/ic_format_underlined.xml | 5
android/source/res/drawable-hdpi/ic_keyboard.xml | 5
android/source/res/drawable-hdpi/ic_menu.xml | 5
android/source/res/drawable-hdpi/ic_text_format.xml | 5
android/source/res/drawable-xxxhdpi/ic_check_black_24dp.png |binary
android/source/res/drawable-xxxhdpi/ic_format_align_center_black_24dp.png |binary
android/source/res/drawable-xxxhdpi/ic_format_align_justify_black_24dp.png |binary
android/source/res/drawable-xxxhdpi/ic_format_align_left_black_24dp.png |binary
android/source/res/drawable-xxxhdpi/ic_format_align_right_black_24dp.png |binary
android/source/res/drawable-xxxhdpi/ic_format_bold_black_24dp.png |binary
android/source/res/drawable-xxxhdpi/ic_format_italic_black_24dp.png |binary
android/source/res/drawable-xxxhdpi/ic_format_strikethrough_black_24dp.png |binary
android/source/res/drawable-xxxhdpi/ic_format_underlined_black_24dp.png |binary
android/source/res/drawable-xxxhdpi/ic_keyboard_black_24dp.png |binary
android/source/res/drawable-xxxhdpi/ic_menu_black_24dp.png |binary
android/source/res/drawable-xxxhdpi/ic_redo_black_24dp.png |binary
android/source/res/drawable-xxxhdpi/ic_search_black_24dp.png |binary
android/source/res/drawable-xxxhdpi/ic_search_direction_down_black_24dp.png |binary
android/source/res/drawable-xxxhdpi/ic_search_direction_up_black_24dp.png |binary
android/source/res/drawable-xxxhdpi/ic_text_format_black_24dp.png |binary
android/source/res/drawable-xxxhdpi/ic_undo_black_24dp.png |binary
android/source/res/drawable-xxxhdpi/image_button_background.xml | 6
android/source/res/drawable/ic_check.xml | 5
android/source/res/drawable/ic_format_align_center.xml | 5
android/source/res/drawable/ic_format_align_justify.xml | 5
android/source/res/drawable/ic_format_align_left.xml | 5
android/source/res/drawable/ic_format_align_right.xml | 5
android/source/res/drawable/ic_redo.xml | 5
android/source/res/drawable/ic_search.xml | 5
android/source/res/drawable/ic_search_direction_down.xml | 5
android/source/res/drawable/ic_search_direction_up.xml | 5
android/source/res/drawable/ic_undo.xml | 5
android/source/res/layout/about.xml | 4
android/source/res/layout/activity_main.xml | 12
android/source/res/layout/toolbar.xml | 6
android/source/res/layout/toolbar_bottom.xml | 175 +++++++
android/source/res/menu/main.xml | 35 -
android/source/res/values/attrs.xml | 17
android/source/res/values/colors.xml | 6
android/source/res/values/strings.xml | 5
android/source/res/values/themes.xml | 5
android/source/src/java/org/libreoffice/FontController.java | 203 ++++++++
android/source/src/java/org/libreoffice/FormattingController.java | 145 +++++
android/source/src/java/org/libreoffice/InvalidationHandler.java | 26 -
android/source/src/java/org/libreoffice/LOKitShell.java | 8
android/source/src/java/org/libreoffice/LOKitTileProvider.java | 11
android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java | 243 ++++++----
android/source/src/java/org/libreoffice/SearchController.java | 70 ++
android/source/src/java/org/libreoffice/ToolbarController.java | 134 +++--
android/source/src/java/org/libreoffice/UnitConverter.java | 12
android/source/src/java/org/libreoffice/canvas/BitmapHandle.java | 6
android/source/src/java/org/libreoffice/canvas/ImageUtils.java | 37 -
android/source/src/java/org/libreoffice/overlay/DocumentOverlay.java | 4
android/source/src/java/org/libreoffice/overlay/DocumentOverlayView.java | 4
dev/null |binary
60 files changed, 1058 insertions(+), 215 deletions(-)
New commits:
commit 538d4038dbaf4ed023ece6840e11cf7c7e51862f
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Fri Nov 13 12:05:28 2015 +0100
android: Fixes to AndroidManifest
Change-Id: I661b3de74066831f22757b587e8b367913030573
(cherry picked from commit 613ef01748bd155653954f1effe00e395ba38a3b)
diff --git a/android/source/AndroidManifest.xml b/android/source/AndroidManifest.xml
index 7721c69..d49771a 100644
--- a/android/source/AndroidManifest.xml
+++ b/android/source/AndroidManifest.xml
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.libreoffice"
- android:installLocation="${installLocation}">
+ package="org.libreoffice">
<!-- App requires OpenGL ES 2.0 -->
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
@@ -23,6 +22,8 @@
android:label="@string/app_name"
android:configChanges="orientation|keyboard|keyboardHidden|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@style/LibreOfficeTheme">
+ <!-- android:windowSoftInputMode="adjustResize" -->
+
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
commit 2672262e4a65a2dd8ec0253791c920cce1329b25
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Fri Nov 13 12:03:54 2015 +0100
android: add source of icons to README
Change-Id: Iad3ad138a9a7164d10ab6e51e22032ad115d08a5
(cherry picked from commit e4130895577106f0b7eb5530d4e1754794f53547)
diff --git a/android/README b/android/README
index 3f90a07..bd119ee 100644
--- a/android/README
+++ b/android/README
@@ -148,6 +148,15 @@ DocumentOverlay (org.libreoffice.overlay.DocumentOverlay) and DocumentOverlayVie
(org.libreoffice.overlay.DocumentOverlayView) are the classes that provide the overlay over
the document, where selections and the cursor is drawn.
+
+Icons
+*****
+
+App uses material design icons available at [1].
+
+
+[1] - https://www.google.com/design/icons/
+
Emulator and debugging notes
****************************
commit a07be0939f5a39d7e4166f96a559541a241b35a8
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Fri Nov 13 11:58:29 2015 +0100
android: don't set text color in about dialog
Change-Id: Iea5df81bb2f85376dc67e1cca63d5586a834e1b0
(cherry picked from commit 7b3f6dd1685bec33aae79c95584b461fdb72e879)
diff --git a/android/source/res/layout/about.xml b/android/source/res/layout/about.xml
index e8d8322..8968c00 100644
--- a/android/source/res/layout/about.xml
+++ b/android/source/res/layout/about.xml
@@ -15,7 +15,6 @@
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:text="@string/app_version"
- android:textColor="@android:color/secondary_text_light"
android:textSize="18sp"/>
<TextView
@@ -23,7 +22,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_description"
- android:textColor="@android:color/secondary_text_light"
android:textSize="18sp"/>
<TextView
@@ -34,7 +32,6 @@
android:paddingBottom="20dip"
android:paddingTop="20dip"
android:text="@string/app_credits"
- android:textColor="@android:color/secondary_text_light"
android:textSize="18sp"/>
<TextView
@@ -43,7 +40,6 @@
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:text="@string/app_vendor"
- android:textColor="@android:color/secondary_text_light"
android:textSize="18sp"/>
</LinearLayout>
</ScrollView>
commit 18377b13becbb1368f5b53ac960394263f4b30e7
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Fri Nov 13 11:32:41 2015 +0100
android: remove old unused action buttons (bold, italic,...)
Change-Id: I68d87af8ec2662208776d3b202d412145c86d9b2
(cherry picked from commit cb5fa33f0060df7649c6db8bc55be71d1e873def)
diff --git a/android/source/res/drawable-hdpi/action_bold.png b/android/source/res/drawable-hdpi/action_bold.png
deleted file mode 100644
index 1288718..0000000
Binary files a/android/source/res/drawable-hdpi/action_bold.png and /dev/null differ
diff --git a/android/source/res/drawable-hdpi/action_italic.png b/android/source/res/drawable-hdpi/action_italic.png
deleted file mode 100644
index 2b60b31..0000000
Binary files a/android/source/res/drawable-hdpi/action_italic.png and /dev/null differ
diff --git a/android/source/res/drawable-hdpi/action_strikeout.png b/android/source/res/drawable-hdpi/action_strikeout.png
deleted file mode 100644
index 5b5c2e9..0000000
Binary files a/android/source/res/drawable-hdpi/action_strikeout.png and /dev/null differ
diff --git a/android/source/res/drawable-hdpi/action_underline.png b/android/source/res/drawable-hdpi/action_underline.png
deleted file mode 100644
index 187f45e..0000000
Binary files a/android/source/res/drawable-hdpi/action_underline.png and /dev/null differ
diff --git a/android/source/res/drawable-mdpi/action_bold.png b/android/source/res/drawable-mdpi/action_bold.png
deleted file mode 100644
index 48b0100..0000000
Binary files a/android/source/res/drawable-mdpi/action_bold.png and /dev/null differ
diff --git a/android/source/res/drawable-mdpi/action_italic.png b/android/source/res/drawable-mdpi/action_italic.png
deleted file mode 100644
index 3485915..0000000
Binary files a/android/source/res/drawable-mdpi/action_italic.png and /dev/null differ
diff --git a/android/source/res/drawable-mdpi/action_strikeout.png b/android/source/res/drawable-mdpi/action_strikeout.png
deleted file mode 100644
index 4dc93b8..0000000
Binary files a/android/source/res/drawable-mdpi/action_strikeout.png and /dev/null differ
diff --git a/android/source/res/drawable-mdpi/action_underline.png b/android/source/res/drawable-mdpi/action_underline.png
deleted file mode 100644
index bbe053a..0000000
Binary files a/android/source/res/drawable-mdpi/action_underline.png and /dev/null differ
diff --git a/android/source/res/drawable-xhdpi/action_bold.png b/android/source/res/drawable-xhdpi/action_bold.png
deleted file mode 100644
index 1cea427..0000000
Binary files a/android/source/res/drawable-xhdpi/action_bold.png and /dev/null differ
diff --git a/android/source/res/drawable-xhdpi/action_italic.png b/android/source/res/drawable-xhdpi/action_italic.png
deleted file mode 100644
index 5117ecd..0000000
Binary files a/android/source/res/drawable-xhdpi/action_italic.png and /dev/null differ
diff --git a/android/source/res/drawable-xhdpi/action_strikeout.png b/android/source/res/drawable-xhdpi/action_strikeout.png
deleted file mode 100644
index 1bc46aa..0000000
Binary files a/android/source/res/drawable-xhdpi/action_strikeout.png and /dev/null differ
diff --git a/android/source/res/drawable-xhdpi/action_underline.png b/android/source/res/drawable-xhdpi/action_underline.png
deleted file mode 100644
index c4621f4..0000000
Binary files a/android/source/res/drawable-xhdpi/action_underline.png and /dev/null differ
diff --git a/android/source/res/drawable-xxxhdpi/action_bold.png b/android/source/res/drawable-xxxhdpi/action_bold.png
deleted file mode 100644
index 2e13c60..0000000
Binary files a/android/source/res/drawable-xxxhdpi/action_bold.png and /dev/null differ
diff --git a/android/source/res/drawable-xxxhdpi/action_italic.png b/android/source/res/drawable-xxxhdpi/action_italic.png
deleted file mode 100644
index 8b76698..0000000
Binary files a/android/source/res/drawable-xxxhdpi/action_italic.png and /dev/null differ
diff --git a/android/source/res/drawable-xxxhdpi/action_strikeout.png b/android/source/res/drawable-xxxhdpi/action_strikeout.png
deleted file mode 100644
index 090f6c2..0000000
Binary files a/android/source/res/drawable-xxxhdpi/action_strikeout.png and /dev/null differ
diff --git a/android/source/res/drawable-xxxhdpi/action_underline.png b/android/source/res/drawable-xxxhdpi/action_underline.png
deleted file mode 100644
index 357bc8b..0000000
Binary files a/android/source/res/drawable-xxxhdpi/action_underline.png and /dev/null differ
commit 285066804c47cf7730c41454cb99008c5b87c0c5
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Fri Nov 13 11:28:12 2015 +0100
android: rename "editMode" to "experimentalMode"
Change-Id: I3fcb7bb2fda925a1c5b2633ac7f6846fda0dabf8
(cherry picked from commit d30e0aea02efa0682d836808d79917dc8aadb93a)
diff --git a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
index 7027e37..dba7cff 100644
--- a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -58,7 +58,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
private static GeckoLayerClient mLayerClient;
private static LOKitThread sLOKitThread;
- private static boolean mEnableEditing;
+ private static boolean mIsExperimentalMode;
private int providerId;
private URI documentUri;
@@ -89,7 +89,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
}
public static boolean isExperimentalMode() {
- return mEnableEditing;
+ return mIsExperimentalMode;
}
public boolean usesTemporaryFile() {
@@ -103,7 +103,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
SharedPreferences sPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
- mEnableEditing = sPrefs.getBoolean(ENABLE_EXPERIMENTAL_PREFS_KEY, false);
+ mIsExperimentalMode = sPrefs.getBoolean(ENABLE_EXPERIMENTAL_PREFS_KEY, false);
if (sPrefs.getInt(ASSETS_EXTRACTED_PREFS_KEY, 0) != BuildConfig.VERSION_CODE) {
if(copyFromAssets(getAssets(), "unpack", getApplicationInfo().dataDir)) {
@@ -302,8 +302,8 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
Log.i(LOGTAG, "onResume..");
// check for config change
boolean bEnableExperimental = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getBoolean(ENABLE_EXPERIMENTAL_PREFS_KEY, false);
- if (bEnableExperimental != mEnableEditing) {
- mEnableEditing = bEnableExperimental;
+ if (bEnableExperimental != mIsExperimentalMode) {
+ mIsExperimentalMode = bEnableExperimental;
}
}
commit dde0854ef3c32daff6abfea314b5d14865c2e849
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Fri Nov 13 11:10:12 2015 +0100
android: add undo/redo to the main toolbar
Change-Id: I64f76d22018fcd8af2991933ba5ab2069f84181f
(cherry picked from commit 8908920488f514e015610d21f00481857c08776f)
diff --git a/android/source/res/drawable-xxxhdpi/ic_redo_black_24dp.png b/android/source/res/drawable-xxxhdpi/ic_redo_black_24dp.png
new file mode 100644
index 0000000..40f1075
Binary files /dev/null and b/android/source/res/drawable-xxxhdpi/ic_redo_black_24dp.png differ
diff --git a/android/source/res/drawable-xxxhdpi/ic_undo_black_24dp.png b/android/source/res/drawable-xxxhdpi/ic_undo_black_24dp.png
new file mode 100644
index 0000000..9ca7eb7
Binary files /dev/null and b/android/source/res/drawable-xxxhdpi/ic_undo_black_24dp.png differ
diff --git a/android/source/res/drawable/ic_redo.xml b/android/source/res/drawable/ic_redo.xml
new file mode 100644
index 0000000..eb4abef
--- /dev/null
+++ b/android/source/res/drawable/ic_redo.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/ic_redo_black_24dp"
+ android:tint="@color/toolbar_forgeround"/>
\ No newline at end of file
diff --git a/android/source/res/drawable/ic_undo.xml b/android/source/res/drawable/ic_undo.xml
new file mode 100644
index 0000000..12b9ce6
--- /dev/null
+++ b/android/source/res/drawable/ic_undo.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/ic_undo_black_24dp"
+ android:tint="@color/toolbar_forgeround"/>
\ No newline at end of file
diff --git a/android/source/res/menu/main.xml b/android/source/res/menu/main.xml
index d000be8..3ec0dad 100644
--- a/android/source/res/menu/main.xml
+++ b/android/source/res/menu/main.xml
@@ -7,6 +7,18 @@
tools:visible="true"
android:visible="false">
+ <item android:id="@+id/action_undo"
+ android:title="@string/action_undo"
+ android:icon="@drawable/ic_undo"
+ android:orderInCategory="100"
+ app:showAsAction="always"/>
+
+ <item android:id="@+id/action_redo"
+ android:title="@string/action_redo"
+ android:icon="@drawable/ic_redo"
+ android:orderInCategory="100"
+ app:showAsAction="always"/>
+
<item android:id="@+id/action_keyboard"
android:title="@string/action_keyboard"
android:icon="@drawable/ic_keyboard"
diff --git a/android/source/res/values/strings.xml b/android/source/res/values/strings.xml
index 9340b32..403f5b9 100644
--- a/android/source/res/values/strings.xml
+++ b/android/source/res/values/strings.xml
@@ -79,5 +79,8 @@
<string name="server_url_and_port">URL and port of the ownCloud server.</string>
<string name="user_name">User name</string>
<string name="password">Password</string>
+ <string name="action_undo">Undo</string>
+ <string name="action_redo">Redo</string>
+
</resources>
diff --git a/android/source/src/java/org/libreoffice/ToolbarController.java b/android/source/src/java/org/libreoffice/ToolbarController.java
index a03abc6..ec00abb 100644
--- a/android/source/src/java/org/libreoffice/ToolbarController.java
+++ b/android/source/src/java/org/libreoffice/ToolbarController.java
@@ -129,6 +129,12 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
case R.id.action_search:
mContext.showSearchToolbar();
return true;
+ case R.id.action_undo:
+ LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:Undo"));
+ return true;
+ case R.id.action_redo:
+ LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:Redo"));
+ return true;
}
return false;
}
commit bec54f3f070697959a6165a5a7ae7ef10a62a40d
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Fri Nov 13 11:01:37 2015 +0100
android: Add string searching + search toolbar
LOKit supports searching, but this was not implemented yet in the
Android GUI. This adds a bottom search toolbar where you can type
a search string + up/down search handles to search for the string
from the current cursor position.
Change-Id: Ia7461d2c6399c23201d2ea81f0b44c38533939a1
(cherry picked from commit 6636476cf06ccabc81fcc951f842a34a7f4b5840)
diff --git a/android/source/res/drawable-xxxhdpi/ic_search_black_24dp.png b/android/source/res/drawable-xxxhdpi/ic_search_black_24dp.png
new file mode 100644
index 0000000..21be572
Binary files /dev/null and b/android/source/res/drawable-xxxhdpi/ic_search_black_24dp.png differ
diff --git a/android/source/res/drawable-xxxhdpi/ic_search_direction_down_black_24dp.png b/android/source/res/drawable-xxxhdpi/ic_search_direction_down_black_24dp.png
new file mode 100644
index 0000000..ad852e3
Binary files /dev/null and b/android/source/res/drawable-xxxhdpi/ic_search_direction_down_black_24dp.png differ
diff --git a/android/source/res/drawable-xxxhdpi/ic_search_direction_up_black_24dp.png b/android/source/res/drawable-xxxhdpi/ic_search_direction_up_black_24dp.png
new file mode 100644
index 0000000..99c6e3e
Binary files /dev/null and b/android/source/res/drawable-xxxhdpi/ic_search_direction_up_black_24dp.png differ
diff --git a/android/source/res/drawable/ic_search.xml b/android/source/res/drawable/ic_search.xml
new file mode 100644
index 0000000..9dd529c
--- /dev/null
+++ b/android/source/res/drawable/ic_search.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/ic_search_black_24dp"
+ android:tint="@color/toolbar_forgeround"/>
\ No newline at end of file
diff --git a/android/source/res/drawable/ic_search_direction_down.xml b/android/source/res/drawable/ic_search_direction_down.xml
new file mode 100644
index 0000000..92ceced
--- /dev/null
+++ b/android/source/res/drawable/ic_search_direction_down.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/ic_search_direction_down_black_24dp"
+ android:tint="@color/toolbar_forgeround"/>
\ No newline at end of file
diff --git a/android/source/res/drawable/ic_search_direction_up.xml b/android/source/res/drawable/ic_search_direction_up.xml
new file mode 100644
index 0000000..a637060
--- /dev/null
+++ b/android/source/res/drawable/ic_search_direction_up.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/ic_search_direction_up_black_24dp"
+ android:tint="@color/toolbar_forgeround"/>
\ No newline at end of file
diff --git a/android/source/res/layout/toolbar_bottom.xml b/android/source/res/layout/toolbar_bottom.xml
index 7b4d01b..9de4906f 100644
--- a/android/source/res/layout/toolbar_bottom.xml
+++ b/android/source/res/layout/toolbar_bottom.xml
@@ -130,6 +130,45 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:minHeight="50dip"/>
+
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/search_toolbar"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="horizontal">
+
+ <EditText
+ android:id="@+id/search_string"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_weight="0.2"/>
+
+ <ImageButton
+ android:id="@+id/button_search_up"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_weight="0.6"
+ android:background="@drawable/image_button_background"
+ android:padding="10dp"
+ android:src="@drawable/ic_search_direction_down"/>
+
+ <ImageButton
+ android:id="@+id/button_search_down"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_weight="0.6"
+ android:background="@drawable/image_button_background"
+ android:padding="10dp"
+ android:src="@drawable/ic_search_direction_up"/>
+ </LinearLayout>
</LinearLayout>
</LinearLayout>
diff --git a/android/source/res/menu/main.xml b/android/source/res/menu/main.xml
index b80cae9..d000be8 100644
--- a/android/source/res/menu/main.xml
+++ b/android/source/res/menu/main.xml
@@ -19,6 +19,12 @@
android:orderInCategory="100"
app:showAsAction="always"/>
+ <item android:id="@+id/action_search"
+ android:title="@string/action_search"
+ android:icon="@drawable/ic_search"
+ android:orderInCategory="100"
+ app:showAsAction="always"/>
+
<item android:id="@+id/action_save"
android:title="@string/action_save"
android:orderInCategory="100" />
diff --git a/android/source/res/values/strings.xml b/android/source/res/values/strings.xml
index ed8529f..9340b32 100644
--- a/android/source/res/values/strings.xml
+++ b/android/source/res/values/strings.xml
@@ -65,6 +65,7 @@
<string name="action_keyboard">Show keyboard</string>
<string name="action_save">Save</string>
<string name="action_fromat">Enable Format</string>
+ <string name="action_search">Search</string>
<!-- Feedback messages -->
<string name="message_saved">Save complete</string>
diff --git a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
index 9c47ffe..7027e37 100644
--- a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -9,6 +9,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.AssetFileDescriptor;
import android.content.res.AssetManager;
+import android.graphics.RectF;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
@@ -77,6 +78,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
private FormattingController mFormattingController;
private ToolbarController mToolbarController;
private FontController mFontController;
+ private SearchController mSearchController;
public LibreOfficeMainActivity() {
mAbout = new LOAbout(this, false);
@@ -127,6 +129,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
});
mFontController = new FontController(this);
+ mSearchController = new SearchController(this);
if (getIntent().getData() != null) {
if (getIntent().getData().getScheme().equals(ContentResolver.SCHEME_CONTENT)) {
@@ -181,6 +184,10 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
mToolbarController.setupToolbars();
}
+ public RectF getCurrentCursorPosition() {
+ return mDocumentOverlay.getCurrentCursorPosition();
+ }
+
private boolean copyFileToTemp() {
ContentResolver contentResolver = getContentResolver();
FileChannel inputChannel = null;
@@ -430,6 +437,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
public void run() {
findViewById(R.id.toolbar_bottom).setVisibility(View.GONE);
findViewById(R.id.formatting_toolbar).setVisibility(View.GONE);
+ findViewById(R.id.search_toolbar).setVisibility(View.GONE);
}
});
}
@@ -440,6 +448,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
public void run() {
showBottomToolbar();
findViewById(R.id.formatting_toolbar).setVisibility(View.VISIBLE);
+ findViewById(R.id.search_toolbar).setVisibility(View.GONE);
hideSoftKeyboardDirect();
}
});
@@ -455,6 +464,28 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
});
}
+ public void showSearchToolbar() {
+ LOKitShell.getMainHandler().post(new Runnable() {
+ @Override
+ public void run() {
+ showBottomToolbar();
+ findViewById(R.id.formatting_toolbar).setVisibility(View.GONE);
+ findViewById(R.id.search_toolbar).setVisibility(View.VISIBLE);
+ hideSoftKeyboardDirect();
+ }
+ });
+ }
+
+ public void hideSearchToolbar() {
+ LOKitShell.getMainHandler().post(new Runnable() {
+ @Override
+ public void run() {
+ hideBottomToolbar();
+ findViewById(R.id.search_toolbar).setVisibility(View.GONE);
+ }
+ });
+ }
+
public void showProgressSpinner() {
findViewById(R.id.loadingPanel).setVisibility(View.VISIBLE);
}
diff --git a/android/source/src/java/org/libreoffice/SearchController.java b/android/source/src/java/org/libreoffice/SearchController.java
new file mode 100644
index 0000000..026a753
--- /dev/null
+++ b/android/source/src/java/org/libreoffice/SearchController.java
@@ -0,0 +1,70 @@
+package org.libreoffice;
+
+import android.view.View;
+import android.widget.EditText;
+import android.widget.ImageButton;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class SearchController implements View.OnClickListener {
+ private LibreOfficeMainActivity mActivity;
+
+ private enum SearchDriection {
+ UP, DOWN
+ };
+
+ public SearchController(LibreOfficeMainActivity activity) {
+ mActivity = activity;
+
+ ((ImageButton) activity.findViewById(R.id.button_search_up)).setOnClickListener(this);
+ ((ImageButton) activity.findViewById(R.id.button_search_down)).setOnClickListener(this);
+ }
+
+ private void search(String searchString, SearchDriection direction, float x, float y) {
+ try {
+ JSONObject rootJson = new JSONObject();
+
+ addProperty(rootJson, "SearchItem.SearchString", "string", searchString);
+ addProperty(rootJson, "SearchItem.Backward", "boolean", direction == SearchDriection.DOWN ? "true" : "false");
+ addProperty(rootJson, "SearchItem.SearchStartPointX", "long", String.valueOf((long) UnitConverter.pixelToTwip(x, LOKitShell.getDpi())));
+ addProperty(rootJson, "SearchItem.SearchStartPointY", "long", String.valueOf((long) UnitConverter.pixelToTwip(y, LOKitShell.getDpi())));
+ addProperty(rootJson, "SearchItem.Command", "long", String.valueOf(0)); // search all == 1
+
+ LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:ExecuteSearch", rootJson.toString()));
+
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void addProperty(JSONObject json, String parentValue, String type, String value) throws JSONException {
+ JSONObject child = new JSONObject();
+ child.put("type", type);
+ child.put("value", value);
+ json.put(parentValue, child);
+ }
+
+ @Override
+ public void onClick(View view) {
+ ImageButton button = (ImageButton) view;
+
+ SearchDriection direction = SearchDriection.DOWN;
+ switch(button.getId()) {
+ case R.id.button_search_down:
+ direction = SearchDriection.DOWN;
+ break;
+ case R.id.button_search_up:
+ direction = SearchDriection.UP;
+ break;
+ default:
+ break;
+ }
+
+ String searchText = ((EditText) mActivity.findViewById(R.id.search_string)).getText().toString();
+
+ float x = mActivity.getCurrentCursorPosition().centerX();
+ float y = mActivity.getCurrentCursorPosition().centerY();
+ search(searchText, direction, x, y);
+ }
+}
diff --git a/android/source/src/java/org/libreoffice/ToolbarController.java b/android/source/src/java/org/libreoffice/ToolbarController.java
index 08e981c..a03abc6 100644
--- a/android/source/src/java/org/libreoffice/ToolbarController.java
+++ b/android/source/src/java/org/libreoffice/ToolbarController.java
@@ -126,6 +126,9 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
case R.id.action_settings:
mContext.showSettings();
return true;
+ case R.id.action_search:
+ mContext.showSearchToolbar();
+ return true;
}
return false;
}
diff --git a/android/source/src/java/org/libreoffice/UnitConverter.java b/android/source/src/java/org/libreoffice/UnitConverter.java
new file mode 100644
index 0000000..e0dcfb8
--- /dev/null
+++ b/android/source/src/java/org/libreoffice/UnitConverter.java
@@ -0,0 +1,12 @@
+package org.libreoffice;
+
+
+public class UnitConverter {
+ public static float twipToPixel(float input, float dpi) {
+ return input / 1440.0f * dpi;
+ }
+
+ public static float pixelToTwip(float input, float dpi) {
+ return (input / dpi) * 1440.0f;
+ }
+}
diff --git a/android/source/src/java/org/libreoffice/overlay/DocumentOverlay.java b/android/source/src/java/org/libreoffice/overlay/DocumentOverlay.java
index 40e4eaa..f2c4c8f 100644
--- a/android/source/src/java/org/libreoffice/overlay/DocumentOverlay.java
+++ b/android/source/src/java/org/libreoffice/overlay/DocumentOverlay.java
@@ -205,6 +205,10 @@ public class DocumentOverlay {
}
});
}
+
+ public RectF getCurrentCursorPosition() {
+ return mDocumentOverlayView.getCurrentCursorPosition();
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/source/src/java/org/libreoffice/overlay/DocumentOverlayView.java b/android/source/src/java/org/libreoffice/overlay/DocumentOverlayView.java
index 8d199e4..ce600dc 100644
--- a/android/source/src/java/org/libreoffice/overlay/DocumentOverlayView.java
+++ b/android/source/src/java/org/libreoffice/overlay/DocumentOverlayView.java
@@ -384,6 +384,10 @@ public class DocumentOverlayView extends View implements View.OnTouchListener {
}
return null;
}
+
+ public RectF getCurrentCursorPosition() {
+ return mCursor.mPosition;
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 5b43e10603d078fa81470e41dfee4afa6498668e
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Wed Nov 11 11:45:53 2015 +0100
android: Add bottom formatting toolbar
The bottom formatting toolbar now shows the formatting options
previously located in the main toolbar as a menu entry (bold,
italic, ...). In addition alignment options and selection of fonts
and sizes have been added.
Bottom formatting toolbar is not shown by default - it enables when
hitting the icon in main toolbar. Also soft keyboard and formatting
toolbar should not be shown at the same time.
Change-Id: I5f6cf8a9fcbdb4d154ae7504a65f9a226c99d694
(cherry picked from commit 319623a3345b5cb11f0d42c6e7781734ff1a3a40)
diff --git a/android/source/res/drawable-hdpi/ic_format_bold.xml b/android/source/res/drawable-hdpi/ic_format_bold.xml
new file mode 100644
index 0000000..83de647
--- /dev/null
+++ b/android/source/res/drawable-hdpi/ic_format_bold.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/ic_format_bold_black_24dp"
+ android:tint="@color/toolbar_forgeround"/>
\ No newline at end of file
diff --git a/android/source/res/drawable-hdpi/ic_format_italic.xml b/android/source/res/drawable-hdpi/ic_format_italic.xml
new file mode 100644
index 0000000..515568a
--- /dev/null
+++ b/android/source/res/drawable-hdpi/ic_format_italic.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/ic_format_italic_black_24dp"
+ android:tint="@color/toolbar_forgeround"/>
\ No newline at end of file
diff --git a/android/source/res/drawable-hdpi/ic_format_strikethrough.xml b/android/source/res/drawable-hdpi/ic_format_strikethrough.xml
new file mode 100644
index 0000000..4ca24bc
--- /dev/null
+++ b/android/source/res/drawable-hdpi/ic_format_strikethrough.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/ic_format_strikethrough_black_24dp"
+ android:tint="@color/toolbar_forgeround"/>
\ No newline at end of file
diff --git a/android/source/res/drawable-hdpi/ic_format_underlined.xml b/android/source/res/drawable-hdpi/ic_format_underlined.xml
new file mode 100644
index 0000000..89beb91
--- /dev/null
+++ b/android/source/res/drawable-hdpi/ic_format_underlined.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/ic_format_underlined_black_24dp"
+ android:tint="@color/toolbar_forgeround"/>
\ No newline at end of file
diff --git a/android/source/res/drawable-hdpi/ic_keyboard.xml b/android/source/res/drawable-hdpi/ic_keyboard.xml
new file mode 100644
index 0000000..d95890b
--- /dev/null
+++ b/android/source/res/drawable-hdpi/ic_keyboard.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/ic_keyboard_black_24dp"
+ android:tint="@color/toolbar_forgeround"/>
\ No newline at end of file
diff --git a/android/source/res/drawable-hdpi/ic_menu.xml b/android/source/res/drawable-hdpi/ic_menu.xml
new file mode 100644
index 0000000..62440f0
--- /dev/null
+++ b/android/source/res/drawable-hdpi/ic_menu.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/ic_menu_black_24dp"
+ android:tint="@color/toolbar_forgeround"/>
\ No newline at end of file
diff --git a/android/source/res/drawable-hdpi/ic_text_format.xml b/android/source/res/drawable-hdpi/ic_text_format.xml
new file mode 100644
index 0000000..20a7869
--- /dev/null
+++ b/android/source/res/drawable-hdpi/ic_text_format.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/ic_text_format_black_24dp"
+ android:tint="@color/toolbar_forgeround"/>
\ No newline at end of file
diff --git a/android/source/res/drawable-xxxhdpi/ic_check_black_24dp.png b/android/source/res/drawable-xxxhdpi/ic_check_black_24dp.png
new file mode 100644
index 0000000..2f6d638
Binary files /dev/null and b/android/source/res/drawable-xxxhdpi/ic_check_black_24dp.png differ
diff --git a/android/source/res/drawable-xxxhdpi/ic_check_grey600_24dp.png b/android/source/res/drawable-xxxhdpi/ic_check_grey600_24dp.png
deleted file mode 100644
index 121ac9a..0000000
Binary files a/android/source/res/drawable-xxxhdpi/ic_check_grey600_24dp.png and /dev/null differ
diff --git a/android/source/res/drawable-xxxhdpi/ic_format_align_center_black_24dp.png b/android/source/res/drawable-xxxhdpi/ic_format_align_center_black_24dp.png
new file mode 100644
index 0000000..b20b21b
Binary files /dev/null and b/android/source/res/drawable-xxxhdpi/ic_format_align_center_black_24dp.png differ
diff --git a/android/source/res/drawable-xxxhdpi/ic_format_align_justify_black_24dp.png b/android/source/res/drawable-xxxhdpi/ic_format_align_justify_black_24dp.png
new file mode 100644
index 0000000..15eece7
Binary files /dev/null and b/android/source/res/drawable-xxxhdpi/ic_format_align_justify_black_24dp.png differ
diff --git a/android/source/res/drawable-xxxhdpi/ic_format_align_left_black_24dp.png b/android/source/res/drawable-xxxhdpi/ic_format_align_left_black_24dp.png
new file mode 100644
index 0000000..c1d927a
Binary files /dev/null and b/android/source/res/drawable-xxxhdpi/ic_format_align_left_black_24dp.png differ
diff --git a/android/source/res/drawable-xxxhdpi/ic_format_align_right_black_24dp.png b/android/source/res/drawable-xxxhdpi/ic_format_align_right_black_24dp.png
new file mode 100644
index 0000000..e5b3063
Binary files /dev/null and b/android/source/res/drawable-xxxhdpi/ic_format_align_right_black_24dp.png differ
diff --git a/android/source/res/drawable-xxxhdpi/ic_format_bold_black_24dp.png b/android/source/res/drawable-xxxhdpi/ic_format_bold_black_24dp.png
new file mode 100644
index 0000000..4d8b8f4
Binary files /dev/null and b/android/source/res/drawable-xxxhdpi/ic_format_bold_black_24dp.png differ
diff --git a/android/source/res/drawable-xxxhdpi/ic_format_italic_black_24dp.png b/android/source/res/drawable-xxxhdpi/ic_format_italic_black_24dp.png
new file mode 100644
index 0000000..cf85387
Binary files /dev/null and b/android/source/res/drawable-xxxhdpi/ic_format_italic_black_24dp.png differ
diff --git a/android/source/res/drawable-xxxhdpi/ic_format_keyboard_grey600_24dp.png b/android/source/res/drawable-xxxhdpi/ic_format_keyboard_grey600_24dp.png
deleted file mode 100644
index f9ae47e..0000000
Binary files a/android/source/res/drawable-xxxhdpi/ic_format_keyboard_grey600_24dp.png and /dev/null differ
diff --git a/android/source/res/drawable-xxxhdpi/ic_format_strikethrough_black_24dp.png b/android/source/res/drawable-xxxhdpi/ic_format_strikethrough_black_24dp.png
new file mode 100644
index 0000000..f94704e
Binary files /dev/null and b/android/source/res/drawable-xxxhdpi/ic_format_strikethrough_black_24dp.png differ
diff --git a/android/source/res/drawable-xxxhdpi/ic_format_underlined_black_24dp.png b/android/source/res/drawable-xxxhdpi/ic_format_underlined_black_24dp.png
new file mode 100644
index 0000000..8a2adce
Binary files /dev/null and b/android/source/res/drawable-xxxhdpi/ic_format_underlined_black_24dp.png differ
diff --git a/android/source/res/drawable-xxxhdpi/ic_keyboard_black_24dp.png b/android/source/res/drawable-xxxhdpi/ic_keyboard_black_24dp.png
new file mode 100644
index 0000000..ba4d5be
Binary files /dev/null and b/android/source/res/drawable-xxxhdpi/ic_keyboard_black_24dp.png differ
diff --git a/android/source/res/drawable-xxxhdpi/ic_menu_black_24dp.png b/android/source/res/drawable-xxxhdpi/ic_menu_black_24dp.png
new file mode 100644
index 0000000..5c747ed
Binary files /dev/null and b/android/source/res/drawable-xxxhdpi/ic_menu_black_24dp.png differ
diff --git a/android/source/res/drawable-xxxhdpi/ic_menu_grey600_24dp.png b/android/source/res/drawable-xxxhdpi/ic_menu_grey600_24dp.png
deleted file mode 100644
index 873fa7a..0000000
Binary files a/android/source/res/drawable-xxxhdpi/ic_menu_grey600_24dp.png and /dev/null differ
diff --git a/android/source/res/drawable-xxxhdpi/ic_text_format_black_24dp.png b/android/source/res/drawable-xxxhdpi/ic_text_format_black_24dp.png
new file mode 100644
index 0000000..f380636
Binary files /dev/null and b/android/source/res/drawable-xxxhdpi/ic_text_format_black_24dp.png differ
diff --git a/android/source/res/drawable-xxxhdpi/image_button_background.xml b/android/source/res/drawable-xxxhdpi/image_button_background.xml
new file mode 100644
index 0000000..db8b67b
--- /dev/null
+++ b/android/source/res/drawable-xxxhdpi/image_button_background.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:drawable="@color/button_selected_background" android:state_pressed="true"/>
+ <item android:drawable="@color/button_selected_background" android:state_selected="true" />
+ <item android:drawable="@android:color/transparent" android:state_selected="false" />
+</selector>
\ No newline at end of file
diff --git a/android/source/res/drawable/ic_check.xml b/android/source/res/drawable/ic_check.xml
new file mode 100644
index 0000000..be95fc8
--- /dev/null
+++ b/android/source/res/drawable/ic_check.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/ic_check_black_24dp"
+ android:tint="@color/toolbar_forgeround"/>
\ No newline at end of file
diff --git a/android/source/res/drawable/ic_format_align_center.xml b/android/source/res/drawable/ic_format_align_center.xml
new file mode 100644
index 0000000..5c2b4a0
--- /dev/null
+++ b/android/source/res/drawable/ic_format_align_center.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/ic_format_align_center_black_24dp"
+ android:tint="@color/toolbar_forgeround"/>
\ No newline at end of file
diff --git a/android/source/res/drawable/ic_format_align_justify.xml b/android/source/res/drawable/ic_format_align_justify.xml
new file mode 100644
index 0000000..e1e69e2
--- /dev/null
+++ b/android/source/res/drawable/ic_format_align_justify.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/ic_format_align_justify_black_24dp"
+ android:tint="@color/toolbar_forgeround"/>
\ No newline at end of file
diff --git a/android/source/res/drawable/ic_format_align_left.xml b/android/source/res/drawable/ic_format_align_left.xml
new file mode 100644
index 0000000..497a94f
--- /dev/null
+++ b/android/source/res/drawable/ic_format_align_left.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/ic_format_align_left_black_24dp"
+ android:tint="@color/toolbar_forgeround"/>
\ No newline at end of file
diff --git a/android/source/res/drawable/ic_format_align_right.xml b/android/source/res/drawable/ic_format_align_right.xml
new file mode 100644
index 0000000..a8d6dfb
--- /dev/null
+++ b/android/source/res/drawable/ic_format_align_right.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/ic_format_align_right_black_24dp"
+ android:tint="@color/toolbar_forgeround"/>
\ No newline at end of file
diff --git a/android/source/res/layout/activity_main.xml b/android/source/res/layout/activity_main.xml
index 63695e5..881466d 100644
--- a/android/source/res/layout/activity_main.xml
+++ b/android/source/res/layout/activity_main.xml
@@ -12,9 +12,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
+ <include layout="@layout/toolbar"/>
+
+ <include layout="@layout/toolbar_bottom"/>
+
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:layout_above="@+id/toolbar_bottom"
android:orientation="vertical">
<include layout="@layout/toolbar"/>
@@ -30,7 +35,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent"/>
- <include layout="@layout/text_selection_handles"/>
+ <org.libreoffice.overlay.DocumentOverlayView
+ android:id="@+id/text_cursor_view"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"/>
</RelativeLayout>
</LinearLayout>
@@ -43,9 +51,11 @@
android:gravity="center">
<ProgressBar
+ android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true"/>
+
</RelativeLayout>
<View
diff --git a/android/source/res/layout/toolbar_bottom.xml b/android/source/res/layout/toolbar_bottom.xml
new file mode 100644
index 0000000..7b4d01b
--- /dev/null
+++ b/android/source/res/layout/toolbar_bottom.xml
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<android.support.v7.widget.Toolbar
+ android:id="@+id/toolbar_bottom"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:elevation="3dp"
+ android:background="@color/toolbar_background"
+ app:popupTheme="@style/LibreOfficeTheme.Toolbar"
+ app:theme="@style/LibreOfficeTheme.Toolbar"
+ tools:showIn="@layout/activity_main">
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:id="@+id/formatting_toolbar"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <ImageButton
+ android:id="@+id/button_bold"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.25"
+ android:background="@drawable/image_button_background"
+ android:paddingBottom="5dp"
+ android:paddingTop="5dp"
+ android:src="@drawable/ic_format_bold"/>
+
+ <ImageButton
+ android:id="@+id/button_italic"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.25"
+ android:background="@drawable/image_button_background"
+ android:paddingBottom="5dp"
+ android:paddingTop="5dp"
+ android:src="@drawable/ic_format_italic"/>
+
+ <ImageButton
+ android:id="@+id/button_underlined"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.25"
+ android:background="@drawable/image_button_background"
+ android:paddingBottom="5dp"
+ android:paddingTop="5dp"
+ android:src="@drawable/ic_format_underlined"/>
+
+ <ImageButton
+ android:id="@+id/button_strikethrough"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.25"
+ android:background="@drawable/image_button_background"
+ android:paddingBottom="5dp"
+ android:paddingTop="5dp"
+ android:src="@drawable/ic_format_strikethrough"/>
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <ImageButton
+ android:id="@+id/button_align_left"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.25"
+ android:background="@drawable/image_button_background"
+ android:paddingBottom="5dp"
+ android:paddingTop="5dp"
+ android:src="@drawable/ic_format_align_left"/>
+
+ <ImageButton
+ android:id="@+id/button_align_center"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.25"
+ android:background="@drawable/image_button_background"
+ android:paddingBottom="5dp"
+ android:paddingTop="5dp"
+ android:src="@drawable/ic_format_align_center"/>
+
+ <ImageButton
+ android:id="@+id/button_align_right"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.25"
+ android:background="@drawable/image_button_background"
+ android:paddingBottom="5dp"
+ android:paddingTop="5dp"
+ android:src="@drawable/ic_format_align_right"/>
+
+ <ImageButton
+ android:id="@+id/button_align_justify"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.25"
+ android:background="@drawable/image_button_background"
+ android:paddingBottom="5dp"
+ android:paddingTop="5dp"
+ android:src="@drawable/ic_format_align_justify"/>
+ </LinearLayout>
+
+ <Spinner
+ android:id="@+id/font_name_spinner"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:minHeight="50dip"/>
+
+ <Spinner
+ android:id="@+id/font_size_spinner"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:minHeight="50dip"/>
+ </LinearLayout>
+ </LinearLayout>
+
+</android.support.v7.widget.Toolbar>
diff --git a/android/source/res/menu/main.xml b/android/source/res/menu/main.xml
index ccf0dce..b80cae9 100644
--- a/android/source/res/menu/main.xml
+++ b/android/source/res/menu/main.xml
@@ -6,36 +6,19 @@
<group android:id="@+id/group_edit_actions"
tools:visible="true"
android:visible="false">
- <item android:id="@+id/action_bold"
- android:title="@string/action_bold"
- android:icon="@drawable/action_bold"
- android:orderInCategory="100"
- app:showAsAction="always"/>
-
- <item android:id="@+id/action_italic"
- android:title="@string/action_italic"
- android:icon="@drawable/action_italic"
- android:orderInCategory="100"
- app:showAsAction="always"/>
-
- <item android:id="@+id/action_underline"
- android:title="@string/action_underline"
- android:icon="@drawable/action_underline"
- android:orderInCategory="100"
- app:showAsAction="always"/>
-
- <item android:id="@+id/action_strikeout"
- android:title="@string/action_strikeout"
- android:icon="@drawable/action_strikeout"
- android:orderInCategory="100"
- app:showAsAction="always"/>
<item android:id="@+id/action_keyboard"
android:title="@string/action_keyboard"
- android:icon="@drawable/ic_format_keyboard_grey600_24dp"
+ android:icon="@drawable/ic_keyboard"
android:orderInCategory="100"
app:showAsAction="always"/>
+ <item android:id="@+id/action_format"
+ android:title="@string/action_fromat"
+ android:icon="@drawable/ic_text_format"
+ android:orderInCategory="100"
+ app:showAsAction="always"/>
+
<item android:id="@+id/action_save"
android:title="@string/action_save"
android:orderInCategory="100" />
diff --git a/android/source/res/values/colors.xml b/android/source/res/values/colors.xml
index 89d1062..8cd9e95 100644
--- a/android/source/res/values/colors.xml
+++ b/android/source/res/values/colors.xml
@@ -95,7 +95,8 @@
<color name="toolbar_forgeround">#3e3e3e</color>
<color name="toolbar_background">#ffffff</color>
- <color name="handle_color">#40A040</color>
+ <color name="handle_color">#26a69a</color>
+ <color name="button_selected_background">#33000000</color>
</resources>
diff --git a/android/source/res/values/strings.xml b/android/source/res/values/strings.xml
index 78318b9..ed8529f 100644
--- a/android/source/res/values/strings.xml
+++ b/android/source/res/values/strings.xml
@@ -64,6 +64,7 @@
<string name="action_strikeout">Strike Out</string>
<string name="action_keyboard">Show keyboard</string>
<string name="action_save">Save</string>
+ <string name="action_fromat">Enable Format</string>
<!-- Feedback messages -->
<string name="message_saved">Save complete</string>
diff --git a/android/source/src/java/org/libreoffice/FontController.java b/android/source/src/java/org/libreoffice/FontController.java
new file mode 100644
index 0000000..46110db
--- /dev/null
+++ b/android/source/src/java/org/libreoffice/FontController.java
@@ -0,0 +1,203 @@
+package org.libreoffice;
+
+import android.app.Activity;
+import android.content.Context;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.Spinner;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+public class FontController implements AdapterView.OnItemSelectedListener {
+
+ private boolean mFontNameSpinnerSet = false;
+ private boolean mFontSizeSpinnerSet = false;
+ private Activity mActivity;
+ private List<String> mFontList = null;
+ private List<String> mFontSizes = new ArrayList<String>();
+ private Map<String, List<String>> mAllFontSizes = null;
+
+ private String mCurrentFontSelected = null;
+ private String mCurrentFontSizeSelected = null;
+
+ public FontController(Activity activity) {
+ mActivity = activity;
+ }
+
+ private void sendFontChange(String fontName) {
+ try {
+ JSONObject json = new JSONObject();
+ JSONObject valueJson = new JSONObject();
+ valueJson.put("type", "string");
+ valueJson.put("value", fontName);
+ json.put("CharFontName.FamilyName", valueJson);
+
+ LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:CharFontName", json.toString()));
+
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void sendFontSizeChange(String fontSize) {
+ try {
+ JSONObject json = new JSONObject();
+ JSONObject valueJson = new JSONObject();
+ valueJson.put("type", "float");
+ valueJson.put("value", fontSize);
+ json.put("FontHeight.Height", valueJson);
+
+ LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:FontHeight", json.toString()));
+
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
+ if (mFontList == null || !mFontNameSpinnerSet)
+ return;
+ if (parent == mActivity.findViewById(R.id.font_name_spinner)) {
+ String currentFontSelected = parent.getItemAtPosition(pos).toString();
+ if (!currentFontSelected.equals(mCurrentFontSelected)) {
+ mCurrentFontSelected = currentFontSelected;
+ sendFontChange(mCurrentFontSelected);
+ }
+ } else if (parent == mActivity.findViewById(R.id.font_size_spinner)) {
+ String currentFontSizeSelected = parent.getItemAtPosition(pos).toString();
+ if (!currentFontSizeSelected.equals(mCurrentFontSizeSelected)) {
+ mCurrentFontSizeSelected = currentFontSizeSelected;
+ sendFontSizeChange(mCurrentFontSizeSelected);
+ }
+ }
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView parent) {
+ // Do nothing.
+ }
+
+ public void parseJson(String json) {
+ mFontList = new ArrayList<String>();
+ mAllFontSizes = new HashMap<String, List<String>>();
+ try {
+ JSONObject jObject = new JSONObject(json);
+ JSONObject jObject2 = jObject.getJSONObject("commandValues");
+ Iterator<String> keys = jObject2.keys();
+ List<String> fontSizes;
+ while (keys.hasNext()) {
+ String key = keys.next();
+ mFontList.add(key);
+ JSONArray array = jObject2.getJSONArray(key);
+ fontSizes = new ArrayList<String>();
+ for (int i = 0; i < array.length(); i++) {
+ fontSizes.add(array.getString(i));
+ }
+ mAllFontSizes.put(key, fontSizes);
+ }
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void setupFontViews() {
+ LOKitShell.getMainHandler().post(new Runnable() {
+ public void run() {
+ setupFontNameSpinner();
+ setupFontSizeSpinner();
+ }
+ });
+ }
+
+ private void setupFontNameSpinner() {
+ Spinner fontSpinner = (Spinner) mActivity.findViewById(R.id.font_name_spinner);
+ ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(mActivity, android.R.layout.simple_spinner_item, mFontList);
+ dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ fontSpinner.setAdapter(dataAdapter);
+ }
+
+ private void setupFontSizeSpinner() {
+ Spinner fontSizeSpinner = (Spinner) mActivity.findViewById(R.id.font_size_spinner);
+ ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(mActivity, android.R.layout.simple_spinner_item, mFontSizes);
+ dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ fontSizeSpinner.setAdapter(dataAdapter);
+ }
+
+ public void selectFont(final String fontName) {
+ LOKitShell.getMainHandler().post(new Runnable() {
+ public void run() {
+ selectFontCurrentThread(fontName);
+ }
+ });
+ }
+
+ private void selectFontCurrentThread(String fontName) {
+ Spinner spinner = (Spinner) mActivity.findViewById(R.id.font_name_spinner);
+
+ if (!mFontNameSpinnerSet) {
+ spinner.setOnItemSelectedListener(this);
+ mFontNameSpinnerSet = true;
+ }
+
+ if (fontName.equals(mCurrentFontSelected))
+ return;
+
+ ArrayAdapter<String> arrayAdapter = (ArrayAdapter<String>) spinner.getAdapter();
+ int position = arrayAdapter.getPosition(fontName);
+ if (position != -1) {
+ mCurrentFontSelected = fontName;
+ spinner.setSelection(position);
+ }
+
+ resetFontSizes(fontName);
+ }
+
+ private void resetFontSizes(String fontName) {
+ Spinner spinner = (Spinner) mActivity.findViewById(R.id.font_size_spinner);
+ ArrayAdapter<String> arrayAdapter = (ArrayAdapter<String>) spinner.getAdapter();
+
+ List<String> fontSizes = mAllFontSizes.get(fontName);
+ if (fontSizes != null) {
+ arrayAdapter.clear();
+ arrayAdapter.addAll(mAllFontSizes.get(fontName));
+ }
+ }
+
+ public void selectFontSize(final String fontSize) {
+ LOKitShell.getMainHandler().post(new Runnable() {
+ public void run() {
+ selectFontSizeCurrentThread(fontSize);
+ }
+ });
+ }
+
+ private void selectFontSizeCurrentThread(String fontSize) {
+ Spinner spinner = (Spinner) mActivity.findViewById(R.id.font_size_spinner);
+ if (!mFontSizeSpinnerSet) {
+ spinner.setOnItemSelectedListener(this);
+ mFontSizeSpinnerSet = true;
+ }
+
+ if (fontSize.equals(mCurrentFontSizeSelected))
+ return;
+
+ ArrayAdapter<String> arrayAdapter = (ArrayAdapter<String>) spinner.getAdapter();
+
+ int position = arrayAdapter.getPosition(fontSize);
+ if (position != -1) {
+ mCurrentFontSizeSelected = fontSize;
+ spinner.setSelection(position, false);
+ }
+
+ }
+}
diff --git a/android/source/src/java/org/libreoffice/FormattingController.java b/android/source/src/java/org/libreoffice/FormattingController.java
new file mode 100644
index 0000000..26ea085
--- /dev/null
+++ b/android/source/src/java/org/libreoffice/FormattingController.java
@@ -0,0 +1,145 @@
+package org.libreoffice;
+
+import android.content.Context;
+import android.support.v7.app.ActionBar;
+import android.support.v7.widget.Toolbar;
+import android.util.Log;
+import android.view.Menu;
+import android.view.View;
+import android.widget.ImageButton;
+
+import org.libreoffice.kit.Document;
+
+public class FormattingController implements View.OnClickListener {
+ private static final String LOGTAG = ToolbarController.class.getSimpleName();
+
+ private final Toolbar mToolbarBottom;
+ private LibreOfficeMainActivity mContext;
+
+ public FormattingController(LibreOfficeMainActivity context, Toolbar toolbarBottom) {
+ mToolbarBottom = toolbarBottom;
+ mContext = context;
+
+ ((ImageButton) context.findViewById(R.id.button_bold)).setOnClickListener(this);
+ ((ImageButton) context.findViewById(R.id.button_italic)).setOnClickListener(this);
+ ((ImageButton) context.findViewById(R.id.button_strikethrough)).setOnClickListener(this);
+ ((ImageButton) context.findViewById(R.id.button_underlined)).setOnClickListener(this);
+
+ ((ImageButton) context.findViewById(R.id.button_align_left)).setOnClickListener(this);
+ ((ImageButton) context.findViewById(R.id.button_align_center)).setOnClickListener(this);
+ ((ImageButton) context.findViewById(R.id.button_align_right)).setOnClickListener(this);
+ ((ImageButton) context.findViewById(R.id.button_align_justify)).setOnClickListener(this);
+ }
+
+ @Override
+ public void onClick(View view) {
+ ImageButton button = (ImageButton) view;
+ boolean selected = button.isSelected();;
+ button.setSelected(selected);
+
+ if (selected) {
+ button.getBackground().setState(new int[]{-android.R.attr.state_selected});
+ } else {
+ button.getBackground().setState(new int[]{android.R.attr.state_selected});
+ }
+
+ switch(button.getId()) {
+ case R.id.button_bold:
+ LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:Bold"));
+ break;
+ case R.id.button_italic:
+ LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:Italic"));
+ break;
+ case R.id.button_strikethrough:
+ LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:Underline"));
+ break;
+ case R.id.button_underlined:
+ LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:Strikeout"));
+ break;
+ case R.id.button_align_left:
+ LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:LeftPara"));
+ break;
+ case R.id.button_align_center:
+ LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:CenterPara"));
+ break;
+ case R.id.button_align_right:
+ LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:RightPara"));
+ break;
+ case R.id.button_align_justify:
+ LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:JustifyPara"));
+ break;
+ default:
+ break;
+ }
+ }
+
+ public void onToggleStateChanged(final int type, final boolean selected) {
+ LOKitShell.getMainHandler().post(new Runnable() {
+ public void run() {
+ Integer buttonId = null;
+ switch (type) {
+ case Document.BOLD:
+ buttonId = R.id.button_bold;
+ break;
+ case Document.ITALIC:
+ buttonId = R.id.button_italic;
+ break;
+ case Document.UNDERLINE:
+ buttonId = R.id.button_strikethrough;
+ break;
+ case Document.STRIKEOUT:
+ buttonId = R.id.button_underlined;
+ break;
+ case Document.ALIGN_LEFT:
+ buttonId = R.id.button_align_left;
+ break;
+ case Document.ALIGN_CENTER:
+ buttonId = R.id.button_align_center;
+ break;
+ case Document.ALIGN_RIGHT:
+ buttonId = R.id.button_align_right;
+ break;
+ case Document.ALIGN_JUSTIFY:
+ buttonId = R.id.button_align_justify;
+ break;
+ default:
+ Log.e(LOGTAG, "Uncaptured state change type: " + type);
+ return;
+ }
+
+ LibreOfficeMainActivity activity = LibreOfficeMainActivity.mAppContext;
+ ImageButton button = (ImageButton) activity.findViewById(buttonId);
+ button.setSelected(selected);
+ if (selected) {
+ button.getBackground().setState(new int[]{android.R.attr.state_selected});
+ } else {
+ button.getBackground().setState(new int[]{-android.R.attr.state_selected});
+ }
+ }
+ });
+
+
+ /*if (menuItem == null) {
+ Log.e(LOGTAG, "MenuItem not found.");
+ return;
+ }
+
+ final Drawable drawable;
+ if (pressed) {
+ Resources resources = mContext.getResources();
+ Drawable[] layers = new Drawable[2];
+ layers[0] = resources.getDrawable(R.drawable.icon_background);
+ layers[1] = resources.getDrawable(drawableId);
+ drawable = new LayerDrawable(layers);
+ } else {
+ drawable = mContext.getResources().getDrawable(drawableId);
+ }
+
+ final MenuItem fMenuItem = menuItem;
+ LOKitShell.getMainHandler().post(new Runnable() {
+ public void run() {
+ fMenuItem.setIcon(drawable);
+ }
+ });*/
+ }
+}
diff --git a/android/source/src/java/org/libreoffice/InvalidationHandler.java b/android/source/src/java/org/libreoffice/InvalidationHandler.java
index b7f0a5e..8cc5f64 100644
--- a/android/source/src/java/org/libreoffice/InvalidationHandler.java
+++ b/android/source/src/java/org/libreoffice/InvalidationHandler.java
@@ -88,15 +88,29 @@ public class InvalidationHandler implements Document.MessageCallback {
Log.e(LOGTAG, "LOK_CALLBACK_STATE_CHANGED unexpected payload: " + payload);
return;
}
- boolean pressed = Boolean.parseBoolean(parts[1]);
+ final String value = parts[1];
+ boolean pressed = Boolean.parseBoolean(value);
+
if (parts[0].equals(".uno:Bold")) {
- LOKitShell.getToolbarController().onToggleStateChanged(Document.BOLD, pressed);
+ LOKitShell.getFormattingController().onToggleStateChanged(Document.BOLD, pressed);
} else if (parts[0].equals(".uno:Italic")) {
- LOKitShell.getToolbarController().onToggleStateChanged(Document.ITALIC, pressed);
+ LOKitShell.getFormattingController().onToggleStateChanged(Document.ITALIC, pressed);
} else if (parts[0].equals(".uno:Underline")) {
- LOKitShell.getToolbarController().onToggleStateChanged(Document.UNDERLINE, pressed);
+ LOKitShell.getFormattingController().onToggleStateChanged(Document.UNDERLINE, pressed);
} else if (parts[0].equals(".uno:Strikeout")) {
- LOKitShell.getToolbarController().onToggleStateChanged(Document.STRIKEOUT, pressed);
+ LOKitShell.getFormattingController().onToggleStateChanged(Document.STRIKEOUT, pressed);
+ } else if (parts[0].equals(".uno:CharFontName")) {
+ LOKitShell.getFontController().selectFont(value);
+ } else if (parts[0].equals(".uno:FontHeight")) {
+ LOKitShell.getFontController().selectFontSize(value);
+ } else if (parts[0].equals(".uno:LeftPara")) {
+ LOKitShell.getFormattingController().onToggleStateChanged(Document.ALIGN_LEFT, pressed);
+ } else if (parts[0].equals(".uno:CenterPara")) {
+ LOKitShell.getFormattingController().onToggleStateChanged(Document.ALIGN_CENTER, pressed);
+ } else if (parts[0].equals(".uno:RightPara")) {
+ LOKitShell.getFormattingController().onToggleStateChanged(Document.ALIGN_RIGHT, pressed);
+ } else if (parts[0].equals(".uno:JustifyPara")) {
+ LOKitShell.getFormattingController().onToggleStateChanged(Document.ALIGN_JUSTIFY, pressed);
} else {
Log.d(LOGTAG, "LOK_CALLBACK_STATE_CHANGED type uncatched: " + payload);
}
@@ -383,7 +397,7 @@ public class InvalidationHandler implements Document.MessageCallback {
* Handle a transition to OverlayState.CURSOR state.
*/
private void handleCursorState(OverlayState previous) {
- LibreOfficeMainActivity.mAppContext.showSoftKeyboard();
+ LibreOfficeMainActivity.mAppContext.showSoftKeyboardOrFormattingToolbar();
if (previous == OverlayState.TRANSITION) {
mDocumentOverlay.showHandle(SelectionHandle.HandleType.MIDDLE);
mDocumentOverlay.showCursor();
diff --git a/android/source/src/java/org/libreoffice/LOKitShell.java b/android/source/src/java/org/libreoffice/LOKitShell.java
index 609a6cf..aff0472 100644
--- a/android/source/src/java/org/libreoffice/LOKitShell.java
+++ b/android/source/src/java/org/libreoffice/LOKitShell.java
@@ -59,6 +59,14 @@ public class LOKitShell {
return LibreOfficeMainActivity.mAppContext.getToolbarController();
}
+ public static FormattingController getFormattingController() {
+ return LibreOfficeMainActivity.mAppContext.getFormattingController();
+ }
+
+ public static FontController getFontController() {
+ return LibreOfficeMainActivity.mAppContext.getFontController();
+ }
+
public static int getMemoryClass(Context context) {
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
return activityManager.getMemoryClass() * 1024 * 1024;
diff --git a/android/source/src/java/org/libreoffice/LOKitTileProvider.java b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
index f859b7a..4efbc5b 100644
--- a/android/source/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
@@ -124,6 +124,8 @@ public class LOKitTileProvider implements TileProvider {
mDocument.setPart(0);
+ setupDocumentFonts();
+
LOKitShell.getMainHandler().post(new Runnable() {
@Override
public void run() {
@@ -132,6 +134,15 @@ public class LOKitTileProvider implements TileProvider {
});
}
+ private void setupDocumentFonts() {
+ String values = mDocument.getCommandValues(".uno:CharFontName");
+ if (values == null || values.isEmpty())
+ return;
+
+ LOKitShell.getFontController().parseJson(values);
+ LOKitShell.getFontController().setupFontViews();
+ }
+
private String getGenericPartName(int i) {
if (mDocument == null) {
return "";
diff --git a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
index eb56607..9c47ffe 100644
--- a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -17,8 +17,6 @@ import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
@@ -61,20 +59,24 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
private static boolean mEnableEditing;
- int providerId;
- URI documentUri;
+ private int providerId;
+ private URI documentUri;
public Handler mMainHandler;
private DrawerLayout mDrawerLayout;
+ private LOAbout mAbout;
+
private ListView mDrawerList;
private List<DocumentPartView> mDocumentPartView = new ArrayList<DocumentPartView>();
private DocumentPartViewListAdapter mDocumentPartViewListAdapter;
private File mInputFile;
private DocumentOverlay mDocumentOverlay;
private File mTempFile = null;
- private LOAbout mAbout;
+
+ private FormattingController mFormattingController;
private ToolbarController mToolbarController;
+ private FontController mFontController;
public LibreOfficeMainActivity() {
mAbout = new LOAbout(this, false);
@@ -88,63 +90,8 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
return mEnableEditing;
}
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- mToolbarController.setOptionMenu(menu);
-
- if (mTempFile != null) {
- mToolbarController.disableMenuItem(R.id.action_save, true);
- Toast.makeText(this, getString(R.string.temp_file_saving_disabled), Toast.LENGTH_LONG).show();
- }
- return super.onCreateOptionsMenu(menu);
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- int id = item.getItemId();
- switch (id) {
- case R.id.action_bold:
- LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:Bold"));
- return true;
- case R.id.action_italic:
- LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:Italic"));
- return true;
- case R.id.action_underline:
- LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:Underline"));
- return true;
- case R.id.action_strikeout:
- LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:Strikeout"));
- return true;
- case R.id.action_keyboard:
- showSoftKeyboard();
- break;
- case R.id.action_about:
- mAbout.showAbout();
- return true;
- case R.id.action_save:
- saveDocument();
- return true;
- case R.id.action_parts:
- mDrawerLayout.openDrawer(mDrawerList);
- return true;
- case R.id.action_settings:
- startActivity(new Intent(getApplicationContext(), SettingsActivity.class));
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
-
- @Override
- public boolean onPrepareOptionsMenu(Menu menu) {
- // If the nav drawer is open, hide action items related to the content view
- boolean isDrawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList);
- // Do the same in case the drawer is locked.
- boolean isDrawerLocked = mDrawerLayout.getDrawerLockMode(mDrawerList) != DrawerLayout.LOCK_MODE_UNLOCKED;
- menu.findItem(R.id.action_parts).setVisible(!isDrawerOpen && !isDrawerLocked);
- menu.setGroupVisible(R.id.group_edit_actions, mEnableEditing);
- return super.onPrepareOptionsMenu(menu);
+ public boolean usesTemporaryFile() {
+ return mTempFile != null;
}
@Override
@@ -153,7 +100,6 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
mAppContext = this;
super.onCreate(savedInstanceState);
-
SharedPreferences sPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
mEnableEditing = sPrefs.getBoolean(ENABLE_EXPERIMENTAL_PREFS_KEY, false);
@@ -166,9 +112,21 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
setContentView(R.layout.activity_main);
- Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
- setSupportActionBar(toolbar);
- mToolbarController = new ToolbarController(this, getSupportActionBar(), toolbar);
+ Toolbar toolbarTop = (Toolbar) findViewById(R.id.toolbar);
+ Toolbar toolbarBottom = (Toolbar) findViewById(R.id.toolbar_bottom);
+
+ hideBottomToolbar();
+
+ mToolbarController = new ToolbarController(this, getSupportActionBar(), toolbarTop);
+ mFormattingController = new FormattingController(this, toolbarBottom);
+ toolbarTop.setNavigationOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ LOKitShell.sendNavigationClickEvent();
+ }
+ });
+
+ mFontController = new FontController(this);
if (getIntent().getData() != null) {
if (getIntent().getData().getScheme().equals(ContentResolver.SCHEME_CONTENT)) {
@@ -193,13 +151,6 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
mInputFile = new File(DEFAULT_DOC_PATH);
}
- toolbar.setNavigationOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- LOKitShell.sendNavigationClickEvent();
- }
- });
-
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
if (mDocumentPartViewListAdapter == null) {
@@ -226,6 +177,8 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
// create TextCursorLayer
mDocumentOverlay = new DocumentOverlay(mAppContext, layerView);
+
+ mToolbarController.setupToolbars();
}
private boolean copyFileToTemp() {
@@ -272,7 +225,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
* Save the document and invoke save on document provider to upload the file
* to the cloud if necessary.
*/
- private void saveDocument() {
+ public void saveDocument() {
final long lastModified = mInputFile.lastModified();
final Activity activity = LibreOfficeMainActivity.this;
Toast.makeText(this, R.string.message_saving, Toast.LENGTH_SHORT).show();
@@ -328,9 +281,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
else {
// 20 seconds later, the local file has not changed,
// maybe there were no changes at all
- Toast.makeText(activity,
- R.string.message_save_incomplete,
- Toast.LENGTH_LONG).show();
+ Toast.makeText(activity, R.string.message_save_incomplete, Toast.LENGTH_LONG).show();
}
}
}
@@ -346,7 +297,6 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
boolean bEnableExperimental = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getBoolean(ENABLE_EXPERIMENTAL_PREFS_KEY, false);
if (bEnableExperimental != mEnableEditing) {
mEnableEditing = bEnableExperimental;
- invalidateOptionsMenu();
}
}
@@ -415,11 +365,29 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
LOKitShell.getMainHandler().post(new Runnable() {
@Override
public void run() {
- LayerView layerView = (LayerView) findViewById(R.id.layer_view);
+ showSoftKeyboardDirect();
+ }
+ });
+ }
- if (layerView.requestFocus()) {
- InputMethodManager inputMethodManager = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
- inputMethodManager.showSoftInput(layerView, InputMethodManager.SHOW_FORCED);
+ private void showSoftKeyboardDirect() {
+ LayerView layerView = (LayerView) findViewById(R.id.layer_view);
+
+ if (layerView.requestFocus()) {
+ InputMethodManager inputMethodManager = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
+ inputMethodManager.showSoftInput(layerView, InputMethodManager.SHOW_FORCED);
+ }
+
+ hideBottomToolbar();
+ }
+
+ public void showSoftKeyboardOrFormattingToolbar() {
+ LOKitShell.getMainHandler().post(new Runnable() {
+ @Override
+ public void run() {
+ Toolbar toolbarBottom = (Toolbar) findViewById(R.id.toolbar_bottom);
+ if (toolbarBottom.getVisibility() != View.VISIBLE) {
+ showSoftKeyboardDirect();
}
}
});
@@ -447,6 +415,46 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
}
}
+ public void showBottomToolbar() {
+ LOKitShell.getMainHandler().post(new Runnable() {
+ @Override
+ public void run() {
+ findViewById(R.id.toolbar_bottom).setVisibility(View.VISIBLE);
+ }
+ });
+ }
+
+ public void hideBottomToolbar() {
+ LOKitShell.getMainHandler().post(new Runnable() {
+ @Override
+ public void run() {
+ findViewById(R.id.toolbar_bottom).setVisibility(View.GONE);
+ findViewById(R.id.formatting_toolbar).setVisibility(View.GONE);
+ }
+ });
+ }
+
+ public void showFormattingToolbar() {
+ LOKitShell.getMainHandler().post(new Runnable() {
+ @Override
+ public void run() {
+ showBottomToolbar();
+ findViewById(R.id.formatting_toolbar).setVisibility(View.VISIBLE);
+ hideSoftKeyboardDirect();
+ }
+ });
+ }
+
+ public void hideFormattingToolbar() {
+ LOKitShell.getMainHandler().post(new Runnable() {
+ @Override
+ public void run() {
+ hideBottomToolbar();
+ findViewById(R.id.formatting_toolbar).setVisibility(View.GONE);
+ }
+ });
+ }
+
public void showProgressSpinner() {
findViewById(R.id.loadingPanel).setVisibility(View.VISIBLE);
}
@@ -455,12 +463,12 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
findViewById(R.id.loadingPanel).setVisibility(View.GONE);
}
- public void showAlertDialog(String s) {
+ public void showAlertDialog(String message) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(LibreOfficeMainActivity.this);
alertDialogBuilder.setTitle("Error");
- alertDialogBuilder.setMessage(s);
+ alertDialogBuilder.setMessage(message);
alertDialogBuilder.setNeutralButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
finish();
@@ -479,6 +487,32 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
return mToolbarController;
}
+ public FontController getFontController() {
+ return mFontController;
+ }
+
+ public FormattingController getFormattingController() {
+ return mFormattingController;
+ }
+
+ public void openDrawer() {
+ mDrawerLayout.openDrawer(mDrawerList);
+ }
+
+ public void showAbout() {
+ mAbout.showAbout();
+ }
+
+ public void showSettings() {
+ startActivity(new Intent(getApplicationContext(), SettingsActivity.class));
+ }
+
+ public boolean isDrawerEnabled() {
+ boolean isDrawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList);
+ boolean isDrawerLocked = mDrawerLayout.getDrawerLockMode(mDrawerList) != DrawerLayout.LOCK_MODE_UNLOCKED;
+ return !isDrawerOpen && !isDrawerLocked;
+ }
+
private class DocumentPartClickListener implements android.widget.AdapterView.OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
diff --git a/android/source/src/java/org/libreoffice/ToolbarController.java b/android/source/src/java/org/libreoffice/ToolbarController.java
index abd1f3e..08e981c 100644
--- a/android/source/src/java/org/libreoffice/ToolbarController.java
+++ b/android/source/src/java/org/libreoffice/ToolbarController.java
@@ -9,39 +9,54 @@
package org.libreoffice;
import android.content.Context;
+import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.LayerDrawable;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
+import android.view.View;
+import android.widget.ImageButton;
+import android.widget.Toast;
import org.libreoffice.canvas.ImageUtils;
import org.libreoffice.kit.Document;
+import java.sql.SQLOutput;
+import java.util.Arrays;
+
/**
* Controls the changes to the toolbar.
*/
-public class ToolbarController {
+public class ToolbarController implements Toolbar.OnMenuItemClickListener {
private static final String LOGTAG = ToolbarController.class.getSimpleName();
- private final Toolbar mToolbar;
+ private final Toolbar mToolbarTop;
+
private final ActionBar mActionBar;
- private Menu mOptionsMenu;
- private Context mContext;
+ private LibreOfficeMainActivity mContext;
+ private Menu mMainMenu;
- public ToolbarController(Context context, ActionBar actionBar, Toolbar toolbar) {
- mToolbar = toolbar;
+ public ToolbarController(LibreOfficeMainActivity context, ActionBar actionBar, Toolbar toolbarTop) {
+ mToolbarTop = toolbarTop;
mActionBar = actionBar;
mContext = context;
+
+ mToolbarTop.inflateMenu(R.menu.main);
+ mToolbarTop.setOnMenuItemClickListener(this);
switchToViewMode();
+
+ mMainMenu = mToolbarTop.getMenu();
}
public void disableMenuItem(final int menuItemId, final boolean disabled) {
LOKitShell.getMainHandler().post(new Runnable() {
public void run() {
- MenuItem menuItem = mOptionsMenu.findItem(menuItemId);
+ MenuItem menuItem = mMainMenu.findItem(menuItemId);
if (menuItem != null) {
menuItem.setEnabled(!disabled);
} else {
@@ -51,53 +66,6 @@ public class ToolbarController {
});
}
- public void onToggleStateChanged(int type, boolean pressed) {
- MenuItem menuItem = null;
- Bitmap icon = null;
- switch (type) {
- case Document.BOLD:
- menuItem = mOptionsMenu.findItem(R.id.action_bold);
- icon = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.action_bold);
- break;
- case Document.ITALIC:
- menuItem = mOptionsMenu.findItem(R.id.action_italic);
- icon = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.action_italic);
- break;
- case Document.UNDERLINE:
- menuItem = mOptionsMenu.findItem(R.id.action_underline);
- icon = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.action_underline);
- break;
- case Document.STRIKEOUT:
- menuItem = mOptionsMenu.findItem(R.id.action_strikeout);
- icon = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.action_strikeout);
- break;
- default:
- Log.e(LOGTAG, "Uncaptured state change type: " + type);
- return;
- }
-
- if (menuItem == null) {
- Log.e(LOGTAG, "MenuItem not found.");
- return;
- }
-
- if (pressed) {
- icon = ImageUtils.bitmapToPressed(icon);
- }
-
- final MenuItem fMenuItem = menuItem;
- final Bitmap fIcon = icon;
- LOKitShell.getMainHandler().post(new Runnable() {
- public void run() {
- fMenuItem.setIcon(new BitmapDrawable(mContext.getResources(), fIcon));
- }
- });
- }
-
- public void setOptionMenu(Menu menu) {
- mOptionsMenu = menu;
- }
-
/**
* Change the toolbar to edit mode.
*/
@@ -109,9 +77,10 @@ public class ToolbarController {
LOKitShell.getMainHandler().post(new Runnable() {
@Override
public void run() {
- mActionBar.setDisplayHomeAsUpEnabled(false);
- mToolbar.setNavigationIcon(R.drawable.ic_check_grey600_24dp);
- mToolbar.setTitle(null);
+ mMainMenu.setGroupVisible(R.id.group_edit_actions, true);
+ mToolbarTop.setNavigationIcon(R.drawable.ic_check);
+ mToolbarTop.setTitle(null);
+ mToolbarTop.setLogo(null);
}
});
@@ -128,12 +97,48 @@ public class ToolbarController {
LOKitShell.getMainHandler().post(new Runnable() {
@Override
public void run() {
- mToolbar.setNavigationIcon(R.drawable.ic_menu_grey600_24dp);
- mToolbar.setTitle("LibreOffice");
- mActionBar.setDisplayHomeAsUpEnabled(true);
+ mMainMenu.setGroupVisible(R.id.group_edit_actions, false);
+ mToolbarTop.setNavigationIcon(R.drawable.lo_icon);
+ mToolbarTop.setTitle(null);
+ mToolbarTop.setLogo(null);
}
});
}
+
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.action_keyboard:
+ mContext.showSoftKeyboard();
+ break;
+ case R.id.action_format:
+ mContext.showFormattingToolbar();
+ break;
+ case R.id.action_about:
+ mContext.showAbout();
+ return true;
+ case R.id.action_save:
+ mContext.saveDocument();
+ return true;
+ case R.id.action_parts:
+ mContext.openDrawer();
+ return true;
+ case R.id.action_settings:
+ mContext.showSettings();
+ return true;
+ }
+ return false;
+ }
+
+ public void setupToolbars() {
+ LibreOfficeMainActivity activity = mContext;
+ if (activity.usesTemporaryFile()) {
+ disableMenuItem(R.id.action_save, true);
+ Toast.makeText(activity, activity.getString(R.string.temp_file_saving_disabled), Toast.LENGTH_LONG).show();
+ }
+ mMainMenu.findItem(R.id.action_parts).setVisible(activity.isDrawerEnabled());
+ }
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/source/src/java/org/libreoffice/canvas/BitmapHandle.java b/android/source/src/java/org/libreoffice/canvas/BitmapHandle.java
index 9a58195..d450b7c 100644
--- a/android/source/src/java/org/libreoffice/canvas/BitmapHandle.java
+++ b/android/source/src/java/org/libreoffice/canvas/BitmapHandle.java
@@ -5,6 +5,7 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.RectF;
+import android.graphics.drawable.Drawable;
/**
* Bitmap handle canvas element is used to show a handle on the screen.
@@ -26,8 +27,9 @@ public abstract class BitmapHandle extends CommonCanvasElement {
* Return a bitmap for a drawable id.
*/
protected static Bitmap getBitmapForDrawable(Context context, int drawableId) {
- BitmapFactory.Options options = new BitmapFactory.Options();
- return BitmapFactory.decodeResource(context.getResources(), drawableId, options);
+ Drawable drawable = context.getResources().getDrawable(drawableId);
+
+ return ImageUtils.getBitmapForDrawable(drawable);
}
/**
diff --git a/android/source/src/java/org/libreoffice/canvas/ImageUtils.java b/android/source/src/java/org/libreoffice/canvas/ImageUtils.java
index fd62444..b99d425 100644
--- a/android/source/src/java/org/libreoffice/canvas/ImageUtils.java
+++ b/android/source/src/java/org/libreoffice/canvas/ImageUtils.java
@@ -1,24 +1,31 @@
package org.libreoffice.canvas;
import android.graphics.Bitmap;
+import android.graphics.Canvas;
import android.graphics.Color;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
public class ImageUtils {
- /**
- * Convert transparent pixels to gray ones.
- */
- public static Bitmap bitmapToPressed(Bitmap input) {
- Bitmap op = Bitmap.createBitmap(input.getWidth(), input.getHeight(), input.getConfig());
- for(int i=0; i<op.getWidth(); i++){
- for(int j=0; j<op.getHeight(); j++){
- int p = input.getPixel(i, j);
- // assign gray color if the pixel in input is transparent.
- int newColor = Color.alpha(p) == 0 ? Color.argb(255, 200, 200, 200) : p;
- op.setPixel(i, j, newColor);
- }
- }
-
- return op;
+ public static Bitmap getBitmapForDrawable(Drawable drawable) {
+ drawable = drawable.mutate();
+
+ int width = !drawable.getBounds().isEmpty() ?
+ drawable.getBounds().width() : drawable.getIntrinsicWidth();
+
+ width = width <= 0 ? 1 : width;
+
+ int height = !drawable.getBounds().isEmpty() ?
+ drawable.getBounds().height() : drawable.getIntrinsicHeight();
+
+ height = height <= 0 ? 1 : height;
+
+ final Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
+ Canvas canvas = new Canvas(bitmap);
+ drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
+ drawable.draw(canvas);
+
+ return bitmap;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 3b01c2afb36262eafe3511fe9e105ad7a1db94c5
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Mon Nov 9 23:51:02 2015 +0100
android: make toolbar visuals easier to change
Change-Id: I5b4dd8b8c407640cfcd9f366cecfaf6deb0cb3be
(cherry picked from commit 01d0983e3dd963003159779ca0920ace7dc308c4)
diff --git a/android/source/res/layout/toolbar.xml b/android/source/res/layout/toolbar.xml
index d8faa51..42136ce 100644
--- a/android/source/res/layout/toolbar.xml
+++ b/android/source/res/layout/toolbar.xml
@@ -2,9 +2,13 @@
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:elevation="3dp">
+ android:elevation="3dp"
+ android:background="@color/toolbar_background"
+ app:theme="@style/LibreOfficeTheme.Toolbar"
+ app:popupTheme="@style/LibreOfficeTheme">
</android.support.v7.widget.Toolbar>
diff --git a/android/source/res/values/colors.xml b/android/source/res/values/colors.xml
index 3e1cd21..89d1062 100644
--- a/android/source/res/values/colors.xml
+++ b/android/source/res/values/colors.xml
@@ -92,6 +92,9 @@
<color name="panel_grid_item_image_background">#D1D9E1</color>
+ <color name="toolbar_forgeround">#3e3e3e</color>
+ <color name="toolbar_background">#ffffff</color>
+
<color name="handle_color">#40A040</color>
</resources>
diff --git a/android/source/res/values/themes.xml b/android/source/res/values/themes.xml
index 3b86511..807bf81 100644
--- a/android/source/res/values/themes.xml
+++ b/android/source/res/values/themes.xml
@@ -14,4 +14,9 @@
<item name="android:textColor">@android:color/black</item>
<item name="android:textSize">15sp</item>
</style>
+
+ <style name="LibreOfficeTheme.Toolbar" parent="Theme.AppCompat.Light.NoActionBar">
+ <item name="colorPrimary">@color/toolbar_background</item>
+ </style>
+
</resources>
commit 6d0920647d6e1e70adc4ce709e4380a675b94d83
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Mon Nov 9 23:46:36 2015 +0100
android: remove attrs.xml
Change-Id: I7d3742af0c11a996701f7d263fc04a387edb0d00
(cherry picked from commit b0166b1d063dd1ba40692eecea1fa378e868acee)
diff --git a/android/source/res/values/attrs.xml b/android/source/res/values/attrs.xml
deleted file mode 100644
index ed73978..0000000
--- a/android/source/res/values/attrs.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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/. -->
-
-<resources>
-
- <declare-styleable name="TextSelectionHandle">
- <attr name="handleType">
- <flag name="start" value="0x01"/>
- <flag name="middle" value="0x02"/>
- <flag name="end" value="0x03"/>
- </attr>
- </declare-styleable>
-
-</resources>
-
More information about the Libreoffice-commits
mailing list