diff options
author | Alex Ning <chineseperson5@gmail.com> | 2019-07-18 15:59:14 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2019-07-18 15:59:14 +0000 |
commit | 216228cf0275d84d1895114fd92cb83a70318c81 (patch) | |
tree | 090554108ce267b9d531c465ba4b6445f5e1ec66 /app/src/main/res | |
parent | 611d6a90ec39707b4d4161da1eb5b19249e670c4 (diff) | |
download | infinity-for-reddit-216228cf0275d84d1895114fd92cb83a70318c81.tar infinity-for-reddit-216228cf0275d84d1895114fd92cb83a70318c81.tar.gz infinity-for-reddit-216228cf0275d84d1895114fd92cb83a70318c81.tar.bz2 infinity-for-reddit-216228cf0275d84d1895114fd92cb83a70318c81.tar.lz infinity-for-reddit-216228cf0275d84d1895114fd92cb83a70318c81.tar.xz infinity-for-reddit-216228cf0275d84d1895114fd92cb83a70318c81.tar.zst infinity-for-reddit-216228cf0275d84d1895114fd92cb83a70318c81.zip |
Add a search button in ViewSubredditDetailActivity and ViewUserDetailActivity. Search posts in a specific subreddit is available. Rename SearchActivity to SearchResultActivity. Add SearchActivity for searching instead of searching in MainActivity.
Diffstat (limited to '')
-rw-r--r-- | app/src/main/res/layout/activity_post_text.xml | 6 | ||||
-rw-r--r-- | app/src/main/res/layout/activity_search.xml | 111 | ||||
-rw-r--r-- | app/src/main/res/layout/activity_search_result.xml | 72 | ||||
-rw-r--r-- | app/src/main/res/menu/menu_search.xml | 5 | ||||
-rw-r--r-- | app/src/main/res/menu/search_activity.xml | 12 | ||||
-rw-r--r-- | app/src/main/res/menu/search_result_activity.xml | 16 | ||||
-rw-r--r-- | app/src/main/res/menu/view_subreddit_detail_activity.xml | 10 | ||||
-rw-r--r-- | app/src/main/res/menu/view_user_detail_activity.xml | 10 | ||||
-rw-r--r-- | app/src/main/res/values/strings.xml | 3 |
9 files changed, 189 insertions, 56 deletions
diff --git a/app/src/main/res/layout/activity_post_text.xml b/app/src/main/res/layout/activity_post_text.xml index d889d00b..b3066f1f 100644 --- a/app/src/main/res/layout/activity_post_text.xml +++ b/app/src/main/res/layout/activity_post_text.xml @@ -26,18 +26,18 @@ android:paddingEnd="16dp"> <pl.droidsonroids.gif.GifImageView - android:id="@+id/subreddit_icon_gif_image_view_post_text_activity" + android:id="@+id/subreddit_icon_gif_image_view_search_activity" android:layout_width="24dp" android:layout_height="24dp" android:layout_alignParentStart="true" android:layout_centerVertical="true" /> <TextView - android:id="@+id/subreddit_name_text_view_post_text_activity" + android:id="@+id/subreddit_name_text_view_search_activity" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toStartOf="@id/rules_button_post_text_activity" - android:layout_toEndOf="@id/subreddit_icon_gif_image_view_post_text_activity" + android:layout_toEndOf="@id/subreddit_icon_gif_image_view_search_activity" android:layout_centerVertical="true" android:layout_marginStart="32dp" android:layout_marginEnd="16dp" diff --git a/app/src/main/res/layout/activity_search.xml b/app/src/main/res/layout/activity_search.xml index f6ff281f..6f02ef7f 100644 --- a/app/src/main/res/layout/activity_search.xml +++ b/app/src/main/res/layout/activity_search.xml @@ -3,70 +3,87 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + tools:context=".SearchActivity"> <com.google.android.material.appbar.AppBarLayout - android:id="@+id/appbar_search_activity" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"> - <FrameLayout + <com.google.android.material.appbar.CollapsingToolbarLayout + android:id="@+id/collapsing_toolbar_layout_search_activity" android:layout_width="match_parent" - android:layout_height="wrap_content"> + android:layout_height="match_parent" + app:titleEnabled="false" + app:toolbarId="@+id/toolbar"> - <androidx.appcompat.widget.Toolbar - android:id="@+id/toolbar_search_activity" + <FrameLayout + android:id="@+id/toolbar_frame_layout_search_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" - android:background="?attr/colorPrimary" - app:popupTheme="@style/AppTheme.PopupOverlay" /> + android:layout_height="wrap_content"> - <com.ferfalk.simplesearchview.SimpleSearchView - android:id="@+id/search_view_search_activity" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:textColor="@android:color/white" - app:voiceSearch="true" - app:searchBackground="@color/colorPrimary" - app:cursorColor="@android:color/white" - app:hintColor="#E0E0E0" - app:iconsTint="@android:color/white" - app:backIconTint="@android:color/white" - app:iconsAlpha="1" - app:backIconAlpha="1" /> + <androidx.appcompat.widget.Toolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + app:navigationIcon="?attr/homeAsUpIndicator" + app:popupTheme="@style/AppTheme.PopupOverlay" /> - </FrameLayout> + <com.ferfalk.simplesearchview.SimpleSearchView + android:id="@+id/search_view_search_activity" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:textColor="@android:color/white" + app:backIconAlpha="1" + app:backIconTint="@android:color/white" + app:cursorColor="@android:color/white" + app:hintColor="#E0E0E0" + app:iconsAlpha="1" + app:iconsTint="@android:color/white" + app:searchBackground="@color/colorPrimary" + app:voiceSearch="true" /> - <com.google.android.material.tabs.TabLayout - android:id="@+id/tab_layout_search_activity" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="@color/colorPrimary" - app:tabGravity="fill" - app:tabMode="fixed" - app:tabIndicatorColor="@android:color/white" - app:tabIndicatorHeight="3dp" - app:tabSelectedTextColor="@android:color/white" - app:tabTextColor="@android:color/white" - app:tabRippleColor="?attr/colorControlHighlight" - app:tabUnboundedRipple="false"/> + </FrameLayout> + + </com.google.android.material.appbar.CollapsingToolbarLayout> </com.google.android.material.appbar.AppBarLayout> - <View - android:id="@+id/transparent_overlay_search_activity" + <androidx.core.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="match_parent" - android:background="#40000000" - android:elevation="1dp" - android:visibility="gone"/> + app:layout_behavior="@string/appbar_scrolling_view_behavior"> - <androidx.viewpager.widget.ViewPager - android:id="@+id/view_pager_search_activity" - android:layout_width="match_parent" - android:layout_height="match_parent" - app:layout_behavior="@string/appbar_scrolling_view_behavior" - tools:context=".SearchActivity" /> + <RelativeLayout + android:id="@+id/subreddit_name_relative_layout_search_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="16dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground"> + + <TextView + android:id="@+id/search_in_text_view_search_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/search_in" + android:textColor="@color/colorAccent" /> + + <TextView + android:id="@+id/subreddit_name_text_view_search_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerVertical="true" + android:layout_marginStart="32dp" + android:layout_marginEnd="16dp" + android:layout_toEndOf="@id/search_in_text_view_search_activity" + android:text="@string/all_subreddits" + android:textColor="@color/primaryTextColor" /> + + </RelativeLayout> + + </androidx.core.widget.NestedScrollView> </androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_search_result.xml b/app/src/main/res/layout/activity_search_result.xml new file mode 100644 index 00000000..062ca4a0 --- /dev/null +++ b/app/src/main/res/layout/activity_search_result.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <com.google.android.material.appbar.AppBarLayout + android:id="@+id/appbar_search_result_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:theme="@style/AppTheme.AppBarOverlay"> + + <FrameLayout + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <androidx.appcompat.widget.Toolbar + android:id="@+id/toolbar_search_result_activity" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + android:background="?attr/colorPrimary" + app:popupTheme="@style/AppTheme.PopupOverlay" /> + + <com.ferfalk.simplesearchview.SimpleSearchView + android:id="@+id/search_view_search_result_activity" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:textColor="@android:color/white" + app:voiceSearch="true" + app:searchBackground="@color/colorPrimary" + app:cursorColor="@android:color/white" + app:hintColor="#E0E0E0" + app:iconsTint="@android:color/white" + app:backIconTint="@android:color/white" + app:iconsAlpha="1" + app:backIconAlpha="1" /> + + </FrameLayout> + + <com.google.android.material.tabs.TabLayout + android:id="@+id/tab_layout_search_result_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@color/colorPrimary" + app:tabGravity="fill" + app:tabMode="fixed" + app:tabIndicatorColor="@android:color/white" + app:tabIndicatorHeight="3dp" + app:tabSelectedTextColor="@android:color/white" + app:tabTextColor="@android:color/white" + app:tabRippleColor="?attr/colorControlHighlight" + app:tabUnboundedRipple="false"/> + + </com.google.android.material.appbar.AppBarLayout> + + <View + android:id="@+id/transparent_overlay_search_result_activity" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="#40000000" + android:elevation="1dp" + android:visibility="gone"/> + + <androidx.viewpager.widget.ViewPager + android:id="@+id/view_pager_search_result_activity" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:layout_behavior="@string/appbar_scrolling_view_behavior" + tools:context=".SearchResultActivity" /> + +</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/menu/menu_search.xml b/app/src/main/res/menu/menu_search.xml index afd34627..f0cff4fd 100644 --- a/app/src/main/res/menu/menu_search.xml +++ b/app/src/main/res/menu/menu_search.xml @@ -1,10 +1,11 @@ <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" - tools:context="ml.docilealligator.infinityforreddit.SearchActivity"> + tools:context="ml.docilealligator.infinityforreddit.SearchResultActivity"> <item android:id="@+id/action_search_search_activity" android:orderInCategory="1" android:title="@string/action_search" - app:showAsAction="always" /> + android:icon="@drawable/ic_search_white_24dp" + app:showAsAction="ifRoom" /> </menu> diff --git a/app/src/main/res/menu/search_activity.xml b/app/src/main/res/menu/search_activity.xml new file mode 100644 index 00000000..c4820b38 --- /dev/null +++ b/app/src/main/res/menu/search_activity.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + tools:context="ml.docilealligator.infinityforreddit.SearchResultActivity"> + <item + android:id="@+id/action_search_search_activity" + android:orderInCategory="1" + android:title="@string/action_search" + android:icon="@drawable/ic_search_white_24dp" + app:showAsAction="ifRoom" /> +</menu> diff --git a/app/src/main/res/menu/search_result_activity.xml b/app/src/main/res/menu/search_result_activity.xml new file mode 100644 index 00000000..1fe4fd88 --- /dev/null +++ b/app/src/main/res/menu/search_result_activity.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + <item + android:id="@+id/action_search_search_result_activity" + android:orderInCategory="1" + android:title="@string/action_search" + android:icon="@drawable/ic_search_white_24dp" + app:showAsAction="ifRoom" /> + + <item + android:id="@+id/action_refresh_search_result_activity" + android:orderInCategory="2" + android:title="@string/action_refresh" + app:showAsAction="never" /> +</menu>
\ No newline at end of file diff --git a/app/src/main/res/menu/view_subreddit_detail_activity.xml b/app/src/main/res/menu/view_subreddit_detail_activity.xml index ede3e6b9..41e83e7d 100644 --- a/app/src/main/res/menu/view_subreddit_detail_activity.xml +++ b/app/src/main/res/menu/view_subreddit_detail_activity.xml @@ -4,15 +4,21 @@ xmlns:tools="http://schemas.android.com/tools" tools:context="ml.docilealligator.infinityforreddit.ViewSubredditDetailActivity"> <item - android:id="@+id/action_refresh_view_subreddit_detail_activity" + android:id="@+id/action_search_view_subreddit_detail_activity" android:orderInCategory="1" + android:title="@string/action_search" + android:icon="@drawable/ic_search_white_24dp" + app:showAsAction="ifRoom" /> + <item + android:id="@+id/action_refresh_view_subreddit_detail_activity" + android:orderInCategory="2" android:title="@string/action_refresh" android:icon="@drawable/ic_refresh_white_24dp" app:showAsAction="never" /> <item android:id="@+id/action_lazy_mode_view_subreddit_detail_activity" - android:orderInCategory="2" + android:orderInCategory="3" android:title="@string/action_start_lazy_mode" app:showAsAction="never" /> </menu>
\ No newline at end of file diff --git a/app/src/main/res/menu/view_user_detail_activity.xml b/app/src/main/res/menu/view_user_detail_activity.xml index 6f550333..58e469e9 100644 --- a/app/src/main/res/menu/view_user_detail_activity.xml +++ b/app/src/main/res/menu/view_user_detail_activity.xml @@ -3,15 +3,21 @@ xmlns:tools="http://schemas.android.com/tools" tools:context="ml.docilealligator.infinityforreddit.ViewUserDetailActivity"> <item - android:id="@+id/action_refresh_view_user_detail_activity" + android:id="@+id/action_search_view_user_detail_activity" android:orderInCategory="1" + android:title="@string/action_search" + android:icon="@drawable/ic_search_white_24dp" + app:showAsAction="ifRoom" /> + <item + android:id="@+id/action_refresh_view_user_detail_activity" + android:orderInCategory="2" android:title="@string/action_refresh" android:icon="@drawable/ic_refresh_white_24dp" app:showAsAction="never" /> <item android:id="@+id/action_lazy_mode_view_user_detail_activity" - android:orderInCategory="2" + android:orderInCategory="3" android:title="@string/action_start_lazy_mode" app:showAsAction="never" /> </menu> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 005aa048..ba9c2924 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -128,4 +128,7 @@ <string name="no_rule">No rule</string> <string name="error_loading_rules">Error loading rules.\nTap to retry.</string> + + <string name="search_in">Search in</string> + <string name="all_subreddits">All subreddits</string> </resources> |