Kaynağa Gözat

Merge pull request #6156 from nextcloud/feature/ui-revamp/new-drawer

New design (UI) - Revamp drawer
Tobias Kaminsky 4 yıl önce
ebeveyn
işleme
01ef66a13d

Dosya farkı çok büyük olduğundan ihmal edildi
+ 114 - 536
src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java


+ 0 - 2
src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -2578,7 +2578,6 @@ public class FileDisplayActivity extends FileActivity
             setFile(file);
 
             User user = optionalUser.get();
-            setAccountInDrawer(user);
             setupDrawer();
 
             mSwitchAccountButton.setTag(user.getAccountName());
@@ -2660,7 +2659,6 @@ public class FileDisplayActivity extends FileActivity
         if (optionalNewUser.isPresent()) {
             user = optionalNewUser.get();
             setUser(user);
-            updateAccountList();
         } else {
             dismissLoadingDialog();
             DisplayUtils.showSnackMessage(this, getString(R.string.associated_account_not_found));

+ 0 - 4
src/main/java/com/owncloud/android/ui/activity/UploadListActivity.java

@@ -198,10 +198,6 @@ public class UploadListActivity extends FileActivity {
     @Override
     protected void onStart() {
         super.onStart();
-        final Optional<User> optionalUser = getUser();
-        if (optionalUser.isPresent()) {
-            setAccountInDrawer(optionalUser.get());
-        }
     }
 
     @Override

+ 13 - 0
src/main/java/com/owncloud/android/utils/ThemeUtils.java

@@ -34,6 +34,7 @@ import android.text.Spannable;
 import android.text.SpannableString;
 import android.text.Spanned;
 import android.text.style.ForegroundColorSpan;
+import android.view.MenuItem;
 import android.view.View;
 import android.view.Window;
 import android.widget.EditText;
@@ -634,6 +635,18 @@ public final class ThemeUtils {
         return null;
     }
 
+    /**
+     * Will change a menu item text tint
+     * @param item the menu item object
+     * @param color the wanted color (as resource or color)
+     */
+    public static void tintMenuItemText(MenuItem item, int color) {
+        SpannableString newItemTitle = new SpannableString(item.getTitle());
+        newItemTitle.setSpan(new ForegroundColorSpan(color), 0, newItemTitle.length(),
+                             Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+        item.setTitle(newItemTitle);
+    }
+
     public static String colorToHexString(int color) {
         return String.format("#%06X", 0xFFFFFF & color);
     }

+ 0 - 23
src/main/res/drawable/ic_down.xml

@@ -1,23 +0,0 @@
-<!--
-    @author Google LLC
-    Copyright (C) 2018 Google LLC
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:height="24dp"
-    android:width="24dp"
-    android:viewportWidth="24"
-    android:viewportHeight="24">
-    <path android:fillColor="#FFFFFF" android:pathData="M7,10L12,15L17,10H7Z" />
-</vector>

+ 0 - 23
src/main/res/drawable/ic_up.xml

@@ -1,23 +0,0 @@
-<!--
-    @author Google LLC
-    Copyright (C) 2018 Google LLC
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:height="24dp"
-    android:width="24dp"
-    android:viewportWidth="24"
-    android:viewportHeight="24">
-    <path android:fillColor="#FFFFFF" android:pathData="M7,15L12,10L17,15H7Z" />
-</vector>

Dosya farkı çok büyük olduğundan ihmal edildi
+ 17 - 0
src/main/res/drawable/nextcloud_logo.xml


+ 10 - 7
src/main/res/layout/drawer.xml

@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
+<?xml version="1.0" encoding="utf-8"?><!--
   Nextcloud Android client application
 
   Copyright (C) 2016 Andy Scherzinger
@@ -19,7 +18,7 @@
   License along with this program. If not, see <http://www.gnu.org/licenses/>.
   -->
 <merge xmlns:android="http://schemas.android.com/apk/res/android"
-       xmlns:app="http://schemas.android.com/apk/res-auto">
+    xmlns:app="http://schemas.android.com/apk/res-auto">
 
     <com.google.android.material.navigation.NavigationView
         android:id="@+id/nav_view"
@@ -27,10 +26,11 @@
         android:layout_height="match_parent"
         android:layout_gravity="start"
         android:layout_weight="1"
-        android:fitsSystemWindows="true"
         android:background="@color/appbar"
+        android:fitsSystemWindows="true"
         android:theme="@style/NavigationView_ItemTextAppearance"
         app:headerLayout="@layout/drawer_header"
+        app:itemTextColor="@color/drawer_text_color"
         app:menu="@menu/partial_drawer_entries">
 
         <LinearLayout
@@ -38,7 +38,7 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_gravity="bottom"
-            android:background="@color/bg_default"
+            android:background="@color/appbar"
             android:clickable="false"
             android:orientation="vertical"
             android:paddingLeft="@dimen/standard_padding"
@@ -60,14 +60,17 @@
                 android:layout_height="wrap_content"
                 android:indeterminate="false"
                 android:indeterminateOnly="false"
+                android:scaleY="1.4"
                 android:text="@string/drawer_quota" />
 
-            <TextView
+            <com.google.android.material.textview.MaterialTextView
                 android:id="@+id/drawer_quota_percentage"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:drawablePadding="@dimen/alternate_half_padding"
-                android:text="@string/drawer_quota" />
+                android:fontFamily="sans-serif-medium"
+                android:text="@string/drawer_quota"
+                android:textColor="@color/drawer_text_color" />
 
         </LinearLayout>
 

+ 13 - 116
src/main/res/layout/drawer_header.xml

@@ -1,9 +1,9 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
+<?xml version="1.0" encoding="utf-8"?><!--
   Nextcloud Android client application
 
   Copyright (C) 2016 Andy Scherzinger
   Copyright (C) 2016 Nextcloud.
+  Copyright (C) 2020 Infomaniak Network SA
 
   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@@ -19,122 +19,19 @@
   License along with this program. If not, see <http://www.gnu.org/licenses/>.
   -->
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:id="@+id/drawer_header_view"
-              android:layout_width="match_parent"
-              android:layout_height="@dimen/nav_drawer_header_height"
-              android:fitsSystemWindows="true">
+    android:id="@+id/drawer_header_view"
+    android:layout_width="match_parent"
+    android:layout_height="@dimen/drawer_header_height"
+    android:fitsSystemWindows="true">
 
     <ImageView
-        android:id="@+id/drawer_header_background"
-        android:layout_width="match_parent"
+        android:id="@+id/drawer_header_logo"
+        android:layout_width="@dimen/drawer_header_logo_width"
         android:layout_height="match_parent"
-        android:contentDescription="@string/drawer_header_background"
-        android:src="@drawable/background"
-        android:scaleType="centerCrop"/>
-
-    <RelativeLayout
-        android:id="@+id/drawer_active_user"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_gravity="bottom"
-        android:paddingTop="@dimen/standard_padding"
-        android:paddingRight="@dimen/standard_padding"
-        android:paddingLeft="@dimen/standard_padding"
-        android:paddingBottom="@dimen/zero">
-
-        <FrameLayout
-            android:id="@+id/drawer_user_avatars"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_gravity="top"
-            android:layout_marginBottom="@dimen/standard_half_margin">
-
-            <ImageView
-                android:id="@+id/drawer_current_account"
-                android:layout_width="@dimen/nav_drawer_header_avatar"
-                android:layout_height="@dimen/nav_drawer_header_avatar"
-                android:src="@drawable/account_circle_white"
-                android:contentDescription="@string/drawer_current_account"/>
-
-            <ImageView
-                android:id="@+id/drawer_account_middle"
-                android:layout_width="@dimen/nav_drawer_header_avatar_other_accounts_size"
-                android:layout_height="@dimen/nav_drawer_header_avatar_other_accounts_size"
-                android:layout_gravity="end"
-                android:layout_marginEnd="@dimen/nav_drawer_header_avatar_second_account_margin"
-                android:src="@drawable/account_circle_white"
-                android:onClick="onAccountDrawerClick"
-                android:contentDescription="@string/drawer_middle_account"/>
-
-            <ImageView
-                android:id="@+id/drawer_account_end"
-                android:layout_width="@dimen/nav_drawer_header_avatar_other_accounts_size"
-                android:layout_height="@dimen/nav_drawer_header_avatar_other_accounts_size"
-                android:layout_gravity="end"
-                android:src="@drawable/account_circle_white"
-                android:onClick="onAccountDrawerClick"
-                android:contentDescription="@string/drawer_end_account"/>
-
-        </FrameLayout>
-
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@+id/drawer_user_avatars"
-            >
-
-            <LinearLayout
-                android:layout_width="0dp"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center_vertical"
-                android:layout_weight="1"
-                android:orientation="vertical"
-                android:paddingEnd="@dimen/standard_half_padding"
-                android:paddingStart="@dimen/zero">
-
-                <TextView
-                    android:id="@+id/drawer_username"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:ellipsize="end"
-                    android:shadowColor="@color/drawer_shadow"
-                    android:shadowDx="0.5"
-                    android:shadowDy="0"
-                    android:shadowRadius="2"
-                    android:maxLines="1"
-                    android:text="@string/app_name"
-                    android:textColor="@color/text_color"
-                    android:textSize="@dimen/drawer_header_text"
-                    android:textStyle="bold"/>
-
-                <TextView
-                    android:id="@+id/drawer_username_full"
-                    android:layout_width="match_parent"
-                    android:layout_height="28dp"
-                    android:ellipsize="end"
-                    android:lines="1"
-                    android:maxLines="1"
-                    android:shadowColor="@color/drawer_shadow"
-                    android:shadowDx="0.5"
-                    android:shadowDy="0"
-                    android:shadowRadius="2"
-                    android:text="@string/app_name"
-                    android:textColor="@color/text_color"
-                    android:textSize="@dimen/drawer_header_subtext"/>
-
-            </LinearLayout>
-
-            <ImageView
-                android:id="@+id/drawer_account_chooser_toggle"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center_vertical"
-                android:layout_marginBottom="8dp"
-                android:contentDescription="@string/drawer_manage_accounts"
-                android:src="@drawable/ic_down"/>
-
-        </LinearLayout>
-
-    </RelativeLayout>
+        android:layout_margin="@dimen/standard_margin"
+        android:contentDescription="@string/empty"
+        android:scaleType="fitCenter"
+        android:src="@drawable/nextcloud_logo"
+        android:tint="@color/drawer_logo_color" />
 
 </FrameLayout>

+ 0 - 18
src/main/res/menu/partial_drawer_entries.xml

@@ -95,24 +95,6 @@
             android:title="@string/drawer_item_trashbin"/>
     </group>
 
-    <!--
-      account list placeholder
-      all items in this group MUST have orderInCategory="2" set
-      all accounts are dynamically added with orderInCategory="1" set
-    -->
-    <group android:id="@+id/drawer_menu_accounts">
-        <item
-            android:id="@+id/drawer_menu_account_add"
-            android:icon="@drawable/ic_account_plus"
-            android:orderInCategory="2"
-            android:title="@string/prefs_add_account"/>
-        <item
-            android:id="@+id/drawer_menu_account_manage"
-            android:icon="@drawable/nav_settings"
-            android:orderInCategory="2"
-            android:title="@string/drawer_manage_accounts"/>
-    </group>
-
     <!--
      all items in this group MUST have orderInCategory="3" set
    -->

+ 1 - 0
src/main/res/values/colors.xml

@@ -77,6 +77,7 @@
     <color name="switch_thumb_color_unchecked">#FFFFFF</color>
     <color name="switch_track_color_unchecked">#4D000000</color>
     <color name="drawer_active_item_background">#80000000</color>
+    <color name="drawer_logo_color">#FFFFFF</color>
 
     <!-- Excluded from future app dark theme -->
     <color name="themed_fg">#FFFFFF</color>

+ 2 - 7
src/main/res/values/dims.xml

@@ -19,12 +19,6 @@
     <!-- Default screen margins, per the Android Design guidelines. -->
     <dimen name="nav_drawer_header_height">140dp</dimen>
     <dimen name="nav_drawer_header_avatar">56dp</dimen>
-    <!-- avatar radius needs to 1/2 of the avatar dp value -->
-    <dimen name="nav_drawer_header_avatar_radius">28dp</dimen>
-    <dimen name="nav_drawer_header_avatar_other_accounts_size">40dp</dimen>
-    <dimen name="nav_drawer_header_avatar_other_accounts_radius">20dp</dimen>
-    <!-- margin must be nav_drawer_header_avatar_other_accounts_size+16dp -->
-    <dimen name="nav_drawer_header_avatar_second_account_margin">56dp</dimen>
     <dimen name="nav_drawer_menu_avatar_radius">12sp</dimen>
     <dimen name="list_item_avatar_icon_radius">20dp</dimen>
     <dimen name="bottom_sheet_menu_item_divider_standard_margin">56dp</dimen>
@@ -66,7 +60,6 @@
     <dimen name="alternate_padding_independent">10dip</dimen>
     <dimen name="activity_row_layout_min_width_independent">196dip</dimen>
     <dimen name="user_icon_size_independent">40dip</dimen>
-    <dimen name="drawer_header_text">14sp</dimen>
     <dimen name="drawer_header_subtext">12sp</dimen>
     <dimen name="edit_share_layout_view_height">2dp</dimen>
     <dimen name="fragment_margin">12dp</dimen>
@@ -143,6 +136,8 @@
     <dimen name="button_corner_radius">24dp</dimen>
     <integer name="media_grid_width">4</integer>
     <dimen name="copy_internal_link_padding">10dp</dimen>
+    <dimen name="drawer_header_height">130dp</dimen>
+    <dimen name="drawer_header_logo_width">170dp</dimen>
     <dimen name="account_action_button_margin">12dp</dimen>
     <dimen name="account_action_button_height">50dp</dimen>
     <dimen name="account_action_button_vertical_margin">10dp</dimen>

+ 0 - 3
src/main/res/values/setup.xml

@@ -61,9 +61,6 @@
     <bool name="show_drawer_logout">false</bool>
     <bool name="show_drawer_contacts_backup">false</bool> <!-- if false it will shown in settings -->
 
-    <!-- Various other options -->
-    <bool name="allow_profile_click">true</bool>
-
     <!-- Help, imprint and feedback, and other things -->
     <bool name="passcode_enabled">true</bool>
     <bool name="device_credentials_enabled">true</bool>

+ 0 - 4
src/main/res/values/strings.xml

@@ -401,7 +401,6 @@
     <string name="file_migration_source_not_readable">Do you still want to change the storage path to %1$s?\n\nNote: All data will have to be downloaded again.</string>
 
     <string name="prefs_add_account">Add account</string>
-    <string name="drawer_manage_accounts">Manage accounts</string>
     <string name="auth_redirect_non_secure_connection_title">Secure connection redirected through an unsecured route.</string>
 
     <string name="logs_title">Logs</string>
@@ -668,9 +667,6 @@
     <string name="store_short_desc">The self-hosted productivity platform that keeps you in control</string>
     <string name="store_full_desc">The self-hosted productivity platform that keeps you in control.\n\nFeatures:\n* Easy, modern interface, suited to the theme of your server\n* Upload files to your Nextcloud server\n* Share them with others\n* Keep your favorite files and folders synced\n* Search across all folders on your server\n* Auto Upload for photos and videos taken by your device\n* Keep up to date with notifications\n* Multi-account support\n* Secure access to your data with fingerprint or PIN\n* Integration with DAVx5 (formerly known as DAVdroid) for easy setup of calendar &amp; Contacts synchronization\n\nPlease report all issues at https://github.com/nextcloud/android/issues and discuss this app at https://help.nextcloud.com/c/clients/android\n\nNew to Nextcloud? Nextcloud is a private file sync &amp; share and communication server. It is libre software, and you can host it yourself or pay a company to do it for you. That way, you are in control of your photos, your calendar and contact data, your documents and everything else.\n\nCheck out Nextcloud at https://nextcloud.com</string>
 
-    <string name="drawer_current_account">Current account</string>
-    <string name="drawer_middle_account">Middle account</string>
-    <string name="drawer_end_account">Last account</string>
     <string name="contactlist_item_icon">User icon for contact list</string>
     <string name="activity_icon">Activity</string>
     <string name="file_icon">File</string>

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor