mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-10-05 21:39:50 +02:00
Add a search view in MainActivity and add a SearchActivity.
This commit is contained in:
5
app/src/main/res/drawable/ic_search_white_24dp.xml
Normal file
5
app/src/main/res/drawable/ic_search_white_24dp.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
|
||||
</vector>
|
43
app/src/main/res/layout/activity_search.xml
Normal file
43
app/src/main/res/layout/activity_search.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?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_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar_search_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||
|
||||
<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"/>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/view_pager_search_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".SearchActivity" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@@ -11,15 +11,37 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
<FrameLayout
|
||||
android:id="@+id/toolbar_frame_layout_main_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">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
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_main_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:textColor="@android:color/white"
|
||||
app:voiceSearch="true"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/transparent_overlay_main_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#40000000"
|
||||
android:elevation="1dp"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<include layout="@layout/content_main" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
@@ -5,8 +5,15 @@
|
||||
tools:context="ml.docilealligator.infinityforreddit.MainActivity">
|
||||
<item
|
||||
android:id="@+id/action_refresh_main_activity"
|
||||
android:orderInCategory="1"
|
||||
android:orderInCategory="2"
|
||||
android:title="@string/action_refresh"
|
||||
android:icon="@drawable/ic_refresh_white_24dp"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_search_main_activity"
|
||||
android:orderInCategory="1"
|
||||
android:title="@string/action_search"
|
||||
android:icon="@drawable/ic_search_white_24dp"
|
||||
app:showAsAction="always" />
|
||||
</menu>
|
10
app/src/main/res/menu/menu_search.xml
Normal file
10
app/src/main/res/menu/menu_search.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<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">
|
||||
<item
|
||||
android:id="@+id/action_search_search_activity"
|
||||
android:orderInCategory="1"
|
||||
android:title="@string/action_search"
|
||||
app:showAsAction="always" />
|
||||
</menu>
|
@@ -1,6 +1,7 @@
|
||||
<resources>
|
||||
<string name="app_name">Infinity</string>
|
||||
<string name="login_activity_label">Login</string>
|
||||
<string name="search_activity_label">Search</string>
|
||||
|
||||
<string name="navigation_drawer_open">Open navigation drawer</string>
|
||||
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||
@@ -8,6 +9,7 @@
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="action_download">Download</string>
|
||||
<string name="action_refresh">Refresh</string>
|
||||
<string name="action_search">Search</string>
|
||||
|
||||
<string name="tap_to_retry">Error loading image. Tap to retry.</string>
|
||||
<string name="load_posts_error">Error loading posts.\nTap to retry.</string>
|
||||
@@ -51,4 +53,12 @@
|
||||
<string name="content_description_banner_imageview">Subreddit Banner Image</string>
|
||||
|
||||
<string name="error_loading_posts">Error loading post</string>
|
||||
|
||||
<string name="app_label">Infinity</string>
|
||||
<string name="search_hint">Search anything</string>
|
||||
<string name="title_activity_search">Search</string>
|
||||
<string name="section_format">Hello World from section: %1$d</string>
|
||||
<string name="tab_text_1">Tab 1</string>
|
||||
<string name="tab_text_2">Tab 2</string>
|
||||
<string name="tab_text_3">Tab 3</string>
|
||||
</resources>
|
||||
|
@@ -13,10 +13,13 @@
|
||||
<style name="AppTheme.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBarWithTransparentStatusBar" parent="AppTheme.NoActionBar">
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBarWithTranslucentStatusBar" parent="AppTheme.NoActionBar">
|
||||
<style name="AppTheme.NoActionBarWithTranslucentWindow" parent="AppTheme.NoActionBarWithTransparentStatusBar">
|
||||
<item name="android:windowTranslucentStatus">true</item>
|
||||
</style>
|
||||
|
||||
@@ -37,4 +40,11 @@
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
</style>
|
||||
|
||||
<style name="CustomTabLayout" parent="Widget.Design.TabLayout">
|
||||
<item name="tabIndicatorColor">@android:color/white</item>
|
||||
<item name="tabIndicatorHeight">3dp</item>
|
||||
<item name="tabBackground">?attr/selectableItemBackground</item>
|
||||
<item name="tabSelectedTextColor">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
6
app/src/main/res/xml/searchable.xml
Normal file
6
app/src/main/res/xml/searchable.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:label="@string/app_label"
|
||||
android:hint="@string/search_hint"
|
||||
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer" >
|
||||
</searchable>
|
Reference in New Issue
Block a user