From eda413326173a04059692692d9bd3da83d80c899 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Mon, 27 Jun 2022 18:46:44 +0200 Subject: [PATCH] suggestions UI improvements --- .../adapters/SearchHistoryAdapter.kt | 4 +-- .../main/res/drawable/ic_arrow_up_left.xml | 11 ++++++ app/src/main/res/layout/fragment_search.xml | 2 +- app/src/main/res/layout/searchhistory_row.xml | 10 +++--- .../main/res/layout/searchsuggestion_row.xml | 36 +++++++++++++------ 5 files changed, 43 insertions(+), 20 deletions(-) create mode 100644 app/src/main/res/drawable/ic_arrow_up_left.xml diff --git a/app/src/main/java/com/github/libretube/adapters/SearchHistoryAdapter.kt b/app/src/main/java/com/github/libretube/adapters/SearchHistoryAdapter.kt index baeea812d..a25359f30 100644 --- a/app/src/main/java/com/github/libretube/adapters/SearchHistoryAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/SearchHistoryAdapter.kt @@ -5,12 +5,12 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.EditText +import android.widget.ImageView import android.widget.TextView import androidx.recyclerview.widget.RecyclerView import com.github.libretube.R import com.github.libretube.fragments.SearchFragment import com.github.libretube.util.PreferenceHelper -import com.google.android.material.imageview.ShapeableImageView class SearchHistoryAdapter( private val context: Context, @@ -34,7 +34,7 @@ class SearchHistoryAdapter( val history = historyList[position] holder.v.findViewById(R.id.history_text).text = history - holder.v.findViewById(R.id.delete_history).setOnClickListener { + holder.v.findViewById(R.id.delete_history).setOnClickListener { historyList = historyList - history PreferenceHelper.saveHistory(context, historyList) notifyDataSetChanged() diff --git a/app/src/main/res/drawable/ic_arrow_up_left.xml b/app/src/main/res/drawable/ic_arrow_up_left.xml new file mode 100644 index 000000000..e5ed20662 --- /dev/null +++ b/app/src/main/res/drawable/ic_arrow_up_left.xml @@ -0,0 +1,11 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_search.xml b/app/src/main/res/layout/fragment_search.xml index cf46d6d0b..bd8242fdd 100644 --- a/app/src/main/res/layout/fragment_search.xml +++ b/app/src/main/res/layout/fragment_search.xml @@ -329,7 +329,7 @@ android:id="@+id/history_recycler" android:layout_width="0dp" android:layout_height="0dp" - android:layout_margin="10dp" + android:layout_marginVertical="10dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/layout/searchhistory_row.xml b/app/src/main/res/layout/searchhistory_row.xml index 11bcf477e..f35fd9070 100644 --- a/app/src/main/res/layout/searchhistory_row.xml +++ b/app/src/main/res/layout/searchhistory_row.xml @@ -3,8 +3,8 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_margin="8dp" - android:layout_marginBottom="16dp" + android:paddingHorizontal="16dp" + android:paddingVertical="8dp" android:background="?android:attr/selectableItemBackground"> - - - + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent" + android:layout_margin="5dp" /> + android:layout_marginHorizontal="8dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@id/arrow" + app:layout_constraintStart_toEndOf="@id/search_icon" + app:layout_constraintTop_toTopOf="parent" /> - \ No newline at end of file + + \ No newline at end of file