aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard MacGregor <rmacgregor@cyngn.com>2015-06-18 16:24:32 -0700
committerSteve Kondik <steve@cyngn.com>2016-11-02 17:29:52 -0700
commit968cca0a8ca42b19e119032d0c03ec7e489ff034 (patch)
treea639cc749f6bc10859719e385d76bbb27add4f10
parent7cf7a731ef8a51d68e3cd0ac2d8c7ce569fe333f (diff)
downloadandroid_packages_apps_CMFileManager-968cca0a8ca42b19e119032d0c03ec7e489ff034.tar.gz
android_packages_apps_CMFileManager-968cca0a8ca42b19e119032d0c03ec7e489ff034.tar.bz2
android_packages_apps_CMFileManager-968cca0a8ca42b19e119032d0c03ec7e489ff034.zip
Update drawer foundation and ui
Adds new UI elements and lays out the foundation so that the navigation drawer can be wired up. Currently new drawer has wired links to home, roots, and settings. Change-Id: I73d577fca0377eaba397cb2931ad378c0613ef34
-rw-r--r--res/drawable/ic_details.xml10
-rw-r--r--res/drawable/ic_favorite_on.xml27
-rw-r--r--res/drawable/ic_folder.xml27
-rw-r--r--res/drawable/ic_home.xml26
-rw-r--r--res/drawable/ic_settings.xml35
-rw-r--r--res/drawable/ic_source_internal.xml27
-rw-r--r--res/drawable/ic_source_protected.xml27
-rw-r--r--res/drawable/ic_source_root_d.xml27
-rw-r--r--res/drawable/ic_source_sd_card.xml27
-rw-r--r--res/drawable/ic_source_usb.xml28
-rw-r--r--res/drawable/ic_storage_sources.xml27
-rw-r--r--res/layout/navigation.xml2
-rw-r--r--res/layout/navigation_header.xml24
-rw-r--r--res/menu/navigation.xml80
-rw-r--r--res/values/colors.xml22
-rw-r--r--res/values/dimen.xml2
-rw-r--r--res/values/integers.xml3
-rwxr-xr-xsrc/com/cyanogenmod/filemanager/activities/MainActivity.java105
18 files changed, 483 insertions, 43 deletions
diff --git a/res/drawable/ic_details.xml b/res/drawable/ic_details.xml
index 0d125c00..1f6b84bc 100644
--- a/res/drawable/ic_details.xml
+++ b/res/drawable/ic_details.xml
@@ -20,10 +20,8 @@
android:viewportWidth="24"
android:viewportHeight="24">
- <group>
- <path
- android:fillColor="#000000"
- android:pathData="M12 2c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm1
-15h-2v-6h2v6zm0-8h-2v-2h2v2z" />
- </group>
+ <path
+ android:fillColor="#FFFFFF"
+ android:pathData="M11,17h2v-6h-2V17z M12,2C6.5,2,2,6.5,2,12s4.5,10,10,10s10-4.5,10-10S17.5,2,12,2z
+M12,20c-4.4,0-8-3.6-8-8s3.6-8,8-8s8,3.6,8,8S16.4,20,12,20z M11,9h2V7h-2V9z" />
</vector> \ No newline at end of file
diff --git a/res/drawable/ic_favorite_on.xml b/res/drawable/ic_favorite_on.xml
new file mode 100644
index 00000000..16de53c3
--- /dev/null
+++ b/res/drawable/ic_favorite_on.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2015 The CyanogenMod Project
+
+ 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:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="#FFFFFF"
+ android:pathData="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46
+4.73L5.82 21z" />
+</vector> \ No newline at end of file
diff --git a/res/drawable/ic_folder.xml b/res/drawable/ic_folder.xml
new file mode 100644
index 00000000..5c11a4f9
--- /dev/null
+++ b/res/drawable/ic_folder.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2015 The CyanogenMod Project
+
+ 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:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="#FFFFFF"
+ android:pathData="M10,4H4C2.9,4,2,4.9,2,6l0,12c0,1.1,0.9,2,2,2h16c1.1,0,2-0.9,2-2V8c0-1.1-0.9-2-2-2h-8
+L10,4z" />
+</vector> \ No newline at end of file
diff --git a/res/drawable/ic_home.xml b/res/drawable/ic_home.xml
new file mode 100644
index 00000000..252656d3
--- /dev/null
+++ b/res/drawable/ic_home.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2015 The CyanogenMod Project
+
+ 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:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="#FFFFFF"
+ android:pathData="M10 20v-6h4v6h5v-8h3l-10-9-10 9h3v8z" />
+</vector> \ No newline at end of file
diff --git a/res/drawable/ic_settings.xml b/res/drawable/ic_settings.xml
new file mode 100644
index 00000000..28222363
--- /dev/null
+++ b/res/drawable/ic_settings.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2015 The CyanogenMod Project
+
+ 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:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="#FFFFFF"
+ android:pathData="M19.43 12.98c.04-.32 .07 -.64 .07 -.98s-.03-.66-.07-.98l2.11-1.65c.19-.15 .24
+-.42 .12 -.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49
+1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65c-.03-.24-.24-.42-.49-.42h-4c-.25 0-.46 .18
+-.49 .42 l-.38 2.65c-.61 .25 -1.17 .59 -1.69 .98 l-2.49-1c-.23-.09-.49 0-.61 .22
+l-2 3.46c-.13 .22 -.07 .49 .12 .64 l2.11 1.65c-.04 .32 -.07 .65 -.07 .98 s.03
+.66 .07 .98 l-2.11 1.65c-.19 .15 -.24 .42 -.12 .64 l2 3.46c.12 .22 .39 .3 .61
+.22 l2.49-1c.52 .4 1.08 .73 1.69 .98 l.38 2.65c.03 .24 .24 .42 .49 .42 h4c.25 0
+.46-.18 .49 -.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.23 .09 .49 0
+.61-.22l2-3.46c.12-.22 .07 -.49-.12-.64l-2.11-1.65zm-7.43 2.52c-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> \ No newline at end of file
diff --git a/res/drawable/ic_source_internal.xml b/res/drawable/ic_source_internal.xml
new file mode 100644
index 00000000..e47c73cb
--- /dev/null
+++ b/res/drawable/ic_source_internal.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2015 The CyanogenMod Project
+
+ 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:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="#FFFFFF"
+ android:pathData="M17,1L7,1C5.9,1,5,1.9,5,3v18c0,1.1,0.9,2,2,2h10c1.1,0,2-0.9,2-2V3
+C19,1.9,18.1,1,17,1z M17,19H7V5h10V19z" />
+</vector> \ No newline at end of file
diff --git a/res/drawable/ic_source_protected.xml b/res/drawable/ic_source_protected.xml
new file mode 100644
index 00000000..84e38e9e
--- /dev/null
+++ b/res/drawable/ic_source_protected.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2015 The CyanogenMod Project
+
+ 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:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="#FFFFFF"
+ android:pathData="M18,23v-2h1c1.1,0,2-0.9,2-2V5c0-1.1-0.9-2-2-2H5C3.9,3,3,3.9,3,5l0,14c0,1.1,0.9,2,2,2h1v2h2v-2h8v2H18z
+M16,11.7V16h-2v-4.3c-0.6-0.3-1-1-1-1.7c0-1.1,0.9-2,2-2c1.1,0,2,0.9,2,2C17,10.7,16.6,11.4,16,11.7z" />
+</vector> \ No newline at end of file
diff --git a/res/drawable/ic_source_root_d.xml b/res/drawable/ic_source_root_d.xml
new file mode 100644
index 00000000..5d633e8f
--- /dev/null
+++ b/res/drawable/ic_source_root_d.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2015 The CyanogenMod Project
+
+ 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:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="#FFFFFF"
+ android:pathData="M12,2C6.5,2,2,6.5,2,12c0,5.5,4.5,10,10,10s10-4.5,10-10 C22,6.5,17.5,2,12,2z
+M10.5,17H8l5.5-10H16L10.5,17z" />
+</vector> \ No newline at end of file
diff --git a/res/drawable/ic_source_sd_card.xml b/res/drawable/ic_source_sd_card.xml
new file mode 100644
index 00000000..07f07424
--- /dev/null
+++ b/res/drawable/ic_source_sd_card.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2015 The CyanogenMod Project
+
+ 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:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="#FFFFFF"
+ android:pathData="M18,2h-8L4,8l0,12c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2V4 C20,2.9,19.1,2,18,2z
+M12,8h-2V4h2V8z M15,8h-2V4h2V8z M18,8h-2V4h2V8z" />
+</vector> \ No newline at end of file
diff --git a/res/drawable/ic_source_usb.xml b/res/drawable/ic_source_usb.xml
new file mode 100644
index 00000000..3def4b34
--- /dev/null
+++ b/res/drawable/ic_source_usb.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2015 The CyanogenMod Project
+
+ 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:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="#FFFFFF"
+ android:pathData="M15.1,7.4v4h1v2h-3v-8h2l-3-4l-3,4h2v8h-3v-2.1c0.7-0.4,1.2-1.1,1.2-1.9
+c0-1.2-1-2.2-2.2-2.2s-2.2,1-2.2,2.2c0,0.9,0.5,1.6,1.2,1.9v2.1c0,1.1,0.9,2,2,2h3v3c-0.7,0.4-1.2,1.1-1.2,2c0,1.2,1,2.2,2.2,2.2
+c1.2,0,2.2-1,2.2-2.2c0-0.9-0.5-1.6-1.2-2v-3.1h3c1.1,0,2-0.9,2-2v-2h1v-4C19.1,7.4,15.1,7.4,15.1,7.4z" />
+</vector> \ No newline at end of file
diff --git a/res/drawable/ic_storage_sources.xml b/res/drawable/ic_storage_sources.xml
new file mode 100644
index 00000000..33137cc4
--- /dev/null
+++ b/res/drawable/ic_storage_sources.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2015 The CyanogenMod Project
+
+ 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:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="#FFFFFF"
+ android:pathData="M2 20h20v-4h-20v4zm2-3h2v2h-2v-2zm-2-13v4h20v-4h-20zm4 3h-2v-2h2v2zm-4
+7h20v-4h-20v4zm2-3h2v2h-2v-2z" />
+</vector> \ No newline at end of file
diff --git a/res/layout/navigation.xml b/res/layout/navigation.xml
index f46aee4e..8e93eea8 100644
--- a/res/layout/navigation.xml
+++ b/res/layout/navigation.xml
@@ -33,6 +33,8 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
+ android:background="@color/navigation_drawer_background"
+ app:headerLayout="@layout/navigation_header"
app:menu="@menu/navigation" />
</android.support.v4.widget.DrawerLayout>
diff --git a/res/layout/navigation_header.xml b/res/layout/navigation_header.xml
new file mode 100644
index 00000000..7a4bd7f3
--- /dev/null
+++ b/res/layout/navigation_header.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/drawer_header_height"
+ android:background="@android:color/background_light">
+
+ <ImageView
+ android:id="@+id/header"
+ android:background="@color/default_primary"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scaleType="centerCrop"/>
+ <TextView
+ android:layout_gravity="bottom"
+ android:paddingStart="10dp"
+ android:paddingBottom="10dp"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:textColor="@android:color/white"
+ android:textSize="30sp"
+ android:text="@string/app_name" />
+
+</FrameLayout> \ No newline at end of file
diff --git a/res/menu/navigation.xml b/res/menu/navigation.xml
index 97bf5318..27fdd2a2 100644
--- a/res/menu/navigation.xml
+++ b/res/menu/navigation.xml
@@ -17,37 +17,55 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity">
- <group android:checkableBehavior="single">
- <item
- android:id="@+id/navigation_item_1"
- android:checked="true"
- android:icon="@drawable/ic_launcher_themes"
- android:title="HEY!" />
- <item
- android:id="@+id/navigation_item_2"
- android:icon="@drawable/ic_launcher_themes"
- android:title="WOW" />
+ <group
+ android:checkableBehavior="none"
+ android:id="@+id/navigation_group_home">
+ <item android:id="@+id/navigation_item_home"
+ android:icon="@drawable/ic_home"
+ android:title="Home"
+ android:checked="true" />
+ <item android:id="@+id/navigation_item_favorites"
+ android:icon="@drawable/ic_favorite_on"
+ android:title="Favorites"
+ android:visible="false" /> <!-- hidden until wired up -->
</group>
- <group android:checkableBehavior="single">
- <item
- android:id="@+id/navigation_item_1"
- android:checked="true"
- android:icon="@drawable/ic_launcher_themes"
- android:title="HEY!" />
- <item
- android:id="@+id/navigation_item_2"
- android:icon="@drawable/ic_launcher_themes"
- android:title="WOW" />
+ <group
+ android:checkableBehavior="none"
+ android:id="@+id/navigation_group_roots">
+ <!-- TODO: Replace with dynamically created roots -->
+ <item android:id="@+id/navigation_item_internal"
+ android:icon="@drawable/ic_source_internal"
+ android:title="Local storage" />
+ <item android:id="@+id/navigation_item_root_d"
+ android:icon="@drawable/ic_source_root_d"
+ android:title="Root directory"
+ android:visible="false" /> <!-- hidden until wired up -->
+ <item android:id="@+id/navigation_item_sd_card"
+ android:icon="@drawable/ic_source_sd_card"
+ android:title="SD card"
+ android:visible="false" /> <!-- hidden until wired up -->
+ <item android:id="@+id/navigation_item_usb"
+ android:icon="@drawable/ic_source_usb"
+ android:title="USB storage"
+ android:visible="false" /> <!-- hidden until wired up -->
+ <item android:id="@+id/navigation_item_protected"
+ android:icon="@drawable/ic_source_protected"
+ android:title="Protected storage"
+ android:orderInCategory="@integer/navigation_item_order_after_roots"
+ android:visible="false" /> <!-- hidden until wired up -->
</group>
- <group android:checkableBehavior="single">
- <item
- android:id="@+id/navigation_item_1"
- android:checked="true"
- android:icon="@drawable/ic_launcher_themes"
- android:title="HEY!" />
- <item
- android:id="@+id/navigation_item_2"
- android:icon="@drawable/ic_launcher_themes"
- android:title="WOW" />
+
+ <group
+ android:checkableBehavior="none"
+ android:id="@+id/navigation_group_settings">
+ <item android:id="@+id/navigation_item_manage"
+ android:icon="@drawable/ic_storage_sources"
+ android:title="Manage storage sources"
+ android:orderInCategory="@integer/navigation_item_order_after_roots"
+ android:visible="false" /> <!-- hidden until wired up -->
+ <item android:id="@+id/navigation_item_settings"
+ android:icon="@drawable/ic_settings"
+ android:title="Settings"
+ android:orderInCategory="@integer/navigation_item_order_after_roots" />
</group>
-</menu> \ No newline at end of file
+</menu>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 8e08f9e1..f7efafa4 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -16,16 +16,36 @@
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- The default primary color -->
+ <color name="default_primary">#009688</color>
+ <!-- The favorites primary color -->
+ <color name="favorites_primary">#f2b807</color>
+ <!-- The sdcard primary color -->
+ <color name="sdcard_primary">#FF5722</color>
+ <!-- The usb storage primary color -->
+ <color name="usb_primary">#3F51B5</color>
+ <!-- The root direcotry primary color -->
+ <color name="root_primary">#607D8B</color>
+ <!-- The protected storage primary color -->
+ <color name="protected_primary">#37474f</color>
+
+
<!-- The default background color -->
<color name="default_background">@android:color/white</color>
<!-- The default dissabled background color -->
<color name="default_background_disabled">#f2f2f2</color>
<!-- A black color with some transparency -->
- <color name="black_transparent">#99000000</color>
+ <color name="black_transparent">#8a000000</color>
<!-- A derivated blue from @color/material_palette_blue_primary with some transparency -->
<color name="blue_transparent">#9933b5e5</color>
+ <!-- Navigation Drawer Background Color -->
+ <color name="navigation_drawer_background">#fafafa</color>
+ <!-- Navigation Drawer Selected Item Background Color -->
+ <color name="navigation_drawer_selected">#e8e8e8</color>
+
<!-- Disk usage total color -->
<color name="disk_usage_total">#7ecccccc</color>
<!-- Disk usage used color -->
diff --git a/res/values/dimen.xml b/res/values/dimen.xml
index 342db6b7..aff0b46a 100644
--- a/res/values/dimen.xml
+++ b/res/values/dimen.xml
@@ -124,7 +124,7 @@
<!-- Scrim layout elevation -->
<dimen name="scrim_layout_elevation">10dp</dimen>
<!-- Drawer header height -->
- <dimen name="drawer_header_height">150dp</dimen>
+ <dimen name="drawer_header_height">172dp</dimen>
<!-- usage graph stuff -->
<dimen name="legend_title_textSize">9sp</dimen>
diff --git a/res/values/integers.xml b/res/values/integers.xml
index bf5cb5e0..763682c2 100644
--- a/res/values/integers.xml
+++ b/res/values/integers.xml
@@ -30,4 +30,7 @@
<!-- Association items per row -->
<integer name="associations_items_per_row">3</integer>
+
+ <!-- Navigation drawer group last -->
+ <integer name="navigation_item_order_after_roots">1</integer>
</resources>
diff --git a/src/com/cyanogenmod/filemanager/activities/MainActivity.java b/src/com/cyanogenmod/filemanager/activities/MainActivity.java
index 7f60d98d..153c0c6d 100755
--- a/src/com/cyanogenmod/filemanager/activities/MainActivity.java
+++ b/src/com/cyanogenmod/filemanager/activities/MainActivity.java
@@ -22,20 +22,27 @@ import android.app.Dialog;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.content.pm.PackageManager;
+import android.content.res.ColorStateList;
+import android.graphics.Color;
import android.net.Uri;
import android.nfc.NfcAdapter;
import android.os.Bundle;
import android.provider.Settings;
+import android.support.design.widget.NavigationView;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
+import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
+import android.util.Log;
import android.view.KeyEvent;
+import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import com.cyanogenmod.filemanager.R;
+import com.cyanogenmod.filemanager.activities.preferences.SettingsPreferences;
import com.cyanogenmod.filemanager.model.Bookmark;
import com.cyanogenmod.filemanager.model.FileSystemObject;
import com.cyanogenmod.filemanager.preferences.FileManagerSettings;
@@ -61,7 +68,8 @@ import java.util.List;
* {@link Activity#onRestoreInstanceState(Bundle)} are not implemented, and every time
* the app is killed, is restarted from his initial state.
*/
-public class MainActivity extends ActionBarActivity {
+public class MainActivity extends ActionBarActivity
+ implements NavigationView.OnNavigationItemSelectedListener {
private static final String TAG = MainActivity.class.getSimpleName();
@@ -74,6 +82,11 @@ public class MainActivity extends ActionBarActivity {
private static final String STR_USB = "usb"; // $NON-NLS-1$
/**
+ * Intent code for request a search.
+ */
+ public static final int INTENT_REQUEST_SETTINGS = 20001;
+
+ /**
* Constant for extra information about selected search entry.
*/
public static final String EXTRA_SEARCH_ENTRY_SELECTION =
@@ -110,9 +123,21 @@ public class MainActivity extends ActionBarActivity {
static String MIME_TYPE_LOCALIZED_NAMES[];
- public HomeFragment mHomeFragment;
- public Toolbar mToolbar;
- Fragment currentFragment;
+ int[][] color_states = new int[][] {
+ new int[] {android.R.attr.state_checked}, // checked
+ new int[0] // default
+ };
+
+ // TODO: Replace with legitimate colors per item.
+ int[] colors = new int[] {
+ R.color.favorites_primary,
+ Color.BLACK
+ };
+
+ private Toolbar mToolbar;
+ private Fragment currentFragment;
+ private DrawerLayout mDrawerLayout;
+ private NavigationView mNavigationDrawer;
private static final int REQUEST_CODE_STORAGE_PERMS = 321;
private boolean hasPermissions() {
@@ -222,6 +247,16 @@ public class MainActivity extends ActionBarActivity {
}
private void finishOnCreate() {
+ mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
+ mNavigationDrawer = (NavigationView) findViewById(R.id.navigation_view);
+ mNavigationDrawer.setNavigationItemSelectedListener(this);
+ ColorStateList colorStateList = new ColorStateList(color_states, colors);
+ // TODO: Figure out why the following doesn't work correctly...
+ mNavigationDrawer.setItemTextColor(colorStateList);
+ mNavigationDrawer.setItemIconTintList(colorStateList);
+
+ setCurrentFragment(FragmentType.HOME);
+
//Initialize nfc adapter
NfcAdapter mNfcAdapter = NfcAdapter.getDefaultAdapter(this);
if (mNfcAdapter != null) {
@@ -289,6 +324,58 @@ public class MainActivity extends ActionBarActivity {
//stub
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean onNavigationItemSelected(MenuItem menuItem) {
+ int id = menuItem.getItemId();
+ switch (id) {
+ case R.id.navigation_item_home:
+ if (DEBUG) Log.d(TAG, "onNavigationItemSelected::navigation_item_home");
+ setCurrentFragment(FragmentType.HOME);
+ break;
+ case R.id.navigation_item_favorites:
+ // TODO: Implement this path
+ if (DEBUG) Log.d(TAG, "onNavigationItemSelected::navigation_item_favorites");
+ break;
+ case R.id.navigation_item_internal:
+ if (DEBUG) Log.d(TAG, "onNavigationItemSelected::navigation_item_favorites");
+ setCurrentFragment(FragmentType.NAVIGATION);
+ break;
+ case R.id.navigation_item_root_d:
+ // TODO: Implement this path
+ if (DEBUG) Log.d(TAG, "onNavigationItemSelected::navigation_item_root_d");
+ break;
+ case R.id.navigation_item_sd_card:
+ // TODO: Implement this path
+ if (DEBUG) Log.d(TAG, "onNavigationItemSelected::navigation_item_sd_card");
+ break;
+ case R.id.navigation_item_usb:
+ // TODO: Implement this path
+ if (DEBUG) Log.d(TAG, "onNavigationItemSelected::navigation_item_usb");
+ break;
+ case R.id.navigation_item_protected:
+ // TODO: Implement this path
+ if (DEBUG) Log.d(TAG, "onNavigationItemSelected::navigation_item_protected");
+ break;
+ case R.id.navigation_item_manage:
+ // TODO: Implement this path
+ if (DEBUG) Log.d(TAG, "onNavigationItemSelected::navigation_item_manage");
+ break;
+ case R.id.navigation_item_settings:
+ if (DEBUG) Log.d(TAG, "onNavigationItemSelected::navigation_item_settings");
+ openSettings();
+ break;
+ default:
+ // TODO: Implement this path
+ if (DEBUG) Log.d(TAG, "onNavigationItemSelected::default");
+ setCurrentFragment(FragmentType.NAVIGATION); // Temporary...
+ break;
+ }
+ mDrawerLayout.closeDrawers();
+ return true;
+ }
/**
* Method invoked when an action item is clicked.
@@ -391,4 +478,14 @@ public class MainActivity extends ActionBarActivity {
}
}
+ /**
+ * Method that opens the settings activity.
+ *
+ * @hide
+ */
+ void openSettings() {
+ Intent settingsIntent = new Intent(MainActivity.this,
+ SettingsPreferences.class);
+ startActivityForResult(settingsIntent, INTENT_REQUEST_SETTINGS);
+ }
}