aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/res
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-09-29 14:19:54 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-09-29 14:19:54 +0000
commit6e4519ef93f295178e0b850b739bd0085de6aa17 (patch)
tree882925d4680567193e06472e4c40e856f6c43acc /app/src/main/res
parent8dd4759035bae9cff7a0d8bd0af1d1624193c796 (diff)
downloadinfinity-for-reddit-6e4519ef93f295178e0b850b739bd0085de6aa17.tar
infinity-for-reddit-6e4519ef93f295178e0b850b739bd0085de6aa17.tar.gz
infinity-for-reddit-6e4519ef93f295178e0b850b739bd0085de6aa17.tar.bz2
infinity-for-reddit-6e4519ef93f295178e0b850b739bd0085de6aa17.tar.lz
infinity-for-reddit-6e4519ef93f295178e0b850b739bd0085de6aa17.tar.xz
infinity-for-reddit-6e4519ef93f295178e0b850b739bd0085de6aa17.tar.zst
infinity-for-reddit-6e4519ef93f295178e0b850b739bd0085de6aa17.zip
Display search history in SearchActivity. Save suggested sort type and nsfw info in database for SubredditData. Fix an issue in parsing posts.
Diffstat (limited to 'app/src/main/res')
-rw-r--r--app/src/main/res/drawable/ic_header_hashtag_black_24dp.xml9
-rw-r--r--app/src/main/res/drawable/ic_history_24dp.xml9
-rw-r--r--app/src/main/res/drawable/ic_title_24dp.xml9
-rw-r--r--app/src/main/res/layout/activity_search.xml74
-rw-r--r--app/src/main/res/layout/item_recent_search_query.xml19
-rw-r--r--app/src/main/res/values/strings.xml2
6 files changed, 89 insertions, 33 deletions
diff --git a/app/src/main/res/drawable/ic_header_hashtag_black_24dp.xml b/app/src/main/res/drawable/ic_header_hashtag_black_24dp.xml
deleted file mode 100644
index 1cef8584..00000000
--- a/app/src/main/res/drawable/ic_header_hashtag_black_24dp.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="48"
- android:viewportHeight="48">
- <path
- android:pathData="M35.4182,18.3369c-0.2456,-0.3018 -0.6104,-0.4678 -1.0273,-0.4678H31.0766l0.9194,-4.4711c0.0864,-0.4199 -0.0063,-0.8359 -0.2549,-1.1406c-0.2461,-0.3008 -0.6108,-0.4668 -1.0278,-0.4668c-0.8237,0 -1.6011,0.6435 -1.77,1.4668l-0.2498,1.2147c-0.0082,0.0305 -0.0214,0.0594 -0.0277,0.0903l-0.6794,3.3066h-5.5789l0.9194,-4.4711c0.0864,-0.4199 -0.0063,-0.8359 -0.2549,-1.1406c-0.2461,-0.3008 -0.6108,-0.4668 -1.0278,-0.4668c-0.8237,0 -1.6011,0.6435 -1.77,1.4668l-0.2601,1.2647c-0.0032,0.0137 -0.0095,0.0266 -0.0124,0.0403l-0.6799,3.3066h-3.6087c-0.8237,0 -1.6016,0.6435 -1.7705,1.4658c-0.0864,0.4209 0.0068,0.8359 0.2554,1.1406c0.2461,0.3018 0.6108,0.4668 1.0273,0.4668h3.4649l-0.9841,4.7861h-3.6087c-0.8237,0 -1.6016,0.6435 -1.7705,1.4668c-0.0864,0.4189 0.0063,0.835 0.2544,1.1387c0.2461,0.3018 0.6113,0.4678 1.0283,0.4678h3.4649l-0.9244,4.4951c-0.0864,0.4199 0.0063,0.8359 0.2549,1.1406c0.2456,0.3008 0.6108,0.4668 1.0273,0.4668c0.8237,0 1.6016,-0.6435 1.7705,-1.4668l0.9533,-4.6357h5.5824l-0.9244,4.4951c-0.0864,0.4199 0.0063,0.8359 0.2549,1.1406c0.2461,0.3008 0.6108,0.4668 1.0278,0.4668c0.8237,0 1.6011,-0.6435 1.77,-1.4668l0.9533,-4.6357h3.4666c0.8237,0 1.6016,-0.6435 1.7705,-1.4658c0.0884,-0.4287 -0.001,-0.834 -0.2515,-1.1416c-0.2451,-0.3008 -0.6113,-0.4658 -1.0308,-0.4658h-3.3229l0.9837,-4.7861h3.4666c0.8237,0 1.6016,-0.6435 1.7705,-1.4668C35.7595,19.0566 35.6667,18.6406 35.4182,18.3369zM20.7882,25.7285l0.9837,-4.7861h5.5824l-0.9841,4.7861H20.7882z"
- android:fillColor="#303030"/>
-</vector>
diff --git a/app/src/main/res/drawable/ic_history_24dp.xml b/app/src/main/res/drawable/ic_history_24dp.xml
new file mode 100644
index 00000000..a3fbac1c
--- /dev/null
+++ b/app/src/main/res/drawable/ic_history_24dp.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"
+ android:fillColor="#000000"/>
+</vector>
diff --git a/app/src/main/res/drawable/ic_title_24dp.xml b/app/src/main/res/drawable/ic_title_24dp.xml
new file mode 100644
index 00000000..3e622fe7
--- /dev/null
+++ b/app/src/main/res/drawable/ic_title_24dp.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:pathData="M5,5.5C5,6.33 5.67,7 6.5,7h4v10.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5V7h4c0.83,0 1.5,-0.67 1.5,-1.5S18.33,4 17.5,4h-11C5.67,4 5,4.67 5,5.5z"
+ android:fillColor="#000000"/>
+</vector>
diff --git a/app/src/main/res/layout/activity_search.xml b/app/src/main/res/layout/activity_search.xml
index 0048e1fc..972ba2af 100644
--- a/app/src/main/res/layout/activity_search.xml
+++ b/app/src/main/res/layout/activity_search.xml
@@ -48,38 +48,64 @@
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
- <RelativeLayout
- android:id="@+id/subreddit_name_relative_layout_search_activity"
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="?attr/selectableItemBackground"
- android:clickable="true"
- android:focusable="true"
- android:padding="16dp">
+ android:orientation="vertical">
- <TextView
- android:id="@+id/search_in_text_view_search_activity"
- android:layout_width="wrap_content"
+ <RelativeLayout
+ android:id="@+id/subreddit_name_relative_layout_search_activity"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/search_in"
- android:textColor="?attr/colorAccent"
- android:textSize="?attr/font_default"
- android:fontFamily="?attr/font_family" />
+ android:background="?attr/selectableItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ android:padding="16dp">
+
+ <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="?attr/colorAccent"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family" />
+
+ <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="?attr/primaryTextColor"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family" />
+
+ </RelativeLayout>
+
+ <View
+ android:id="@+id/divider_search_activity"
+ android:layout_width="match_parent"
+ android:layout_height="1dp" />
<TextView
- android:id="@+id/subreddit_name_text_view_search_activity"
+ android:id="@+id/recent_summary_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="?attr/primaryTextColor"
- android:textSize="?attr/font_default"
- android:fontFamily="?attr/font_family" />
-
- </RelativeLayout>
+ android:padding="16dp"
+ android:text="@string/recent_searches"
+ android:fontFamily="?attr/font_family"
+ android:visibility="gone" />
+
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/recycler_view_search_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ </LinearLayout>
</androidx.core.widget.NestedScrollView>
diff --git a/app/src/main/res/layout/item_recent_search_query.xml b/app/src/main/res/layout/item_recent_search_query.xml
new file mode 100644
index 00000000..f014e2fe
--- /dev/null
+++ b/app/src/main/res/layout/item_recent_search_query.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ 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/recent_search_query_text_view_item_recent_search_query"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:fontFamily="?attr/font_family"
+ android:textSize="?attr/font_default"
+ android:drawablePadding="16dp" />
+
+</LinearLayout> \ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index bd3f0681..5b85708a 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -912,4 +912,6 @@
<string name="give_award_success">Award given</string>
<string name="give_award_failed">Failed</string>
+ <string name="recent_searches">Recent searches</string>
+
</resources>