[Libreoffice-commits] core.git: android/source

aleksandar-stefanovic theonewithideas at gmail.com
Sat Feb 11 00:07:22 UTC 2017


 android/source/res/drawable/ic_settings_black_24dp.xml                |    9 +++++++
 android/source/res/menu/navigation_menu.xml                           |    6 +++++
 android/source/res/menu/view_menu.xml                                 |    8 ++----
 android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java |   12 ++++++----
 4 files changed, 26 insertions(+), 9 deletions(-)

New commits:
commit b46ed21a33849d2268406feb875f46bc925a65ec
Author: aleksandar-stefanovic <theonewithideas at gmail.com>
Date:   Thu Feb 9 10:32:21 2017 +0100

    Moved "storage provider settings" to nav drawer
    
    Moved "storage provider settings" to the navigation drawer, because
    it makes more sense to put it below the storage options, than in a
    overflow menu. Also, switched positions of "Settings" and "About",
    because About is always the last item, by convention.
    
    Change-Id: If6d621abfee7a3bdda28311a9cadf35ea674f852
    Reviewed-on: https://gerrit.libreoffice.org/34073
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Aleksandar Stefanović <theonewithideas at gmail.com>

diff --git a/android/source/res/drawable/ic_settings_black_24dp.xml b/android/source/res/drawable/ic_settings_black_24dp.xml
new file mode 100644
index 0000000..ace746c
--- /dev/null
+++ b/android/source/res/drawable/ic_settings_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.43,12.98c0.04,-0.32 0.07,-0.64 0.07,-0.98s-0.03,-0.66 -0.07,-0.98l2.11,-1.65c0.19,-0.15 0.24,-0.42 0.12,-0.64l-2,-3.46c-0.12,-0.22 -0.39,-0.3 -0.61,-0.22l-2.49,1c-0.52,-0.4 -1.08,-0.73 -1.69,-0.98l-0.38,-2.65C14.46,2.18 14.25,2 14,2h-4c-0.25,0 -0.46,0.18 -0.49,0.42l-0.38,2.65c-0.61,0.25 -1.17,0.59 -1.69,0.98l-2.49,-1c-0.23,-0.09 -0.49,0 -0.61,0.22l-2,3.46c-0.13,0.22 -0.07,0.49 0.12,0.64l2.11,1.65c-0.04,0.32 -0.07,0.65 -0.07,0.98s0.03,0.66 0.07,0.98l-2.11,1.65c-0.19,0.15 -0.24,0.42 -0.12,0.64l2,3.46c0.12,0.22 0.39,0.3 0.61,0.22l2.49,-1c0.52,0.4 1.08,0.73 1.69,0.98l0.38,2.65c0.03,0.24 0.24,0.42 0.49,0.42h4c0.25,0 0.46,-0.18 0.49,-0.42l0.38,-2.65c0.61,-0.25 1.17,-0.59 1.69,-0.98l2.49,1c0.23,0.09 0.49,0 0.61,-0.22l2,-3.46c0.12,-0.22 0.07,-0.49 -0.12,-0.64l-2.11,-1.65zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"/>
+</vector>
diff --git a/android/source/res/menu/navigation_menu.xml b/android/source/res/menu/navigation_menu.xml
index a14ff7ab4..21f6860 100644
--- a/android/source/res/menu/navigation_menu.xml
+++ b/android/source/res/menu/navigation_menu.xml
@@ -7,4 +7,10 @@
         <!--Items will be added programmatically in LibreOfficeUIActivity.java-->
 
     </group>
+
+    <group android:orderInCategory="100">
+        <item android:id="@+id/menu_storage_preferences"
+            android:title="@string/storage_provider_settings"
+            android:icon="@drawable/ic_settings_black_24dp"/>
+    </group>
 </menu>
diff --git a/android/source/res/menu/view_menu.xml b/android/source/res/menu/view_menu.xml
index 3c0003b..f7adc62 100644
--- a/android/source/res/menu/view_menu.xml
+++ b/android/source/res/menu/view_menu.xml
@@ -16,12 +16,10 @@
                 android:title="@string/menu_sort_modified"/>
         </menu>
     </item>
-    <item android:id="@+id/menu_storage_preferences"
-          android:title="@string/storage_provider_settings"/>
-    <item android:id="@+id/action_about"
-          android:title="@string/action_about"
-          android:orderInCategory="100"/>
     <item android:id="@+id/action_settings"
           android:title="@string/action_settings"
           android:orderInCategory="100"/>
+    <item android:id="@+id/action_about"
+        android:title="@string/action_about"
+        android:orderInCategory="100"/>
 </menu>
diff --git a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
index 4720785..2f5bd271 100644
--- a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
+++ b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
@@ -22,6 +22,7 @@ import android.os.AsyncTask;
 import android.os.Bundle;
 import android.os.Handler;
 import android.preference.PreferenceManager;
+import android.support.annotation.NonNull;
 import android.support.design.widget.NavigationView;
 import android.support.v4.content.ContextCompat;
 import android.support.v4.widget.DrawerLayout;
@@ -219,9 +220,15 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
                 item.setIcon(iconRes);
             }
         }
+
+        final Context context = this; //needed for anonymous method below
         navigationDrawer.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
             @Override
-            public boolean onNavigationItemSelected(final MenuItem item) {
+            public boolean onNavigationItemSelected(@NonNull MenuItem item) {
+                if (item.getItemId() == R.id.menu_storage_preferences) {
+                    startActivity(new Intent(context, DocumentProviderSettingsActivity.class));
+                    return true;
+                }
                 int position = providerNames.indexOf(item.getTitle());
                 switchToDocumentProvider(documentProviderFactory.getProvider(position));
                 return true;
@@ -573,9 +580,6 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
             case R.id.action_settings:
                 startActivity(new Intent(getApplicationContext(), SettingsActivity.class));
                 return true;
-            case R.id.menu_storage_preferences:
-                startActivity(new Intent(this, DocumentProviderSettingsActivity.class));
-                break;
 
             default:
                 return super.onOptionsItemSelected(item);


More information about the Libreoffice-commits mailing list