summaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2017-09-06 23:40:11 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2018-01-18 11:15:31 +0100
commit64619789a45babbaa3071951e3502927f191e459 (patch)
tree6d2becf15831823018f37b8f7972e6136327948d /android
parenttdf#112140 fix some NPEs re touch/zoom while doucment is not ready (diff)
downloadcore-64619789a45babbaa3071951e3502927f191e459.tar.gz
core-64619789a45babbaa3071951e3502927f191e459.zip
android: fix some layout issues with new-document buttons
functionality to create new documents was added for tdf#106325 with commit 1503769fe15c122ff2bb8f6f7e7b4ab72656ddc2 However the commit had some issues, most notably clipping of the shadow effect and alignment issues to to scaling down (via the animation effect, took me quite a while until I looked at that) with having a centered pivot. I think it was due to those alignment issues that the label was set to a fixed with - which is a problem for future translation. This commit: * changes the animation to not scale down the initial views * changes the FABs' setting to use compatPadding - this not only ensures enough room for the shadow, but also allows for consistent look across android versions. Side effect is that it needs more height, so * the effect was adjusted accordingly, to shrink to/expand from the lower-right corner of the parent view, instead of "mid-air" * the labels were given a proper background drawable with rounded corners and some padding for a (much more9 polished look * formatting of the labels was split out to a style, for ease of tweaking the looks * add tools:visibility statement to see the elements in layout editor * fixed the strings for the labels (and ID) to some less awkward ones Change-Id: Ifd2d90ec8d23e40603edff19c9af9e0b32090c9f Reviewed-on: https://gerrit.libreoffice.org/42033 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'android')
-rw-r--r--android/source/res/anim/fab_close.xml15
-rw-r--r--android/source/res/anim/fab_open.xml12
-rw-r--r--android/source/res/drawable/label_background.xml9
-rw-r--r--android/source/res/layout/activity_document_browser.xml113
-rw-r--r--android/source/res/values/dimens.xml2
-rw-r--r--android/source/res/values/strings.xml8
-rw-r--r--android/source/res/values/themes.xml12
7 files changed, 88 insertions, 83 deletions
diff --git a/android/source/res/anim/fab_close.xml b/android/source/res/anim/fab_close.xml
index ba13b0f038be..c798ddabad90 100644
--- a/android/source/res/anim/fab_close.xml
+++ b/android/source/res/anim/fab_close.xml
@@ -3,16 +3,17 @@
android:fillAfter="true">
<scale
android:duration="300"
- android:fromXScale="0.8"
- android:fromYScale="0.8"
+ android:fromXScale="1.0"
+ android:fromYScale="1.0"
android:interpolator="@android:anim/linear_interpolator"
+ android:pivotX="100%p"
+ android:pivotY="100%p"
android:toXScale="0.0"
- android:pivotX="50%"
- android:pivotY="50%"
android:toYScale="0.0" />
- <alpha android:fromAlpha="1.0"
- android:toAlpha="0.0"
+ <alpha
+ android:duration="300"
+ android:fromAlpha="1.0"
android:interpolator="@android:anim/accelerate_interpolator"
- android:duration="300"/>
+ android:toAlpha="0.0" />
</set>
diff --git a/android/source/res/anim/fab_open.xml b/android/source/res/anim/fab_open.xml
index 9099d8b53c80..30071af8a242 100644
--- a/android/source/res/anim/fab_open.xml
+++ b/android/source/res/anim/fab_open.xml
@@ -6,14 +6,14 @@
android:fromXScale="0.0"
android:fromYScale="0.0"
android:interpolator="@android:anim/linear_interpolator"
- android:toXScale="0.8"
- android:pivotX="50%"
- android:pivotY="50%"
- android:toYScale="0.8"/>
+ android:pivotX="100%p"
+ android:pivotY="100%p"
+ android:toXScale="1.0"
+ android:toYScale="1.0" />
<alpha
+ android:duration="300"
android:fromAlpha="0.0"
- android:toAlpha="1.0"
android:interpolator="@android:anim/accelerate_interpolator"
- android:duration="300"/>
+ android:toAlpha="1.0" />
</set>
diff --git a/android/source/res/drawable/label_background.xml b/android/source/res/drawable/label_background.xml
new file mode 100644
index 000000000000..1e097857537a
--- /dev/null
+++ b/android/source/res/drawable/label_background.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item>
+ <shape android:shape="rectangle">
+ <solid android:color="@color/background_normal" />
+ <corners android:radius="5dp" />
+ </shape>
+ </item>
+</selector> \ No newline at end of file
diff --git a/android/source/res/layout/activity_document_browser.xml b/android/source/res/layout/activity_document_browser.xml
index 9f62f5f22a3e..1f26195c2025 100644
--- a/android/source/res/layout/activity_document_browser.xml
+++ b/android/source/res/layout/activity_document_browser.xml
@@ -124,15 +124,13 @@
android:id="@+id/editFAB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginBottom="16dp"
- android:layout_marginEnd="16dp"
- android:layout_marginRight="16dp"
android:clickable="true"
+ app:backgroundTint="@color/background_normal"
app:fabSize="normal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
- app:backgroundTint="@color/background_normal"
- app:srcCompat="@drawable/ic_add_black_24dp" />
+ app:srcCompat="@drawable/ic_add_black_24dp"
+ app:useCompatPadding="true" />
<LinearLayout
android:id="@+id/writerLayout"
@@ -141,31 +139,28 @@
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="invisible"
- app:layout_constraintBottom_toTopOf="@+id/editFAB"
- app:layout_constraintRight_toRightOf="parent">
+ app:layout_constraintBottom_toTopOf="@id/editFAB"
+ app:layout_constraintRight_toRightOf="@id/editFAB"
+ tools:visibility="visible">
<TextView
android:id="@+id/newWriterTextView"
- android:layout_width="120dp"
- android:layout_height="wrap_content"
- android:layout_marginEnd="8dp"
- android:layout_marginRight="8dp"
- android:elevation="2dp"
- android:gravity="center_horizontal"
- android:text="@string/new_write"
- android:textSize="18sp"
- android:textStyle="bold"
- android:background="@color/background_normal"
- android:typeface="normal" />
+ style="@style/NewDocumentTextView"
+ android:layout_marginBottom="@dimen/new_doc_fab_tweak_bottom"
+ android:layout_marginTop="@dimen/new_doc_fab_tweak_top"
+ android:text="@string/new_textdocument" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/newWriterFAB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginBottom="@dimen/new_doc_fab_tweak_bottom"
+ android:layout_marginTop="@dimen/new_doc_fab_tweak_top"
android:clickable="true"
- app:fabSize="normal"
app:backgroundTint="@color/background_normal"
- app:srcCompat="@drawable/writer" />
+ app:fabSize="mini"
+ app:srcCompat="@drawable/writer"
+ app:useCompatPadding="true" />
</LinearLayout>
@@ -177,31 +172,27 @@
android:orientation="horizontal"
android:visibility="invisible"
app:layout_constraintBottom_toTopOf="@+id/writerLayout"
- app:layout_constraintLeft_toLeftOf="@+id/writerLayout"
- app:layout_constraintRight_toRightOf="parent">
+ app:layout_constraintRight_toRightOf="@id/editFAB"
+ tools:visibility="visible">
<TextView
android:id="@+id/newImpressTextView"
- android:layout_width="120dp"
- android:layout_height="wrap_content"
- android:layout_marginEnd="8dp"
- android:layout_marginRight="8dp"
- android:elevation="2dp"
- android:gravity="center_horizontal"
- android:text="@string/new_impress"
- android:textSize="18sp"
- android:textStyle="bold"
- android:background="@color/background_normal"
- android:typeface="normal" />
+ style="@style/NewDocumentTextView"
+ android:layout_marginBottom="@dimen/new_doc_fab_tweak_bottom"
+ android:layout_marginTop="@dimen/new_doc_fab_tweak_top"
+ android:text="@string/new_presentation" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/newImpressFAB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginBottom="@dimen/new_doc_fab_tweak_bottom"
+ android:layout_marginTop="@dimen/new_doc_fab_tweak_top"
android:clickable="true"
- app:fabSize="normal"
app:backgroundTint="@color/background_normal"
- app:srcCompat="@drawable/impress" />
+ app:fabSize="mini"
+ app:srcCompat="@drawable/impress"
+ app:useCompatPadding="true" />
</LinearLayout>
@@ -212,32 +203,28 @@
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="invisible"
+ tools:visibility="visible"
app:layout_constraintBottom_toTopOf="@+id/impressLayout"
- app:layout_constraintLeft_toLeftOf="@+id/impressLayout"
- app:layout_constraintRight_toRightOf="parent">
+ app:layout_constraintRight_toRightOf="@id/editFAB">
<TextView
android:id="@+id/newCalcTextView"
- android:layout_width="120dp"
- android:layout_height="wrap_content"
- android:layout_marginEnd="8dp"
- android:layout_marginRight="8dp"
- android:elevation="2dp"
- android:gravity="center_horizontal"
- android:text="@string/new_spreadsheet"
- android:background="@color/background_normal"
- android:textSize="18sp"
- android:textStyle="bold"
- android:typeface="normal" />
+ style="@style/NewDocumentTextView"
+ android:layout_marginBottom="@dimen/new_doc_fab_tweak_bottom"
+ android:layout_marginTop="@dimen/new_doc_fab_tweak_top"
+ android:text="@string/new_spreadsheet" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/newCalcFAB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginBottom="@dimen/new_doc_fab_tweak_bottom"
+ android:layout_marginTop="@dimen/new_doc_fab_tweak_top"
android:clickable="true"
- app:fabSize="normal"
app:backgroundTint="@color/background_normal"
- app:srcCompat="@drawable/calc" />
+ app:fabSize="mini"
+ app:srcCompat="@drawable/calc"
+ app:useCompatPadding="true" />
</LinearLayout>
@@ -248,32 +235,28 @@
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="invisible"
+ tools:visibility="visible"
app:layout_constraintBottom_toTopOf="@+id/calcLayout"
- app:layout_constraintLeft_toLeftOf="@+id/calcLayout"
- app:layout_constraintRight_toRightOf="parent">
+ app:layout_constraintRight_toRightOf="@id/editFAB">
<TextView
android:id="@+id/newDrawTextView"
- android:layout_width="120dp"
- android:layout_height="wrap_content"
- android:layout_marginEnd="8dp"
- android:layout_marginRight="8dp"
- android:elevation="2dp"
- android:gravity="center_horizontal"
- android:text="@string/new_draw"
- android:background="@color/background_normal"
- android:textSize="18sp"
- android:textStyle="bold"
- android:typeface="normal" />
+ style="@style/NewDocumentTextView"
+ android:layout_marginBottom="@dimen/new_doc_fab_tweak_bottom"
+ android:layout_marginTop="@dimen/new_doc_fab_tweak_top"
+ android:text="@string/new_drawing" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/newDrawFAB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginBottom="@dimen/new_doc_fab_tweak_bottom"
+ android:layout_marginTop="@dimen/new_doc_fab_tweak_top"
android:clickable="true"
- app:fabSize="normal"
app:backgroundTint="@color/background_normal"
- app:srcCompat="@drawable/draw" />
+ app:fabSize="mini"
+ app:srcCompat="@drawable/draw"
+ app:useCompatPadding="true" />
</LinearLayout>
diff --git a/android/source/res/values/dimens.xml b/android/source/res/values/dimens.xml
index 3a3343ff56b0..ca91a2f30a1f 100644
--- a/android/source/res/values/dimens.xml
+++ b/android/source/res/values/dimens.xml
@@ -13,4 +13,6 @@
<dimen name="calc_header_height">24dp</dimen>
<dimen name="calc_toolbar_height">40dp</dimen>
<dimen name="calc_address_bar_width">96dp</dimen>
+ <dimen name="new_doc_fab_tweak_top">-11dp</dimen>
+ <dimen name="new_doc_fab_tweak_bottom">-7dp</dimen>
</resources>
diff --git a/android/source/res/values/strings.xml b/android/source/res/values/strings.xml
index 9b6ff7abff9c..f0331179f915 100644
--- a/android/source/res/values/strings.xml
+++ b/android/source/res/values/strings.xml
@@ -16,10 +16,10 @@
<string name="about_moreinfo">More Info</string>
<string name="back_again_to_quit">Press back again to quit</string>
- <string name="new_write">New Write</string>
- <string name="new_impress">New Impress</string>
- <string name="new_spreadsheet">New Sheet</string>
- <string name="new_draw">New Draw</string>
+ <string name="new_textdocument">New Text Document</string>
+ <string name="new_presentation">New Presentation</string>
+ <string name="new_spreadsheet">New Spreadsheet</string>
+ <string name="new_drawing">New Drawing</string>
<string name="default_document_name">untitled</string>
<string name="browser_app_name">LibreOffice Browser</string>
diff --git a/android/source/res/values/themes.xml b/android/source/res/values/themes.xml
index 5b672642be0b..8576f9c221ec 100644
--- a/android/source/res/values/themes.xml
+++ b/android/source/res/values/themes.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<resources>
+<resources xmlns:tools="http://schemas.android.com/tools">
<style name="LibreOfficeTheme" parent="LibreOfficeTheme.Base"/>
<style name="LibreOfficeTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
@@ -19,4 +19,14 @@
<item name="colorPrimary">@android:color/black</item>
</style>
+ <style name="NewDocumentTextView">
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:elevation" tools:ignore="NewApi">2dp</item>
+ <item name="android:textSize">16sp</item>
+ <item name="android:textStyle">bold</item>
+ <item name="android:typeface">normal</item>
+ <item name="android:padding">5dp</item>
+ <item name="android:background">@drawable/label_background</item>
+ </style>
</resources>