diff options
Diffstat (limited to 'android')
-rw-r--r-- | android/source/res/drawable/ic_filter_list_black_24dp.xml | 9 | ||||
-rw-r--r-- | android/source/res/layout/activity_document_browser.xml | 14 | ||||
-rw-r--r-- | android/source/res/layout/toolbar.xml | 21 | ||||
-rw-r--r-- | android/source/res/menu/view_menu.xml | 27 | ||||
-rw-r--r-- | android/source/res/values/arrays.xml | 11 | ||||
-rw-r--r-- | android/source/res/values/strings.xml | 7 | ||||
-rw-r--r-- | android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java | 74 |
7 files changed, 110 insertions, 53 deletions
diff --git a/android/source/res/drawable/ic_filter_list_black_24dp.xml b/android/source/res/drawable/ic_filter_list_black_24dp.xml new file mode 100644 index 000000000000..b99b672f4e62 --- /dev/null +++ b/android/source/res/drawable/ic_filter_list_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="M10,18h4v-2h-4v2zM3,6v2h18L21,6L3,6zM6,13h12v-2L6,11v2z"/> +</vector> diff --git a/android/source/res/layout/activity_document_browser.xml b/android/source/res/layout/activity_document_browser.xml index a444d6f66b49..20ca14125003 100644 --- a/android/source/res/layout/activity_document_browser.xml +++ b/android/source/res/layout/activity_document_browser.xml @@ -9,12 +9,24 @@ <LinearLayout 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" > <!-- The toolbar --> - <include layout="@layout/toolbar" /> + <android.support.v7.widget.Toolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + 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"> + + </android.support.v7.widget.Toolbar> + <android.support.v4.widget.DrawerLayout android:id="@+id/drawer_layout" diff --git a/android/source/res/layout/toolbar.xml b/android/source/res/layout/toolbar.xml deleted file mode 100644 index bbeb62a7629c..000000000000 --- a/android/source/res/layout/toolbar.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<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" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - 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"> - - <android.support.v7.widget.AppCompatSpinner - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/toolbar_spinner"/> - -</android.support.v7.widget.Toolbar> diff --git a/android/source/res/menu/view_menu.xml b/android/source/res/menu/view_menu.xml index f7adc6267586..2b99ad15e1ab 100644 --- a/android/source/res/menu/view_menu.xml +++ b/android/source/res/menu/view_menu.xml @@ -3,6 +3,33 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> <item + android:id="@+id/menu_filter" + android:title="@string/filter" + android:icon="@drawable/ic_filter_list_black_24dp" + app:showAsAction="ifRoom"> + <menu> + <group + android:checkableBehavior="single"> + <item + android:id="@+id/menu_filter_everything" + android:title="@string/filter_everything" /> + <item + android:id="@+id/menu_filter_documents" + android:title="@string/filter_documents" /> + <item + android:id="@+id/menu_filter_spreadsheets" + android:title="@string/filter_spreadsheets" /> + <item + android:id="@+id/menu_filter_presentations" + android:title="@string/filter_presentations" /> + <item + android:id="@+id/menu_filter_drawings" + android:title="@string/filter_drawings" /> + </group> + </menu> + </item> + + <item android:id="@+id/menu_sort" android:title="@string/sort" android:icon="@drawable/ic_sort_black_24dp" diff --git a/android/source/res/values/arrays.xml b/android/source/res/values/arrays.xml index 0467baae1b2a..783a3713cd30 100644 --- a/android/source/res/values/arrays.xml +++ b/android/source/res/values/arrays.xml @@ -30,22 +30,13 @@ <item >1</item> </string-array> - <!-- Preference Name Arrays - This has to be in sync with FileUtilities.java. --> - <string-array name="file_view_modes"> + <string-array name="FilterTypeNames"> <item>Everything</item> <item>Documents</item> <item>Spreadsheets</item> <item>Presentations</item> <item>Drawings</item> </string-array> - - <string-array name="FilterTypeNames"> - <item >Everything</item> - <item >Documents</item> - <item >Spreadsheets</item> - <item >Presentations</item> - </string-array> <string-array name="SortModeNames"> <item >A-Z</item> <item >Z-A</item> diff --git a/android/source/res/values/strings.xml b/android/source/res/values/strings.xml index f1e4e3217cf4..ff4a183a98a8 100644 --- a/android/source/res/values/strings.xml +++ b/android/source/res/values/strings.xml @@ -50,6 +50,13 @@ <string name="share">Share</string> <string name="share_via">Share via</string> + <!-- Document browser filters --> + <string name="filter_everything">Everything</string> + <string name="filter_documents">Documents</string> + <string name="filter_spreadsheets">Spreadsheets</string> + <string name="filter_presentations">Presentations</string> + <string name="filter_drawings">Drawings</string> + <!-- Document provider names --> <string name="document_locations">Document locations</string> <string name="close_document_locations">Close document locations</string> diff --git a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java index 2f5bd27159f7..6921eeb4b50c 100644 --- a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java +++ b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java @@ -134,28 +134,7 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { - actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayHomeAsUpEnabled(true); - - //make the navigation spinner - Context context = actionBar.getThemedContext(); - AppCompatSpinner toolbarSpinner = (AppCompatSpinner) findViewById(R.id.toolbar_spinner); - ArrayAdapter<CharSequence> spinnerAdapter = ArrayAdapter.createFromResource(context, R.array.file_view_modes, android.R.layout.simple_spinner_item); - spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); - toolbarSpinner.setAdapter(spinnerAdapter); - toolbarSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { - @Override - public void onItemSelected(AdapterView<?> adapterView, View view, int pos, long id) { - filterMode = pos -1; //bit of a hack, I know. -1 is ALL 0 Docs etc - openDirectory(currentDirectory);// Uses filter mode - } - - @Override - public void onNothingSelected(AdapterView<?> adapterView) { - filterMode = FileUtilities.ALL; - openDirectory(currentDirectory); - } - }); } recentRecyclerView = (RecyclerView) findViewById(R.id.list_recent); @@ -551,6 +530,28 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings item.setTitle(R.string.sort_newest); } + switch (filterMode) { + case FileUtilities.ALL: + menu.findItem(R.id.menu_filter_everything).setChecked(true); + break; + + case FileUtilities.DOC: + menu.findItem(R.id.menu_filter_documents).setChecked(true); + break; + + case FileUtilities.CALC: + menu.findItem(R.id.menu_filter_presentations).setChecked(true); + break; + + case FileUtilities.IMPRESS: + menu.findItem(R.id.menu_filter_presentations).setChecked(true); + break; + + case FileUtilities.DRAWING: + menu.findItem(R.id.menu_filter_drawings).setChecked(true); + break; + } + return true; } @@ -567,6 +568,37 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings openParentDirectory(); } break; + + case R.id.menu_filter_everything: + item.setChecked(true); + filterMode = FileUtilities.ALL; + openDirectory(currentDirectory); + break; + + case R.id.menu_filter_documents: + item.setChecked(true); + filterMode = FileUtilities.DOC; + openDirectory(currentDirectory); + break; + + case R.id.menu_filter_spreadsheets: + item.setChecked(true); + filterMode = FileUtilities.CALC; + openDirectory(currentDirectory); + break; + + case R.id.menu_filter_presentations: + item.setChecked(true); + filterMode = FileUtilities.IMPRESS; + openDirectory(currentDirectory); + break; + + case R.id.menu_filter_drawings: + item.setChecked(true); + filterMode = FileUtilities.DRAWING; + openDirectory(currentDirectory); + break; + case R.id.menu_sort_size: case R.id.menu_sort_az: case R.id.menu_sort_modified: |