diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-24 00:16:08 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-24 00:16:08 -0700 |
commit | 245791389eb09a56658d81e9894881584a712461 (patch) | |
tree | e1a393e8d6f7e328b0348cfc059bb6afd8194b23 /library/src/main/res | |
parent | 9e31fdd4f15ec65cfd272fb1e814bfe0461f0d4f (diff) | |
download | kau-245791389eb09a56658d81e9894881584a712461.tar.gz kau-245791389eb09a56658d81e9894881584a712461.tar.bz2 kau-245791389eb09a56658d81e9894881584a712461.zip |
Initialize searchview
Diffstat (limited to 'library/src/main/res')
-rw-r--r-- | library/src/main/res/layout/kau_search_item.xml | 33 | ||||
-rw-r--r-- | library/src/main/res/layout/kau_search_view.xml | 112 | ||||
-rw-r--r-- | library/src/main/res/values/dimens.xml | 3 | ||||
-rw-r--r-- | library/src/main/res/values/dimens_search.xml | 24 | ||||
-rw-r--r-- | library/src/main/res/values/ids.xml | 1 | ||||
-rw-r--r-- | library/src/main/res/values/strings_commons.xml | 1 | ||||
-rw-r--r-- | library/src/main/res/values/styles.xml | 8 |
7 files changed, 182 insertions, 0 deletions
diff --git a/library/src/main/res/layout/kau_search_item.xml b/library/src/main/res/layout/kau_search_item.xml new file mode 100644 index 0000000..fbdc826 --- /dev/null +++ b/library/src/main/res/layout/kau_search_item.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/linearLayout" + android:layout_width="match_parent" + android:layout_height="@dimen/kau_search_item_height" + android:background="?android:attr/selectableItemBackground" + android:clickable="true" + android:focusable="true" + android:gravity="start|center_vertical" + android:orientation="horizontal"> + + <ImageView + android:id="@+id/search_icon" + android:layout_width="@dimen/kau_search_icon" + android:layout_height="match_parent" + android:contentDescription="@string/kau_search" + android:scaleType="center" /> + + <TextView + android:id="@+id/search_text" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_gravity="start|center_vertical" + android:layout_weight="1" + android:ellipsize="end" + android:gravity="start|center_vertical" + android:maxLines="1" + android:paddingEnd="@dimen/kau_search_key_line_16" + android:paddingStart="@dimen/kau_search_key_line_8" + android:textIsSelectable="false" + android:textSize="@dimen/kau_search_text_small" /> + +</LinearLayout>
\ No newline at end of file diff --git a/library/src/main/res/layout/kau_search_view.xml b/library/src/main/res/layout/kau_search_view.xml new file mode 100644 index 0000000..799d4df --- /dev/null +++ b/library/src/main/res/layout/kau_search_view.xml @@ -0,0 +1,112 @@ +<?xml version="1.0" encoding="utf-8"?> +<merge xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <View + android:id="@+id/search_shadow" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + + <android.support.v7.widget.CardView + android:id="@+id/search_cardview" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <LinearLayout + android:id="@+id/linearLayout" + android:layout_width="match_parent" + android:layout_height="@dimen/kau_search_height" + android:focusable="true" + android:focusableInTouchMode="true" + android:gravity="start|center_vertical" + android:orientation="horizontal"> + + <ImageView + android:id="@+id/search_nav" + android:layout_width="@dimen/kau_search_icon" + android:layout_height="match_parent" + android:background="?android:attr/selectableItemBackgroundBorderless" + android:clickable="true" + android:contentDescription="@string/kau_search" + android:focusable="true" + android:scaleType="centerInside" /> + + <com.lapism.searchview.SearchEditText + android:id="@+id/search_edit_text" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_gravity="start|center_vertical" + android:layout_weight="1" + android:background="@android:color/transparent" + android:ellipsize="end" + android:ems="10" + android:gravity="start|center_vertical" + android:imeOptions="actionSearch|flagNoExtractUi" + android:inputType="textNoSuggestions" + android:maxLines="1" + android:paddingEnd="@dimen/kau_search_key_line_16" + android:paddingStart="@dimen/kau_search_key_line_8" + android:privateImeOptions="nm" + android:textSize="@dimen/kau_search_text_medium" + android:windowSoftInputMode="stateAlwaysHidden" /> + + <ProgressBar + android:id="@+id/search_progress" + style="?android:attr/indeterminateProgressStyle" + android:layout_width="@dimen/kau_search_progress" + android:visibility="gone" + android:layout_height="match_parent" /> + + <FrameLayout + android:layout_width="48dp" + android:layout_height="match_parent"> + + <ImageView + android:id="@+id/search_mic" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="?android:attr/selectableItemBackgroundBorderless" + android:clickable="true" + android:contentDescription="@string/kau_search" + android:focusable="true" + android:visibility="gone" + android:scaleType="center" /> + + <ImageView + android:id="@+id/search_clear" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="?android:attr/selectableItemBackgroundBorderless" + android:clickable="true" + android:contentDescription="@string/kau_search" + android:focusable="true" + android:scaleType="center" /> + + </FrameLayout> + + </LinearLayout> + + <View + android:id="@+id/search_divider" + android:layout_width="match_parent" + android:layout_height="@dimen/kau_search_divider" + android:background="?android:attr/listDivider" /> + + <android.support.v7.widget.RecyclerView + android:id="@+id/search_recycler" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:overScrollMode="never" /> + + </LinearLayout> + + </android.support.v7.widget.CardView> + +</merge>
\ No newline at end of file diff --git a/library/src/main/res/values/dimens.xml b/library/src/main/res/values/dimens.xml index fddb6e3..0c0e749 100644 --- a/library/src/main/res/values/dimens.xml +++ b/library/src/main/res/values/dimens.xml @@ -13,4 +13,7 @@ <dimen name="kau_color_circle_size">56dp</dimen> <dimen name="kau_status_bar_height">24dp</dimen> + + <dimen name="kau_search_dropdownitem_icon_width">32dip</dimen> + </resources> diff --git a/library/src/main/res/values/dimens_search.xml b/library/src/main/res/values/dimens_search.xml new file mode 100644 index 0000000..3664403 --- /dev/null +++ b/library/src/main/res/values/dimens_search.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <dimen name="kau_search_height">46dp</dimen> + + <dimen name="kau_search_key_line_8">8dp</dimen> + <dimen name="kau_search_key_line_16">16dp</dimen> + <dimen name="kau_search_divider">1dp</dimen> + + <dimen name="kau_search_item_margin_text">24dp</dimen> + <dimen name="kau_search_item_height">56dp</dimen> + <dimen name="kau_search_icon">56dp</dimen> + <dimen name="kau_search_progress">24dp</dimen> + <dimen name="kau_search_text_small">14sp</dimen> + <dimen name="kau_search_text_medium">16sp</dimen> + <dimen name="kau_search_reveal">24dp</dimen> + + <dimen name="kau_search_filter_margin_top">4dp</dimen> + <dimen name="kau_search_filter_margin_start">12dp</dimen> + + <dimen name="kau_search_menu_item_margin">1dp</dimen> + <dimen name="kau_search_menu_item_margin_left_right">2dp</dimen> + +</resources>
\ No newline at end of file diff --git a/library/src/main/res/values/ids.xml b/library/src/main/res/values/ids.xml index 54f01af..cda9faa 100644 --- a/library/src/main/res/values/ids.xml +++ b/library/src/main/res/values/ids.xml @@ -7,4 +7,5 @@ <item name="kau_item_pref_color_picker" type="id" /> <item name="kau_item_pref_sub_item" type="id" /> <item name="kau_item_pref_plain_text" type="id" /> + <item name="kau_item_search" type="id" /> </resources>
\ No newline at end of file diff --git a/library/src/main/res/values/strings_commons.xml b/library/src/main/res/values/strings_commons.xml index 2673738..b37c1ea 100644 --- a/library/src/main/res/values/strings_commons.xml +++ b/library/src/main/res/values/strings_commons.xml @@ -49,4 +49,5 @@ Most resources are verbatim and x represents a formatted item <string name="kau_x_minutes">%d minutes</string> <string name="kau_warning">Warning</string> <string name="kau_yes">Yes</string> + <string name="kau_search">Search</string> </resources> diff --git a/library/src/main/res/values/styles.xml b/library/src/main/res/values/styles.xml new file mode 100644 index 0000000..c8e2197 --- /dev/null +++ b/library/src/main/res/values/styles.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <style name="KauSearchView" parent="Widget.AppCompat.SearchView.ActionBar"> + + </style> + +</resources>
\ No newline at end of file |