diff options
author | Jack Leigh <jack.leigh@collabora.com> | 2015-03-20 16:14:19 +0000 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-30 09:23:45 +0200 |
commit | f23e1cb51c2381db3aff3a7cee91093f4a027272 (patch) | |
tree | abfa8ecdd96789dadc7313775a9986ab1dc08c32 /android | |
parent | ce6b4d5ed32e67b39c534e2ad9082fa783829931 (diff) |
android: Migrate to Toolbar in file browser
Change-Id: Ib5e3d0d39268437c179973ba4e785a719cdc351a
Reviewed-on: https://gerrit.libreoffice.org/14949
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'android')
6 files changed, 64 insertions, 36 deletions
diff --git a/android/experimental/LOAndroid3/res/layout/activity_document_browser.xml b/android/experimental/LOAndroid3/res/layout/activity_document_browser.xml new file mode 100644 index 000000000000..f54591b35ef4 --- /dev/null +++ b/android/experimental/LOAndroid3/res/layout/activity_document_browser.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + This file is part of the LibreOffice project. + + 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/. + --> +<android.support.v4.widget.DrawerLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/drawer_layout" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <!-- The content --> + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/browser_main_content" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" > + + <include layout="@layout/toolbar"/> + + </LinearLayout> + + <!-- The navigation drawer --> + <ListView android:id="@+id/left_drawer" + android:layout_width="240dp" + android:layout_height="match_parent" + android:layout_gravity="start" + android:choiceMode="singleChoice" + android:divider="@android:color/transparent" + android:dividerHeight="0dp" + android:background="#111"/> + +</android.support.v4.widget.DrawerLayout> diff --git a/android/experimental/LOAndroid3/res/layout/file_grid.xml b/android/experimental/LOAndroid3/res/layout/file_grid.xml index ec7fdd070a2c..1885bd34ed6a 100644 --- a/android/experimental/LOAndroid3/res/layout/file_grid.xml +++ b/android/experimental/LOAndroid3/res/layout/file_grid.xml @@ -5,13 +5,11 @@ 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/. --> -<android.support.v4.widget.DrawerLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/drawer_layout" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:orientation="vertical" > - <!-- The main content view --> <GridView android:id="@+id/file_explorer_grid_view" android:layout_width="fill_parent" @@ -24,14 +22,4 @@ android:gravity="center"> </GridView> - <!-- The navigation drawer --> - <ListView android:id="@+id/left_drawer" - android:layout_width="240dp" - android:layout_height="match_parent" - android:layout_gravity="start" - android:choiceMode="singleChoice" - android:divider="@android:color/transparent" - android:dividerHeight="0dp" - android:background="#111"/> - -</android.support.v4.widget.DrawerLayout> +</LinearLayout> diff --git a/android/experimental/LOAndroid3/res/layout/file_list.xml b/android/experimental/LOAndroid3/res/layout/file_list.xml index dd5346f75df9..48dfb1e31267 100644 --- a/android/experimental/LOAndroid3/res/layout/file_list.xml +++ b/android/experimental/LOAndroid3/res/layout/file_list.xml @@ -6,27 +6,15 @@ 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/. --> -<android.support.v4.widget.DrawerLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/drawer_layout" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:orientation="vertical" > - <!-- The main content view --> <ListView android:id="@+id/file_explorer_list_view" android:layout_width="fill_parent" android:layout_height="fill_parent"> </ListView> - <!-- The navigation drawer --> - <ListView android:id="@+id/left_drawer" - android:layout_width="240dp" - android:layout_height="match_parent" - android:layout_gravity="start" - android:choiceMode="singleChoice" - android:divider="@android:color/transparent" - android:dividerHeight="0dp" - android:background="#111"/> - -</android.support.v4.widget.DrawerLayout> +</LinearLayout> diff --git a/android/experimental/LOAndroid3/res/values-v21/themes.xml b/android/experimental/LOAndroid3/res/values-v21/themes.xml index 917f41b1f7ff..441ed82777f1 100644 --- a/android/experimental/LOAndroid3/res/values-v21/themes.xml +++ b/android/experimental/LOAndroid3/res/values-v21/themes.xml @@ -7,4 +7,12 @@ <item name="android:windowSharedElementEnterTransition">@android:transition/move</item> <item name="android:windowSharedElementExitTransition">@android:transition/move</item> </style> -</resources>
\ No newline at end of file + + <style name="BrowserTheme" parent="@style/Theme.AppCompat.Light.NoActionBar"> + <item name="android:windowContentTransitions">true</item> + <item name="android:windowAllowEnterTransitionOverlap">true</item> + <item name="android:windowAllowReturnTransitionOverlap">true</item> + <item name="android:windowSharedElementEnterTransition">@android:transition/move</item> + <item name="android:windowSharedElementExitTransition">@android:transition/move</item> + </style> +</resources> diff --git a/android/experimental/LOAndroid3/res/values/themes.xml b/android/experimental/LOAndroid3/res/values/themes.xml index 1468013ac7b4..478aeb7eef06 100644 --- a/android/experimental/LOAndroid3/res/values/themes.xml +++ b/android/experimental/LOAndroid3/res/values/themes.xml @@ -7,6 +7,6 @@ <item name="windowActionBar">false</item> </style> - <style name="BrowserTheme" parent="Theme.AppCompat.Light"> + <style name="BrowserTheme" parent="Theme.AppCompat.Light.NoActionBar"> </style> </resources> diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java index fe96cc6b2c20..e41846b4b612 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java @@ -24,6 +24,7 @@ import android.preference.PreferenceManager; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; +import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; @@ -41,6 +42,7 @@ import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.GridView; import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.TextView; @@ -112,6 +114,10 @@ public class LibreOfficeUIActivity extends ActionBarActivity implements ActionBa public void createUI() { + setContentView(R.layout.activity_document_browser); + + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayShowTitleEnabled(false); //This should show current directory if anything @@ -123,9 +129,11 @@ public class LibreOfficeUIActivity extends ActionBarActivity implements ActionBa actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); actionBar.setListNavigationCallbacks(list, this); + LinearLayout content = (LinearLayout) findViewById(R.id.browser_main_content); + if( viewMode == GRID_VIEW){ // code to make a grid view - setContentView(R.layout.file_grid); + getLayoutInflater().inflate(R.layout.file_grid, content); gv = (GridView)findViewById(R.id.file_explorer_grid_view); gv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, @@ -136,7 +144,7 @@ public class LibreOfficeUIActivity extends ActionBarActivity implements ActionBa actionBar.setSelectedNavigationItem( filterMode + 1 );//This triggers the listener which modifies the view. registerForContextMenu(gv); }else{ - setContentView(R.layout.file_list); + getLayoutInflater().inflate(R.layout.file_list, content); lv = (ListView)findViewById( R.id.file_explorer_list_view); lv.setClickable(true); actionBar.setSelectedNavigationItem( filterMode + 1 ); |