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/layout | |
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 'app/src/main/res/layout')
-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 |
3 files changed, 139 insertions, 50 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 |