From f95af8e7229e879eb477a577fa782de949143f09 Mon Sep 17 00:00:00 2001 From: Damontecres <154766448+damontecres@users.noreply.github.com> Date: Thu, 22 Feb 2024 20:15:37 -0500 Subject: [PATCH] Update popup style --- .../damontecres/stashapp/MainFragment.kt | 2 -- .../presenters/PopupOnLongClickListener.kt | 26 ++++--------------- .../res/color/popup_background_selector.xml | 4 +++ app/src/main/res/layout/popup_item.xml | 10 +++++++ app/src/main/res/values/colors.xml | 3 ++- 5 files changed, 21 insertions(+), 24 deletions(-) create mode 100644 app/src/main/res/color/popup_background_selector.xml create mode 100644 app/src/main/res/layout/popup_item.xml diff --git a/app/src/main/java/com/github/damontecres/stashapp/MainFragment.kt b/app/src/main/java/com/github/damontecres/stashapp/MainFragment.kt index 527be93c..e6d54111 100644 --- a/app/src/main/java/com/github/damontecres/stashapp/MainFragment.kt +++ b/app/src/main/java/com/github/damontecres/stashapp/MainFragment.kt @@ -158,8 +158,6 @@ class MainFragment : BrowseSupportFragment() { // set fastLane (or headers) background color brandColor = ContextCompat.getColor(requireActivity(), R.color.fastlane_background) - // set search icon color - searchAffordanceColor = ContextCompat.getColor(requireActivity(), R.color.search_opaque) } private fun setupEventListeners() { diff --git a/app/src/main/java/com/github/damontecres/stashapp/presenters/PopupOnLongClickListener.kt b/app/src/main/java/com/github/damontecres/stashapp/presenters/PopupOnLongClickListener.kt index b1ac70ad..d8f7d4f2 100644 --- a/app/src/main/java/com/github/damontecres/stashapp/presenters/PopupOnLongClickListener.kt +++ b/app/src/main/java/com/github/damontecres/stashapp/presenters/PopupOnLongClickListener.kt @@ -2,11 +2,10 @@ package com.github.damontecres.stashapp.presenters import android.view.View import android.view.View.OnLongClickListener -import android.view.ViewGroup import android.widget.AdapterView import android.widget.ArrayAdapter import androidx.appcompat.widget.ListPopupWindow -import com.github.damontecres.stashapp.StashOnFocusChangeListener +import com.github.damontecres.stashapp.R /** * An OnLongClickListener which shows a popup of predefined options @@ -24,30 +23,15 @@ class PopupOnLongClickListener( ) listPopUp.inputMethodMode = ListPopupWindow.INPUT_METHOD_NEEDED listPopUp.anchorView = view - // listPopUp.width = ViewGroup.LayoutParams.MATCH_PARENT - // TODO: Better width calculation - listPopUp.width = 200 + listPopUp.width = ListPopupWindow.WRAP_CONTENT listPopUp.isModal = true - val focusChangeListener = StashOnFocusChangeListener(view.context) - val adapter = - object : ArrayAdapter( + ArrayAdapter( view.context, - android.R.layout.simple_list_item_1, + R.layout.popup_item, popupOptions, - ) { - override fun getView( - position: Int, - convertView: View?, - parent: ViewGroup, - ): View { - val itemView = super.getView(position, convertView, parent) - // TODO: this doesn't seem to work? - itemView.onFocusChangeListener = focusChangeListener - return itemView - } - } + ) listPopUp.setAdapter(adapter) listPopUp.setOnItemClickListener { parent: AdapterView<*>, v: View, position: Int, id: Long -> diff --git a/app/src/main/res/color/popup_background_selector.xml b/app/src/main/res/color/popup_background_selector.xml new file mode 100644 index 00000000..b620e14a --- /dev/null +++ b/app/src/main/res/color/popup_background_selector.xml @@ -0,0 +1,4 @@ + + + + diff --git a/app/src/main/res/layout/popup_item.xml b/app/src/main/res/layout/popup_item.xml new file mode 100644 index 00000000..83fa19f6 --- /dev/null +++ b/app/src/main/res/layout/popup_item.xml @@ -0,0 +1,10 @@ + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 9fcc07cf..e27c2826 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -2,9 +2,10 @@ #000000 #DDDDDD #0096a6 - #477ab5 #4785b5 #202b33 #30404d #FFD700 + #3c719a + #111a20