diff options
author | Raj Yengisetty <rajesh@cyngn.com> | 2015-07-31 11:12:27 -0700 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-11-02 20:23:35 -0700 |
commit | 1fc16721e78665f51b1eb8832e70de4606538524 (patch) | |
tree | 10a8030264fdb1492676f36fb18674f39b1afcc1 | |
parent | 44f6340bc95a9327e96bbe09982c8a5f93f90009 (diff) | |
download | android_packages_apps_CMFileManager-1fc16721e78665f51b1eb8832e70de4606538524.tar.gz android_packages_apps_CMFileManager-1fc16721e78665f51b1eb8832e70de4606538524.tar.bz2 android_packages_apps_CMFileManager-1fc16721e78665f51b1eb8832e70de4606538524.zip |
Home screen: update search bar
Change-Id: I99e3fc83fcd4bb792f046df7690f2e4ee50953e0
-rw-r--r-- | AndroidManifest.xml | 2 | ||||
-rw-r--r-- | res/drawable/bg_header.png | bin | 36740 -> 0 bytes | |||
-rw-r--r-- | res/drawable/fm_header_bg.xml | 133 | ||||
-rw-r--r-- | res/drawable/ic_cancel_close.xml | 27 | ||||
-rw-r--r-- | res/drawable/ic_search.xml | 28 | ||||
-rw-r--r-- | res/drawable/ic_search_voice.xml | 28 | ||||
-rw-r--r-- | res/layout/home_fragment.xml | 13 | ||||
-rw-r--r-- | res/layout/navigation_drawer.xml | 2 | ||||
-rw-r--r-- | res/values/colors.xml | 3 | ||||
-rw-r--r-- | res/values/dimen.xml | 3 | ||||
-rw-r--r-- | res/values/styles.xml | 11 | ||||
-rwxr-xr-x | src/com/cyanogenmod/filemanager/activities/MainActivity.java | 37 | ||||
-rw-r--r-- | src/com/cyanogenmod/filemanager/ui/fragments/HomeFragment.java | 57 | ||||
-rw-r--r-- | src/com/cyanogenmod/filemanager/ui/fragments/NavigationFragment.java | 42 |
14 files changed, 333 insertions, 53 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 37379c02..3135460d 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -54,7 +54,7 @@ <meta-data android:name="android.app.default_searchable" - android:value=".activities.NavigationActivity" /> + android:value=".activities.MainActivity" /> <provider android:name=".providers.RecentSearchesContentProvider" diff --git a/res/drawable/bg_header.png b/res/drawable/bg_header.png Binary files differdeleted file mode 100644 index 74d4dee4..00000000 --- a/res/drawable/bg_header.png +++ /dev/null diff --git a/res/drawable/fm_header_bg.xml b/res/drawable/fm_header_bg.xml new file mode 100644 index 00000000..f2b4091f --- /dev/null +++ b/res/drawable/fm_header_bg.xml @@ -0,0 +1,133 @@ +<?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="403.8dp" + android:height="320.4dp" + android:viewportWidth="403.8" + android:viewportHeight="320.4"> + + <path + android:fillColor="#000000" + android:fillAlpha="0.2" + android:strokeAlpha="0.2" + android:pathData="M402,171.3L373.7,143c-1.1-1.1-2.6-1.8-4.2-1.8c-1.6,0-3.1,0.6-4.2,1.8L320,188.3c-2.3,2.3-2.3,6.1,0,8.5 +l28.3,28.3c1.1,1.1,2.6,1.8,4.2,1.8s3.1-0.6,4.2-1.8l45.3-45.3c1.1-1.1,1.8-2.6,1.8-4.2C403.8,173.9,403.2,172.4,402,171.3z +M363.8,150.1l31.1,31.1L358.2,218l-31.1-31.1L363.8,150.1z +M351.1,222.2l-28.3-28.3c-0.8-0.8-0.8-2,0-2.8l1.4-1.4l31.1,31.1 +l-1.4,1.4C353.2,222.9,351.9,222.9,351.1,222.2z +M399.2,176.9l-1.4,1.4l-31.1-31.1l1.4-1.4c0.4-0.4,0.9-0.6,1.4-0.6 +c0.5,0,1,0.2,1.4,0.6l28.3,28.3c0.4,0.4,0.6,0.9,0.6,1.4S399.6,176.6,399.2,176.9z +M360.2,191.7v-32.3L344,175.5L360.2,191.7z M356.2,182l-6.5-6.5l6.5-6.5V182z +M185.9,154.1l4.2-7l-5.5-5.5c2.6-3.9,2.1-9.2-1.3-12.6c-1.9-1.9-4.4-2.9-7.1-2.9 +c-2,0-3.9,0.6-5.5,1.7l-5.5-5.5l-7,4.2l-10.4-10.4L43.3,220.7l70.7,70.7l104.7-104.7L185.9,154.1z +M170.7,133.3l1.4-1.4 +c1.1-1.1,2.6-1.8,4.2-1.8c1.6,0,3.1,0.6,4.2,1.8c2.3,2.3,2.3,6.1,0,8.5l-1.4,1.4l6,6l-6.4,10.6l-24.7-24.7l10.6-6.4L170.7,133.3z +M147.9,121.7l6.9,6.9l-7.1,4.3l31.9,31.9l4.3-7.1l23.5,23.5l-99,99l-59.4-59.4L147.9,121.7z +M111.1,283l99-99l2.8,2.8l-99,99 L111.1,283z +M173.2,139.2c-0.8-0.8-1.2-1.8-1.2-2.8s0.4-2.1,1.2-2.8s1.8-1.2,2.8-1.2c1.1,0,2.1,0.4,2.8,1.2c0.8,0.8,1.2,1.8,1.2,2.8 +s-0.4,2.1-1.2,2.8c-0.8,0.8-1.8,1.2-2.8,1.2C175,140.4,174,140,173.2,139.2z +M179,200.9L128.1,150l5.7-5.7l50.9,50.9L179,200.9z +M123.9,154.3l2.8-2.8l50.9,50.9l-2.8,2.8L123.9,154.3z +M84.9,150.7l-8.5-8.5l0,0l-17-17l0,0l-5.7-5.7L0,173.3l8.5,8.5l0,0l17,17 +l0,0l5.7,5.7L84.9,150.7z M48.1,136.6l-2.8-2.8l2.8-2.8l2.8,2.8L48.1,136.6z +M45.3,139.4l-2.8,2.8l-2.8-2.8l2.8-2.8L45.3,139.4z +M39.6,145.1l-2.8,2.8l-2.8-2.8l2.8-2.8L39.6,145.1z +M33.9,150.7l-1.4,1.4l-1.4,1.4l-2.8-2.8l2.8-2.8L33.9,150.7z M28.3,156.4 +l-2.8,2.8l-2.8-2.8l2.8-2.8L28.3,156.4z +M22.6,162l-2.8,2.8L17,162l2.8-2.8L22.6,162z +M17,167.7l-2.8,2.8l-2.8-2.8l2.8-2.8L17,167.7 z +M35.4,155l7.1-7.1L56.6,162l-7.1,7.1l-7.1,7.1L28.3,162L35.4,155z +M42.4,181.8l2.8,2.8l-2.8,2.8l-2.8-2.8L42.4,181.8z M45.3,179 +l2.8-2.8l2.8,2.8l-2.8,2.8L45.3,179z +M50.9,173.3l1.4-1.4l1.4-1.4l2.8,2.8l-2.8,2.8L50.9,173.3z +M56.6,167.7l2.8-2.8l2.8,2.8 l-2.8,2.8L56.6,167.7z +M62.2,162l2.8-2.8l2.8,2.8l-2.8,2.8L62.2,162z +M67.9,156.4l2.8-2.8l2.8,2.8l-2.8,2.8L67.9,156.4z M36.8,187.5 +l2.8,2.8l-2.8,2.8l-2.8-2.8L36.8,187.5z +M76.4,153.5l-2.8-2.8l2.8-2.8l2.8,2.8L76.4,153.5z +M59.4,159.2l-14.1-14.1l14.1-14.1 l14.1,14.1L59.4,159.2z +M56.6,128.1l-2.8,2.8l-2.8-2.8l2.8-2.8L56.6,128.1z +M8.5,170.5l2.8,2.8l-2.8,2.8l-2.8-2.8L8.5,170.5z +M25.5,164.9L39.6,179l-14.1,14.1L11.3,179L25.5,164.9z +M31.1,193.1l2.8,2.8l-2.8,2.8l-2.8-2.8L31.1,193.1z M99,136.6l70.7-70.7 +l-48.1-48.1L50.9,88.5L99,136.6z M164,65.9L99,130.9L56.6,88.5l65.1-65.1L164,65.9z +M148.5,72.9L114.6,39l2.8-2.8l33.9,33.9 L148.5,72.9z +M137.9,83.5l-33.9-33.9l2.8-2.8l33.9,33.9L137.9,83.5z +M132.2,89.2L98.3,55.3l2.8-2.8l33.9,33.9L132.2,89.2z +M126.6,94.9L92.6,60.9l2.8-2.8L129.4,92L126.6,94.9z +M120.9,100.5L87,66.6l2.8-2.8l33.9,33.9L120.9,100.5z M81.3,72.2l2.8-2.8 +l17,17l-2.8,2.8L81.3,72.2z +M99,110.8c-1.6,0-3.1,0.6-4.2,1.8c-1.1,1.1-1.8,2.6-1.8,4.2c0,1.6,0.6,3.1,1.8,4.2 +c1.1,1.1,2.6,1.8,4.2,1.8s3.1-0.6,4.2-1.8c1.1-1.1,1.8-2.6,1.8-4.2c0-1.6-0.6-3.1-1.8-4.2C102.1,111.4,100.6,110.8,99,110.8z +M100.4,118.2c-0.8,0.8-2.1,0.8-2.8,0c-0.4-0.4-0.6-0.9-0.6-1.4c0-0.5,0.2-1,0.6-1.4c0.4-0.4,0.9-0.6,1.4-0.6s1,0.2,1.4,0.6 +c0.4,0.4,0.6,0.9,0.6,1.4C101,117.3,100.8,117.8,100.4,118.2z +M268.4,190.3l-5.7-5.7l-5.7,5.7l-5.7-5.7L175,261l59.4,59.4l5.7-5.7 +l5.7,5.7l5.7-5.7l5.7,5.7l76.4-76.4L274,184.6L268.4,190.3z +M234.4,314.7L180.7,261l70.7-70.7l2.8,2.8L186.4,261l50.9,50.9 L234.4,314.7z +M245.8,314.7L192,261l70.7-70.7l2.8,2.8L197.7,261l50.9,50.9L245.8,314.7z +M257.1,314.7L203.3,261l70.7-70.7 l53.7,53.7L257.1,314.7z +M62.2,48.9l-2.8-2.8l4.2-4.2c7-7,7-18.4,0-25.5c-3.4-3.4-7.9-5.3-12.7-5.3s-9.3,1.9-12.7,5.3l-4.2,4.2 +l-2.8-2.8L5.7,43.2l31.1,31.1L62.2,48.9z +M41,19.2c2.6-2.6,6.2-4.1,9.9-4.1s7.3,1.5,9.9,4.1c5.5,5.5,5.5,14.3,0,19.8l-4.2,4.2 +L36.8,23.4L41,19.2z M31.1,23.4l25.5,25.5L36.8,68.7L11.3,43.2L31.1,23.4z +M36.8,49.2c1.6,0,3.1-0.6,4.2-1.8c2.3-2.3,2.3-6.1,0-8.5 +c-1.1-1.1-2.6-1.8-4.2-1.8c-1.6,0-3.1,0.6-4.2,1.8c-1.1,1.1-1.8,2.6-1.8,4.2c0,0.9,0.2,1.8,0.6,2.6l-4.5,4.5l2.8,2.8l4.5-4.5 +C35,49,35.9,49.2,36.8,49.2z +M35.4,41.8c0.4-0.4,0.9-0.6,1.4-0.6c0.5,0,1,0.2,1.4,0.6c0.8,0.8,0.8,2,0,2.8c-0.8,0.8-2.1,0.8-2.8,0 +c-0.4-0.4-0.6-0.9-0.6-1.4C34.8,42.7,35,42.2,35.4,41.8z +M280.6,164c21.9,0,42.5-8.5,58-24c15.5-15.5,24-36.1,24-58s-8.5-42.5-24-58 +c-15.5-15.5-36.1-24-58-24s-42.5,8.5-58,24c-15.5,15.5-24,36.1-24,58s8.5,42.5,24,58C238.1,155.5,258.7,164,280.6,164z +M225.5,26.8 +C240.2,12.1,259.8,4,280.6,4s40.4,8.1,55.2,22.8s22.8,34.3,22.8,55.2s-8.1,40.4-22.8,55.2S301.5,160,280.6,160s-40.4-8.1-55.2-22.8 +s-22.8-34.3-22.8-55.2S210.7,41.6,225.5,26.8z +M280.6,116c9.1,0,17.6-3.5,24-10c6.4-6.4,10-15,10-24s-3.5-17.6-10-24 +c-6.4-6.4-15-10-24-10s-17.6,3.5-24,10c-6.4,6.4-10,15-10,24s3.5,17.6,10,24C263,112.5,271.5,116,280.6,116z +M259.4,60.8 +c5.7-5.7,13.2-8.8,21.2-8.8s15.5,3.1,21.2,8.8c5.7,5.7,8.8,13.2,8.8,21.2s-3.1,15.5-8.8,21.2c-5.7,5.7-13.2,8.8-21.2,8.8 +s-15.5-3.1-21.2-8.8c-5.7-5.7-8.8-13.2-8.8-21.2S253.7,66.5,259.4,60.8z +M287.7,89.1c3.9-3.9,3.9-10.2,0-14.1 +c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2,1-7.1,2.9c-3.9,3.9-3.9,10.2,0,14.1c1.9,1.9,4.4,2.9,7.1,2.9S285.8,91,287.7,89.1z +M276.4,77.8 +c1.1-1.1,2.6-1.8,4.2-1.8s3.1,0.6,4.2,1.8c2.3,2.3,2.3,6.1,0,8.5c-1.1,1.1-2.6,1.8-4.2,1.8s-3.1-0.6-4.2-1.8 +C274,83.9,274,80.1,276.4,77.8z +M234,128.7c-6.6-6.6-11.6-14.4-15-23l3.7-1.4c3.1,8.1,7.8,15.4,14.1,21.6 +c6.2,6.2,13.5,10.9,21.6,14.1l-1.4,3.7C248.3,140.3,240.6,135.3,234,128.7z +M239.6,123c-3.8-3.8-7.1-8.2-9.7-12.9l3.5-1.9 +c2.4,4.4,5.5,8.4,9.1,12c3.6,3.6,7.6,6.6,12,9.1l-1.9,3.5C247.8,130.1,243.4,126.9,239.6,123z +M245.3,117.4 +c-1.6-1.6-3.2-3.4-4.6-5.3l3.2-2.4c1.3,1.7,2.7,3.3,4.2,4.8c1.5,1.5,3.1,2.9,4.8,4.2l-2.4,3.2C248.7,120.5,246.9,119,245.3,117.4z +M302.5,79.3l4-0.5c0.1,1.1,0.2,2.1,0.2,3.2c0,1.1-0.1,2.1-0.2,3.2l-4-0.5c0.1-0.9,0.2-1.8,0.2-2.7 +C302.6,81.1,302.6,80.2,302.5,79.3z +M286.9,103.1c3.5-1,6.6-2.9,9.2-5.5l0.1-0.1l1.3,1.5l1.5,1.3l-0.1,0.1c-3,3-6.8,5.3-10.9,6.5 +L286.9,103.1z +M301.7,88.3l3.8,1.1c-0.8,2.8-2.1,5.3-3.8,7.7l-3.3-2.3C300,92.8,301,90.6,301.7,88.3z +M283.4,103.8l0.5,4 +c-1.1,0.1-2.2,0.2-3.2,0.2c-1.1,0-2.1-0.1-3.2-0.2l0.5-4C279.7,104.1,281.6,104.1,283.4,103.8z +M267.9,99.9c2,1.4,4.2,2.5,6.5,3.2 l-1.1,3.8c-2.8-0.8-5.4-2.1-7.7-3.7L267.9,99.9z +M301.7,75.7c-1-3.5-2.9-6.7-5.5-9.3l2.8-2.9l0.1,0.1c3,3,5.3,6.8,6.5,10.9 +L301.7,75.7z +M258.8,84.8l-4,0.5c-0.1-1.1-0.2-2.2-0.2-3.3c0-1.1,0.1-2.1,0.2-3.2l4,0.5c-0.1,0.9-0.2,1.8-0.2,2.7 +C258.6,82.9,258.7,83.8,258.8,84.8z +M262.2,100.4c-3-3-5.3-6.8-6.5-10.9l3.8-1.1c1,3.5,2.9,6.6,5.5,9.2l0.1,0.1L262.2,100.4z +M262.2,100.4C262.2,100.4,262.2,100.4,262.2,100.4l1.4-1.3L262.2,100.4L262.2,100.4z +M262.2,100.4L262.2,100.4L262.2,100.4 L262.2,100.4z +M277.8,60.2l-0.5-4c2.1-0.3,4.3-0.3,6.4,0l-0.5,4C281.5,59.9,279.6,59.9,277.8,60.2z +M293.3,64.1 c-2-1.4-4.2-2.5-6.5-3.2l1.1-3.8c2.8,0.8,5.4,2.1,7.7,3.7L293.3,64.1z +M259.5,75.8l-3.8-1.1c0.8-2.8,2.1-5.4,3.7-7.7l3.3,2.3 +C261.3,71.2,260.2,73.4,259.5,75.8z +M265.1,66.4l-2.9-2.8l0.1-0.1c3-3,6.8-5.3,10.9-6.5l1.1,3.8C270.8,62,267.6,63.9,265.1,66.4z" /> +</vector>
\ No newline at end of file diff --git a/res/drawable/ic_cancel_close.xml b/res/drawable/ic_cancel_close.xml new file mode 100644 index 00000000..56689a29 --- /dev/null +++ b/res/drawable/ic_cancel_close.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="#87000000" + android:pathData="M19 6.41l-1.41-1.41-5.59 5.59-5.59-5.59-1.41 1.41 5.59 5.59-5.59 5.59 1.41 1.41 +5.59-5.59 5.59 5.59 1.41-1.41-5.59-5.59z" /> +</vector> diff --git a/res/drawable/ic_search.xml b/res/drawable/ic_search.xml new file mode 100644 index 00000000..0376c608 --- /dev/null +++ b/res/drawable/ic_search.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="#87000000" + android:pathData="M15.5,14h-0.8l-0.3-0.3c1-1.1,1.6-2.6,1.6-4.2C16,5.9,13.1,3,9.5,3S3,5.9,3,9.5S5.9,16,9.5,16 +c1.6,0,3.1-0.6,4.2-1.6l0.3,0.3v0.8l5,5l1.5-1.5L15.5,14z +M9.5,14C7,14,5,12,5,9.5S7,5,9.5,5S14,7,14,9.5S12,14,9.5,14z" /> +</vector> diff --git a/res/drawable/ic_search_voice.xml b/res/drawable/ic_search_voice.xml new file mode 100644 index 00000000..0f59f3d5 --- /dev/null +++ b/res/drawable/ic_search_voice.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="#87000000" + android:pathData="M12 15c1.66 0 2.99-1.34 2.99-3l.01-6c0-1.66-1.34-3-3-3s-3 1.34-3 3v6c0 1.66 1.34 +3 3 3zm5.3-3c0 3-2.54 5.1-5.3 5.1s-5.3-2.1-5.3-5.1h-1.7c0 3.42 2.72 6.23 6 +6.72v3.28h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z" /> +</vector> diff --git a/res/layout/home_fragment.xml b/res/layout/home_fragment.xml index 7a2fcbc9..383c8b15 100644 --- a/res/layout/home_fragment.xml +++ b/res/layout/home_fragment.xml @@ -88,12 +88,13 @@ android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/default_primary" app:layout_scrollFlags="scroll|exitUntilCollapsed"> <android.support.v7.widget.CardView android:id="@+id/card_view2" android:layout_width="match_parent" - android:layout_height="wrap_content" + android:layout_height="@dimen/search_bar_height" card_view:cardCornerRadius="4dp" android:layout_marginStart="16dp" android:layout_marginEnd="16dp" @@ -101,19 +102,17 @@ android:layout_alignParentBottom="true" android:layout_marginBottom="4dp"> - <android.support.v7.widget.SearchView - android:id="@+id/homepage_searchbar" + <SearchView + android:id="@+id/homepage_search_bar" android:layout_width="match_parent" android:layout_height="match_parent" - app:layout_collapseMode="parallax" - android:background="@color/console_fg" - android:layout_alignParentBottom="true" /> + android:cursorVisible="false"/> </android.support.v7.widget.CardView> <ImageView android:id="@+id/backdrop" - android:src="@drawable/bg_header" + android:src="@drawable/fm_header_bg" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="centerCrop" diff --git a/res/layout/navigation_drawer.xml b/res/layout/navigation_drawer.xml index 39082f5c..e12d33bf 100644 --- a/res/layout/navigation_drawer.xml +++ b/res/layout/navigation_drawer.xml @@ -74,7 +74,7 @@ android:layout_width="match_parent"> <ImageView android:id="@+id/header" - android:background="@drawable/bg_header" + android:background="@drawable/fm_header_bg" android:src="@drawable/header_gradient" android:layout_width="match_parent" android:layout_height="match_parent" diff --git a/res/values/colors.xml b/res/values/colors.xml index acf9462d..ba60f05f 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -145,4 +145,7 @@ <color name="default_title_indicator_selected_color">#FFFFFFFF</color> <color name="default_title_indicator_text_color">#BBFFFFFF</color> <color name="default_underline_indicator_selected_color">#FF33B5E5</color> + + <!-- Search bar --> + <color name="search_bar_hint_text_color">#df000000</color> </resources> diff --git a/res/values/dimen.xml b/res/values/dimen.xml index f3496179..324cf66c 100644 --- a/res/values/dimen.xml +++ b/res/values/dimen.xml @@ -180,4 +180,7 @@ <dimen name="default_title_indicator_footer_line_height">2dp</dimen> <dimen name="default_title_indicator_clip_padding">4dp</dimen> + <!-- Search --> + <dimen name="search_bar_height">48dp</dimen> + <dimen name="search_image_dimensions">24dp</dimen> </resources> diff --git a/res/values/styles.xml b/res/values/styles.xml index 5a4e0fb1..369c681c 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -27,6 +27,8 @@ <item name="android:statusBarColor">@android:color/transparent</item> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> + <item name="android:dropDownItemStyle">@style/dropDownItemStyle</item> + <item name="android:dropDownListViewStyle">@style/dropDownListViewStyle</item> </style> <style name="Widget.FileManager.ActionBar" parent="Widget.AppCompat.ActionBar"> @@ -248,4 +250,13 @@ <item name="android:textStyle">bold</item> </style> + <!-- Search drop down results --> + <style name="dropDownItemStyle" parent="Widget.AppCompat.DropDownItem.Spinner"> + <item name="android:textColor">@color/search_bar_hint_text_color</item> + </style> + + <style name="dropDownListViewStyle" parent="Widget.AppCompat.ListView.DropDown"> + <item name="android:background">@android:color/white</item> + </style> + </resources> diff --git a/src/com/cyanogenmod/filemanager/activities/MainActivity.java b/src/com/cyanogenmod/filemanager/activities/MainActivity.java index 325053bc..3448aa26 100755 --- a/src/com/cyanogenmod/filemanager/activities/MainActivity.java +++ b/src/com/cyanogenmod/filemanager/activities/MainActivity.java @@ -20,6 +20,7 @@ import android.Manifest; import android.app.Activity; import android.app.Dialog; import android.app.FragmentTransaction; +import android.app.SearchManager; import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.Context; @@ -403,7 +404,41 @@ public class MainActivity extends ActionBarActivity */ @Override protected void onNewIntent(Intent intent) { - //stub + handleSearchIntent(intent); + } + + public void handleSearchIntent(Intent intent) { + if (Intent.ACTION_SEARCH.equals(intent.getAction())) { + Intent searchIntent = new Intent(this, SearchActivity.class); + searchIntent.setAction(Intent.ACTION_SEARCH); + //- SearchActivity.EXTRA_SEARCH_DIRECTORY + String extraDir = null; + if (currentFragment instanceof NavigationFragment) { + extraDir = ((NavigationFragment)currentFragment) + .getCurrentNavigationView().getCurrentDir(); + } + extraDir = TextUtils.isEmpty(extraDir) ? FileHelper.ROOT_DIRECTORY : extraDir; + searchIntent.putExtra(SearchActivity.EXTRA_SEARCH_DIRECTORY, extraDir); + //- SearchManager.APP_DATA + if (intent.getBundleExtra(SearchManager.APP_DATA) != null) { + Bundle bundle = new Bundle(); + bundle.putAll(intent.getBundleExtra(SearchManager.APP_DATA)); + searchIntent.putExtra(SearchManager.APP_DATA, bundle); + } + //-- SearchManager.QUERY + String query = intent.getStringExtra(SearchManager.QUERY); + if (query != null) { + searchIntent.putExtra(SearchManager.QUERY, query); + } + //- android.speech.RecognizerIntent.EXTRA_RESULTS + ArrayList<String> extraResults = + intent.getStringArrayListExtra(android.speech.RecognizerIntent.EXTRA_RESULTS); + if (extraResults != null) { + searchIntent.putStringArrayListExtra( + android.speech.RecognizerIntent.EXTRA_RESULTS, extraResults); + } + startActivityForResult(searchIntent, NavigationFragment.INTENT_REQUEST_SEARCH); + } } @Override diff --git a/src/com/cyanogenmod/filemanager/ui/fragments/HomeFragment.java b/src/com/cyanogenmod/filemanager/ui/fragments/HomeFragment.java index e58d8b66..d1dfefef 100644 --- a/src/com/cyanogenmod/filemanager/ui/fragments/HomeFragment.java +++ b/src/com/cyanogenmod/filemanager/ui/fragments/HomeFragment.java @@ -18,7 +18,10 @@ package com.cyanogenmod.filemanager.ui.fragments; import android.app.FragmentTransaction; import android.app.SearchManager; +import android.content.Context; import android.content.Intent; +import android.content.res.Resources; +import android.graphics.Color; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.v4.app.Fragment; @@ -32,6 +35,8 @@ import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.GridView; import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.SearchView; import android.widget.TextView; import android.widget.Toast; @@ -55,7 +60,8 @@ public class HomeFragment extends Fragment { View mView; Toolbar mToolBar; - private android.widget.ArrayAdapter<MimeTypeHelper.MimeTypeCategory> mEasyModeAdapter; + SearchView mSearchView; + private android.widget.ArrayAdapter<MimeTypeCategory> mEasyModeAdapter; private static final List<MimeTypeCategory> EASY_MODE_LIST = new ArrayList<MimeTypeCategory>() { { add(NONE); @@ -101,9 +107,58 @@ public class HomeFragment extends Fragment { mLayoutInflater = inflater; mView = inflater.inflate(R.layout.home_fragment, container, false); + + handleSearchBar(); + return mView; } + private void handleSearchBar() { + mSearchView = (SearchView) mView.findViewById(R.id.homepage_search_bar); + SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context + .SEARCH_SERVICE); + mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity() + .getComponentName())); + mSearchView.setIconifiedByDefault(false); + + Resources res = mSearchView.getContext().getResources(); + int searchPlateId = res.getIdentifier("android:id/search_plate", null, null); + View searchPlate = mSearchView.findViewById(searchPlateId); + if (searchPlate != null) { + int searchTextId = res.getIdentifier("android:id/search_src_text", null, null); + TextView searchText = (TextView) searchPlate.findViewById(searchTextId); + if (searchText != null) { + int searchColor = res.getColor(R.color.search_bar_hint_text_color); + searchText.setTextColor(searchColor); + searchText.setHintTextColor(searchColor); + } + + // Update all the image views to our assets + int imageViewId = res.getIdentifier("android:id/search_button", null, null); + ImageView imageView = (ImageView) mSearchView.findViewById(imageViewId); + if (imageView != null) { + imageView.setImageResource(R.drawable.ic_search); + } + imageViewId = res.getIdentifier("android:id/search_mag_icon", null, null); + imageView = (ImageView) mSearchView.findViewById(imageViewId); + if (imageView != null) { + imageView.setImageResource(R.drawable.ic_search); + } + imageViewId = res.getIdentifier("android:id/search_voice_btn", null, null); + imageView = (ImageView) mSearchView.findViewById(imageViewId); + if (imageView != null) { + imageView.setImageResource(R.drawable.ic_search_voice); + } + imageViewId = res.getIdentifier("android:id/search_close_btn", null, null); + imageView = (ImageView) mSearchView.findViewById(imageViewId); + if (imageView != null) { + imageView.setImageResource(R.drawable.ic_cancel_close); + } + } + + mSearchView.setFocusable(false); + } + @Override public void onStart() { super.onStart(); diff --git a/src/com/cyanogenmod/filemanager/ui/fragments/NavigationFragment.java b/src/com/cyanogenmod/filemanager/ui/fragments/NavigationFragment.java index b0fb1478..d8ddaf41 100644 --- a/src/com/cyanogenmod/filemanager/ui/fragments/NavigationFragment.java +++ b/src/com/cyanogenmod/filemanager/ui/fragments/NavigationFragment.java @@ -582,9 +582,6 @@ public class NavigationFragment extends Fragment for (int i = 0; i < cc; i++) { initNavigation(i, false, getActivity().getIntent()); } - - //Check the intent action - checkIntent(getActivity().getIntent()); } }); @@ -1690,45 +1687,6 @@ public class NavigationFragment extends Fragment } /** - * Method that verifies the intent passed to the activity, and checks - * if a request is made like Search. - * - * @param intent The intent to check - * @hide - */ - void checkIntent(Intent intent) { - //Search action - if (Intent.ACTION_SEARCH.equals(intent.getAction())) { - Intent searchIntent = new Intent(getActivity(), SearchActivity.class); - searchIntent.setAction(Intent.ACTION_SEARCH); - //- SearchActivity.EXTRA_SEARCH_DIRECTORY - searchIntent.putExtra( - SearchActivity.EXTRA_SEARCH_DIRECTORY, - getCurrentNavigationView().getCurrentDir()); - //- SearchManager.APP_DATA - if (intent.getBundleExtra(SearchManager.APP_DATA) != null) { - Bundle bundle = new Bundle(); - bundle.putAll(intent.getBundleExtra(SearchManager.APP_DATA)); - searchIntent.putExtra(SearchManager.APP_DATA, bundle); - } - //-- SearchManager.QUERY - String query = intent.getStringExtra(SearchManager.QUERY); - if (query != null) { - searchIntent.putExtra(SearchManager.QUERY, query); - } - //- android.speech.RecognizerIntent.EXTRA_RESULTS - ArrayList<String> extraResults = - intent.getStringArrayListExtra(android.speech.RecognizerIntent.EXTRA_RESULTS); - if (extraResults != null) { - searchIntent.putStringArrayListExtra( - android.speech.RecognizerIntent.EXTRA_RESULTS, extraResults); - } - startActivityForResult(searchIntent, INTENT_REQUEST_SEARCH); - return; - } - } - - /** * {@inheritDoc} */ @Override |