diff options
author | brainbreaker <gautamprajapati06@gmail.com> | 2017-03-14 19:12:20 +0530 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2017-03-30 19:59:10 +0000 |
commit | 1503769fe15c122ff2bb8f6f7e7b4ab72656ddc2 (patch) | |
tree | c839a253bebc30893e94887d80d48f7c0182a38f /android/source/res | |
parent | 0466d0c815f8b0f60497faec8b60a18d35a61eca (diff) |
tdf#106325 - No way to create a new Document
This commit will add the ability to create a new document.
A FAB is used in home screen which on expansion gives
four options namely new writer document, new impress,
new Sheet or new Draw. Two new events loadNewDocument
and saveDocumentAs have been added.
Another major change includes the use of constraint layout
in LOUIActivity layout as it decreases nesting of views and
improves the app performance. This was needed because
of the new FAB layouts being added.
Support for vector drawables has been enabled.
Change-Id: Ia3ea17f73c0d8514f8ddb7b9a1cbd2ce7de6ac08
Reviewed-on: https://gerrit.libreoffice.org/35183
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'android/source/res')
-rw-r--r-- | android/source/res/anim/fab_close.xml | 18 | ||||
-rw-r--r-- | android/source/res/anim/fab_open.xml | 19 | ||||
-rw-r--r-- | android/source/res/drawable/ic_add_black_24dp.xml | 9 | ||||
-rw-r--r-- | android/source/res/layout/activity_document_browser.xml | 213 | ||||
-rw-r--r-- | android/source/res/values/strings.xml | 9 |
5 files changed, 247 insertions, 21 deletions
diff --git a/android/source/res/anim/fab_close.xml b/android/source/res/anim/fab_close.xml new file mode 100644 index 000000000000..ba13b0f038be --- /dev/null +++ b/android/source/res/anim/fab_close.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:fillAfter="true"> + <scale + android:duration="300" + android:fromXScale="0.8" + android:fromYScale="0.8" + android:interpolator="@android:anim/linear_interpolator" + android:toXScale="0.0" + android:pivotX="50%" + android:pivotY="50%" + android:toYScale="0.0" /> + + <alpha android:fromAlpha="1.0" + android:toAlpha="0.0" + android:interpolator="@android:anim/accelerate_interpolator" + android:duration="300"/> +</set> diff --git a/android/source/res/anim/fab_open.xml b/android/source/res/anim/fab_open.xml new file mode 100644 index 000000000000..9099d8b53c80 --- /dev/null +++ b/android/source/res/anim/fab_open.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:fillAfter="true"> + <scale + android:duration="300" + 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"/> + + <alpha + android:fromAlpha="0.0" + android:toAlpha="1.0" + android:interpolator="@android:anim/accelerate_interpolator" + android:duration="300"/> +</set> diff --git a/android/source/res/drawable/ic_add_black_24dp.xml b/android/source/res/drawable/ic_add_black_24dp.xml new file mode 100644 index 000000000000..0258249cc482 --- /dev/null +++ b/android/source/res/drawable/ic_add_black_24dp.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:fillColor="#FF000000" + android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/> +</vector> diff --git a/android/source/res/layout/activity_document_browser.xml b/android/source/res/layout/activity_document_browser.xml index 20ca14125003..fab1b095035e 100644 --- a/android/source/res/layout/activity_document_browser.xml +++ b/android/source/res/layout/activity_document_browser.xml @@ -6,32 +6,45 @@ 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/. --> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" +<android.support.constraint.ConstraintLayout 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="match_parent" android:layout_height="match_parent" - android:orientation="vertical" > + android:orientation="vertical"> <!-- The toolbar --> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" - android:layout_width="match_parent" + android:layout_width="0dp" android:layout_height="wrap_content" android:elevation="3dp" android:background="@color/toolbar_background" app:theme="@style/LibreOfficeTheme.Toolbar" tools:theme="@style/LibreOfficeTheme.Toolbar" - app:popupTheme="@style/LibreOfficeTheme"> + app:popupTheme="@style/LibreOfficeTheme" + tools:layout_constraintTop_creator="1" + tools:layout_constraintRight_creator="1" + app:layout_constraintRight_toRightOf="parent" + tools:layout_constraintLeft_creator="1" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent"> </android.support.v7.widget.Toolbar> <android.support.v4.widget.DrawerLayout android:id="@+id/drawer_layout" - android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_width="0dp" + android:layout_height="0dp" + tools:layout_constraintTop_creator="1" + tools:layout_constraintRight_creator="1" + tools:layout_constraintBottom_creator="1" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toBottomOf="@+id/toolbar" + tools:layout_constraintLeft_creator="1" + app:layout_constraintLeft_toLeftOf="parent"> <!-- The content --> <ScrollView @@ -53,7 +66,7 @@ android:gravity="center_vertical" android:textSize="14sp" android:padding="16dp" - android:textStyle="bold"/> + android:textStyle="bold" /> <!--Recent files--> <android.support.v7.widget.RecyclerView @@ -61,7 +74,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" - android:layout_marginBottom="8dp"/> + android:layout_marginBottom="8dp" /> <TextView android:layout_width="match_parent" @@ -82,19 +95,177 @@ android:background="@color/background_normal" android:orientation="vertical" /> - </LinearLayout> + </LinearLayout> - </ScrollView> + </ScrollView> - <!-- The navigation drawer --> - <android.support.design.widget.NavigationView - android:id="@+id/navigation_drawer" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_gravity="start" - android:background="@color/background_normal" - app:menu="@menu/navigation_menu" - android:theme="@style/LibreOfficeTheme.NavigationView" /> + <!-- The navigation drawer --> + <android.support.design.widget.NavigationView + android:id="@+id/navigation_drawer" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_gravity="start" + android:background="@color/background_normal" + app:menu="@menu/navigation_menu" + android:theme="@style/LibreOfficeTheme.NavigationView" /> </android.support.v4.widget.DrawerLayout> -</LinearLayout> + + <android.support.design.widget.FloatingActionButton + 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:fabSize="normal" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:backgroundTint="@color/background_normal" + app:srcCompat="@drawable/ic_add_black_24dp" /> + + <LinearLayout + android:id="@+id/writerLayout" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:orientation="horizontal" + android:visibility="invisible" + app:layout_constraintBottom_toTopOf="@+id/editFAB" + app:layout_constraintRight_toRightOf="parent"> + + <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" /> + + <android.support.design.widget.FloatingActionButton + android:id="@+id/newWriterFAB" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:clickable="true" + app:fabSize="normal" + app:backgroundTint="@color/background_normal" + app:srcCompat="@drawable/writer" /> + + </LinearLayout> + + <LinearLayout + android:id="@+id/impressLayout" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:orientation="horizontal" + android:visibility="invisible" + app:layout_constraintBottom_toTopOf="@+id/writerLayout" + app:layout_constraintLeft_toLeftOf="@+id/writerLayout" + app:layout_constraintRight_toRightOf="parent"> + + <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" /> + + <android.support.design.widget.FloatingActionButton + android:id="@+id/newImpressFAB" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:clickable="true" + app:fabSize="normal" + app:backgroundTint="@color/background_normal" + app:srcCompat="@drawable/impress" /> + + </LinearLayout> + + <LinearLayout + android:id="@+id/calcLayout" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:orientation="horizontal" + android:visibility="invisible" + app:layout_constraintBottom_toTopOf="@+id/impressLayout" + app:layout_constraintLeft_toLeftOf="@+id/impressLayout" + app:layout_constraintRight_toRightOf="parent"> + + <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" /> + + <android.support.design.widget.FloatingActionButton + android:id="@+id/newCalcFAB" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:clickable="true" + app:fabSize="normal" + app:backgroundTint="@color/background_normal" + app:srcCompat="@drawable/calc" /> + + </LinearLayout> + + <LinearLayout + android:id="@+id/drawLayout" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:orientation="horizontal" + android:visibility="invisible" + app:layout_constraintBottom_toTopOf="@+id/calcLayout" + app:layout_constraintLeft_toLeftOf="@+id/calcLayout" + app:layout_constraintRight_toRightOf="parent"> + + <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" /> + + <android.support.design.widget.FloatingActionButton + android:id="@+id/newDrawFAB" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:clickable="true" + app:fabSize="normal" + app:backgroundTint="@color/background_normal" + app:srcCompat="@drawable/draw" /> + + </LinearLayout> + +</android.support.constraint.ConstraintLayout> diff --git a/android/source/res/values/strings.xml b/android/source/res/values/strings.xml index 9832d8b72eb2..ce3754ee3d15 100644 --- a/android/source/res/values/strings.xml +++ b/android/source/res/values/strings.xml @@ -16,6 +16,10 @@ <string name="about_moreinfo">More Info</string> <string name="back_again_to_quit">Press back again to quit</string> + <string name="new_impress">New Impress</string> + <string name="new_spreadsheet">New Sheet</string> + <string name="new_draw">New Draw</string> + <string name="browser_app_name">LibreOffice Browser</string> <string name="menu_search">Search</string> <string name="list_view">List</string> @@ -89,6 +93,7 @@ <string name="message_saved">Save complete</string> <string name="message_saving">Saving the document…</string> <string name="message_save_incomplete">Save incomplete. Were there any changes?</string> + <string name="new_file_created">File created in Documents folder</string> <!-- Document provider settings --> <string name="storage_provider_settings">Storage provider settings</string> @@ -117,6 +122,10 @@ <string name="save_document">SAVE</string> <string name="cancel_save_document">CANCEL</string> <string name="no_save_document">NO</string> + <string name="new_write">New Write</string> + + <string name="save_as_success">Saved file -</string> + <string name="save_as_error">Unable to create new file, please check entered file name.</string> </resources> |