Browse Source

proper coloring and sizing for toolbar_standard.xml(s)

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 4 năm trước cách đây
mục cha
commit
ddd7b901da

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

@@ -53,7 +53,7 @@ import androidx.core.content.ContextCompat;
 import androidx.core.view.ViewCompat;
 
 /**
- * Base class providing toolbar registration functionality, see {@link #setupToolbar(boolean)}.
+ * Base class providing toolbar registration functionality, see {@link #setupToolbar(boolean, boolean)}.
  */
 public abstract class ToolbarActivity extends BaseActivity {
     protected MaterialButton mMenuButton;
@@ -63,7 +63,7 @@ public abstract class ToolbarActivity extends BaseActivity {
     private AppBarLayout mAppBar;
     private RelativeLayout mDefaultToolbar;
     private Toolbar mToolbar;
-    private MaterialCardView mHomeSearchToolbar;
+    private LinearLayout mHomeSearchToolbar;
     private ImageView mPreviewImage;
     private FrameLayout mPreviewImageContainer;
     private LinearLayout mInfoBox;

+ 145 - 131
src/main/res/layout/toolbar_standard.xml

@@ -27,160 +27,174 @@
     android:background="@color/bg_default"
     tools:viewBindingIgnore="true">
 
-    <RelativeLayout
-        android:id="@+id/default_toolbar"
+    <FrameLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         app:layout_scrollFlags="scroll|enterAlways">
 
-        <FrameLayout
-            android:id="@+id/preview_image_frame"
-            android:layout_width="match_parent"
-            android:layout_height="@dimen/nav_drawer_header_height"
-            android:visibility="gone">
-
-            <ImageView
-                android:id="@+id/preview_image"
-                android:layout_width="match_parent"
-                android:layout_height="@dimen/nav_drawer_header_height"
-                android:contentDescription="@string/preview_image_description"
-                android:scaleType="centerCrop" />
-
-            <View
-                android:layout_width="match_parent"
-                android:layout_height="@dimen/nav_drawer_header_height"
-                android:background="@drawable/preview_image_gradient_shape" />
-        </FrameLayout>
-
-        <androidx.appcompat.widget.Toolbar
-            android:id="@+id/toolbar"
-            android:layout_width="match_parent"
-            android:layout_height="62dp"
-            android:background="@color/appbar"
-            android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar"
-            app:popupTheme="@style/Theme.AppCompat.DayNight.NoActionBar"
-            tools:visibility="gone">
-
-            <androidx.appcompat.widget.AppCompatSpinner
-                android:id="@+id/toolbar_spinner"
-                android:layout_width="wrap_content"
-                android:layout_height="match_parent"
-                android:visibility="gone"
-                app:backgroundTint="@color/fontAppbar"
-                app:popupTheme="@style/Theme.AppCompat.DayNight.NoActionBar" />
-        </androidx.appcompat.widget.Toolbar>
-
-    </RelativeLayout>
-
-    <com.google.android.material.card.MaterialCardView
-        android:id="@+id/home_toolbar"
-        android:layout_width="match_parent"
-        android:layout_height="50dp"
-        android:layout_marginStart="16dp"
-        android:layout_marginTop="8dp"
-        android:layout_marginEnd="16dp"
-        android:layout_marginBottom="4dp"
-        android:visibility="gone"
-        app:background="@color/appbar"
-        app:cardCornerRadius="8dp"
-        app:cardElevation="2dp"
-        app:strokeWidth="0dp"
-        tools:visibility="visible"
-        app:layout_scrollFlags="scroll|enterAlways">
-
+        <!-- sorting/layout bar -->
         <androidx.constraintlayout.widget.ConstraintLayout
+            android:id="@+id/sort_list_button_group"
             android:layout_width="match_parent"
-            android:layout_height="match_parent">
+            android:layout_height="wrap_content"
+            android:layout_marginTop="?attr/actionBarSize"
+            android:background="@color/bg_default"
+            android:visibility="gone">
 
             <com.google.android.material.button.MaterialButton
-                android:id="@+id/menu_button"
-                style="@style/Widget.AppTheme.Button.IconButton"
-                android:layout_width="38dp"
-                android:layout_height="38dp"
+                android:id="@+id/sort_button"
+                style="@style/Widget.MaterialComponents.Button.TextButton"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
                 android:layout_marginStart="8dp"
-                android:contentDescription="@string/action_switch_grid_view"
-                app:cornerRadius="@dimen/button_corner_radius"
-                app:icon="@drawable/ic_menu"
+                android:contentDescription="@string/actionbar_sort"
+                android:minWidth="0dp"
+                android:text="@string/menu_item_sort_by_date_newest_first"
+                android:textAlignment="textStart"
+                android:textAllCaps="false"
+                android:textColor="@color/fontAppbar"
+                android:textSize="14sp"
+                app:icon="@drawable/ic_keyboard_arrow_down"
+                app:iconGravity="textEnd"
+                app:iconSize="16dp"
                 app:iconTint="@color/fontAppbar"
                 app:layout_constraintBottom_toBottomOf="parent"
                 app:layout_constraintStart_toStartOf="parent"
                 app:layout_constraintTop_toTopOf="parent" />
 
-            <com.google.android.material.textview.MaterialTextView
-                android:id="@+id/search_text"
-                android:layout_width="0dp"
-                android:layout_height="wrap_content"
-                android:layout_marginStart="18dp"
-                android:layout_marginEnd="18dp"
-                android:ellipsize="end"
-                android:gravity="start"
-                android:lines="1"
-                android:textColor="@color/fontSecondaryAppbar"
-                android:textSize="16sp"
-                app:layout_constraintBottom_toBottomOf="parent"
-                app:layout_constraintLeft_toRightOf="@id/menu_button"
-                app:layout_constraintRight_toLeftOf="@id/switch_account_button"
-                app:layout_constraintTop_toTopOf="parent"
-                tools:text="Search in Nextcloud"/>
-
             <com.google.android.material.button.MaterialButton
-                android:id="@+id/switch_account_button"
+                android:id="@+id/switch_grid_view_button"
                 style="@style/Widget.AppTheme.Button.IconButton"
-                android:layout_width="42dp"
-                android:layout_height="42dp"
-                android:layout_marginEnd="6dp"
-                app:cornerRadius="@dimen/button_corner_radius"
-                app:iconSize="30dp"
+                android:layout_width="38dp"
+                android:layout_height="38dp"
+                android:layout_marginEnd="4dp"
+                android:contentDescription="@string/action_switch_grid_view"
+                app:cornerRadius="24dp"
+                app:icon="@drawable/ic_view_module"
+                app:iconTint="@color/fontAppbar"
                 app:layout_constraintBottom_toBottomOf="parent"
                 app:layout_constraintEnd_toEndOf="parent"
                 app:layout_constraintTop_toTopOf="parent" />
-
         </androidx.constraintlayout.widget.ConstraintLayout>
 
-    </com.google.android.material.card.MaterialCardView>
-
-    <androidx.constraintlayout.widget.ConstraintLayout
-        android:id="@+id/sort_list_button_group"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:visibility="gone"
-        app:layout_scrollFlags="scroll|enterAlways">
+        <!-- default toolbar -->
+        <RelativeLayout
+            android:id="@+id/default_toolbar"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content">
 
-        <com.google.android.material.button.MaterialButton
-            android:id="@+id/sort_button"
-            style="@style/Widget.MaterialComponents.Button.TextButton"
-            android:layout_width="wrap_content"
+            <FrameLayout
+                android:id="@+id/preview_image_frame"
+                android:layout_width="match_parent"
+                android:layout_height="@dimen/nav_drawer_header_height"
+                android:visibility="gone">
+
+                <ImageView
+                    android:id="@+id/preview_image"
+                    android:layout_width="match_parent"
+                    android:layout_height="@dimen/nav_drawer_header_height"
+                    android:contentDescription="@string/preview_image_description"
+                    android:scaleType="centerCrop" />
+
+                <View
+                    android:layout_width="match_parent"
+                    android:layout_height="@dimen/nav_drawer_header_height"
+                    android:background="@drawable/preview_image_gradient_shape" />
+            </FrameLayout>
+
+            <androidx.appcompat.widget.Toolbar
+                android:id="@+id/toolbar"
+                android:layout_width="match_parent"
+                android:layout_height="?attr/actionBarSize"
+                android:background="@color/appbar"
+                android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar"
+                app:popupTheme="@style/Theme.AppCompat.DayNight.NoActionBar"
+                tools:visibility="gone">
+
+                <androidx.appcompat.widget.AppCompatSpinner
+                    android:id="@+id/toolbar_spinner"
+                    android:layout_width="wrap_content"
+                    android:layout_height="match_parent"
+                    android:visibility="gone"
+                    app:backgroundTint="@color/fontAppbar"
+                    app:popupTheme="@style/Theme.AppCompat.DayNight.NoActionBar" />
+            </androidx.appcompat.widget.Toolbar>
+
+        </RelativeLayout>
+
+        <!-- home/search toolbar -->
+        <LinearLayout
+            android:id="@+id/home_toolbar"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginStart="8dp"
-            android:contentDescription="@string/actionbar_sort"
-            android:minWidth="0dp"
-            android:text="@string/menu_item_sort_by_date_newest_first"
-            android:textAlignment="textStart"
-            android:textAllCaps="false"
-            android:textColor="@color/fontAppbar"
-            android:textSize="14sp"
-            app:icon="@drawable/ic_keyboard_arrow_down"
-            app:iconGravity="textEnd"
-            app:iconSize="16dp"
-            app:iconTint="@color/fontAppbar"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent" />
-
-        <com.google.android.material.button.MaterialButton
-            android:id="@+id/switch_grid_view_button"
-            style="@style/Widget.AppTheme.Button.IconButton"
-            android:layout_width="38dp"
-            android:layout_height="38dp"
-            android:layout_marginEnd="4dp"
-            android:contentDescription="@string/action_switch_grid_view"
-            app:cornerRadius="24dp"
-            app:icon="@drawable/ic_view_module"
-            app:iconTint="@color/fontAppbar"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintTop_toTopOf="parent" />
-    </androidx.constraintlayout.widget.ConstraintLayout>
+            android:paddingStart="16dp"
+            android:paddingTop="8dp"
+            android:paddingEnd="16dp"
+            tools:visibility="visible">
+
+            <com.google.android.material.card.MaterialCardView
+                android:layout_width="match_parent"
+                android:layout_height="50dp"
+                android:layout_margin="2dp"
+                app:background="@color/appbar"
+                app:cardCornerRadius="8dp"
+                app:cardElevation="2dp"
+                app:strokeWidth="0dp">
+
+                <androidx.constraintlayout.widget.ConstraintLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent">
+
+                    <com.google.android.material.button.MaterialButton
+                        android:id="@+id/menu_button"
+                        style="@style/Widget.AppTheme.Button.IconButton"
+                        android:layout_width="38dp"
+                        android:layout_height="38dp"
+                        android:layout_marginStart="8dp"
+                        android:contentDescription="@string/action_switch_grid_view"
+                        app:cornerRadius="@dimen/button_corner_radius"
+                        app:icon="@drawable/ic_menu"
+                        app:iconTint="@color/fontAppbar"
+                        app:layout_constraintBottom_toBottomOf="parent"
+                        app:layout_constraintStart_toStartOf="parent"
+                        app:layout_constraintTop_toTopOf="parent" />
+
+                    <com.google.android.material.textview.MaterialTextView
+                        android:id="@+id/search_text"
+                        android:layout_width="0dp"
+                        android:layout_height="wrap_content"
+                        android:layout_marginStart="18dp"
+                        android:layout_marginEnd="18dp"
+                        android:ellipsize="end"
+                        android:gravity="start"
+                        android:lines="1"
+                        android:textColor="@color/fontSecondaryAppbar"
+                        android:textSize="16sp"
+                        app:layout_constraintBottom_toBottomOf="parent"
+                        app:layout_constraintLeft_toRightOf="@id/menu_button"
+                        app:layout_constraintRight_toLeftOf="@id/switch_account_button"
+                        app:layout_constraintTop_toTopOf="parent"
+                        tools:text="Search in Nextcloud" />
+
+                    <com.google.android.material.button.MaterialButton
+                        android:id="@+id/switch_account_button"
+                        style="@style/Widget.AppTheme.Button.IconButton"
+                        android:layout_width="42dp"
+                        android:layout_height="42dp"
+                        android:layout_marginEnd="6dp"
+                        app:cornerRadius="@dimen/button_corner_radius"
+                        app:iconSize="30dp"
+                        app:layout_constraintBottom_toBottomOf="parent"
+                        app:layout_constraintEnd_toEndOf="parent"
+                        app:layout_constraintTop_toTopOf="parent" />
+
+                </androidx.constraintlayout.widget.ConstraintLayout>
+
+            </com.google.android.material.card.MaterialCardView>
+
+        </LinearLayout>
+
+    </FrameLayout>
 
     <include layout="@layout/info_box" />