Skip to content

Commit

Permalink
Update nav drawer styling (#2061)
Browse files Browse the repository at this point in the history
* Tweak menu text and icons

* Nav drawer styles

* Fix accidental paste

* Remove unused

* Tweak styling

* Fix tests

* Remove unused style

---------

Co-authored-by: Shobhit Agarwal <ashobhit@google.com>
  • Loading branch information
gino-m and shobhitagarwal1612 authored Nov 21, 2023
1 parent 2715530 commit f64a8c6
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 29 deletions.
29 changes: 29 additions & 0 deletions ground/src/main/res/drawable-anydpi/ic_history.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>

<!--
~ Copyright 2023 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
~
~ https://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:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#424940"
android:alpha="1.0">
<path
android:fillColor="@android:color/white"
android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"/>
</vector>
29 changes: 29 additions & 0 deletions ground/src/main/res/drawable-anydpi/ic_satellite.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>

<!--
~ Copyright 2023 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
~
~ https://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:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#424940"
android:alpha="1.0">
<path
android:fillColor="@android:color/white"
android:pathData="M19,3L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM19,19L5,19L5,5h14v14zM8.57,6L6,6v2.58c1.42,0 2.57,-1.16 2.57,-2.58zM12,6h-1.71c0,2.36 -1.92,4.29 -4.29,4.29L6,12c3.32,0 6,-2.69 6,-6zM14.14,11.86l-3,3.87L9,13.15 6,17h12z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>

<!--
~ Copyright 2020 Google LLC
~ Copyright 2023 Google LLC
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
Expand All @@ -19,10 +19,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorOnSurface"
android:tint="#424940"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M19.35,10.04C18.67,6.59 15.64,4 12,4c-1.48,0 -2.85,0.43 -4.01,1.17l1.46,1.46C10.21,6.23 11.08,6 12,6c3.04,0 5.5,2.46 5.5,5.5v0.5H19c1.66,0 3,1.34 3,3 0,1.13 -0.64,2.11 -1.56,2.62l1.45,1.45C23.16,18.16 24,16.68 24,15c0,-2.64 -2.05,-4.78 -4.65,-4.96zM3,5.27l2.75,2.74C2.56,8.15 0,10.77 0,14c0,3.31 2.69,6 6,6h11.73l2,2L21,20.73 4.27,4 3,5.27zM7.73,10l8,8H6c-2.21,0 -4,-1.79 -4,-4s1.79,-4 4,-4h1.73z" />
android:fillColor="@android:color/white"
android:pathData="M19,2h-4.18C14.4,0.84 13.3,0 12,0S9.6,0.84 9.18,2L5,2c-1.1,0 -2,0.9 -2,2v16c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,4c0,-1.1 -0.9,-2 -2,-2zM12,2c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1zM19,20L5,20L5,4h2v3h10L17,4h2v16z" />
</vector>
1 change: 1 addition & 0 deletions ground/src/main/res/layout/home_screen_frag.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:itemTextAppearance="@style/TextAppearance.App.TitleSmall.OnSurfaceContainer"
app:headerLayout="@layout/nav_drawer_header"
app:itemBackground="@android:color/transparent"
app:itemIconTint="@color/nav_drawer_item"
Expand Down
38 changes: 17 additions & 21 deletions ground/src/main/res/menu/nav_drawer_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,22 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/nav_change_survey"
android:icon="@drawable/ic_add"
android:icon="@drawable/ic_content_paste"
android:title="@string/change_survey" />
<group
android:id="@+id/group_other"
android:checkableBehavior="none">
<item
android:id="@+id/sync_status"
android:icon="@drawable/ic_sync"
android:title="@string/sync_status" />
<item
android:id="@+id/nav_offline_areas"
android:icon="@drawable/ic_cloud_offline"
android:title="@string/offline_map_imagery" />
<item
android:id="@+id/nav_settings"
android:icon="@drawable/ic_settings"
android:title="@string/settings" />
<item
android:id="@+id/nav_sign_out"
android:icon="@drawable/ic_sign_out"
android:title="@string/sign_out" />
</group>
<item
android:id="@+id/sync_status"
android:icon="@drawable/ic_history"
android:title="@string/sync_status" />
<item
android:id="@+id/nav_offline_areas"
android:icon="@drawable/ic_satellite"
android:title="@string/offline_map_imagery" />
<item
android:id="@+id/nav_settings"
android:icon="@drawable/ic_settings"
android:title="@string/settings" />
<item
android:id="@+id/nav_sign_out"
android:icon="@drawable/ic_sign_out"
android:title="@string/sign_out" />
</menu>
4 changes: 2 additions & 2 deletions ground/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<string name="unexpected_error">An unexpected error has occurred</string>
<string name="google_api_install_failed">Google Play Services installation failed</string>
<string name="sign_out">Sign out</string>
<string name="change_survey">Change survey</string>
<string name="change_survey">Surveys</string>
<string name="collect_data">Collect data</string>

<!-- Untranslated strings -->
Expand All @@ -67,7 +67,7 @@
<string name="date">Date</string>
<string name="time">Time</string>
<!-- Other strings (to be organized) -->
<string name="sync_status">Sync status</string>
<string name="sync_status">History and sync status</string>
<string name="layer_label_format">Job: %s</string>

<string name="add_point">Add point</string>
Expand Down
8 changes: 8 additions & 0 deletions ground/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@
<item name="iconTint">?attr/colorPrimary</item>
</style>

<style name="TextAppearance.App.TitleSmall" parent="TextAppearance.Material3.TitleSmall">
<item name="fontFamily">@font/text_700</item>
</style>

<style name="TextAppearance.App.TitleSmall.OnSurfaceContainer">
<item name="android:textColor">?attr/colorOnSurfaceVariant</item>
</style>

<style name="TextAppearance.App.TitleMedium" parent="TextAppearance.Material3.TitleMedium">
<item name="fontFamily">@font/text_700</item>
<item name="android:textColor">?attr/colorOnSurface</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,14 @@ class NavigationDrawerItemClickTest(
fun data() =
listOf(
arrayOf(
"Change survey",
"Surveys",
TEST_SURVEY_WITHOUT_OFFLINE_TILES,
HomeScreenFragmentDirections.actionHomeScreenFragmentToSurveySelectorFragment(false),
true,
"Clicking 'change survey' should navigate to fragment"
),
arrayOf(
"Sync status",
"History and sync status",
TEST_SURVEY_WITHOUT_OFFLINE_TILES,
HomeScreenFragmentDirections.showSyncStatus(),
true,
Expand Down

0 comments on commit f64a8c6

Please sign in to comment.