Skip to content

Conversation

@XinyuYangYXY
Copy link
Contributor

Description (required)

Fixes #6482

What changes did you make and why?

Problem
On the Nearby screen, the placeholder from nearby_search_hint ("Bridge, museum, hotel") was not visible in the SearchView.

Approach

  • Runtime enforcement in NearbyParentFragment.initNearbyFilter()

    • Force-set queryHint = getString(R.string.nearby_search_hint).
    • Ensure the SearchView is de-iconified and unfocused so the hint can render (setIconifiedByDefault(false), clearFocus()).
    • Access the internal EditText (androidx.appcompat.R.id.search_src_text) and set the hint + hint text color as a fallback for OEM differences:
      • searchEditText.hint = getString(R.string.nearby_search_hint)
      • searchEditText.setHintTextColor(ContextCompat.getColor(requireContext(), R.color.white))
    • Wrapped with try/catch + Timber.e for graceful degradation if internals differ.
  • Layout

    • In filter_search_view_layout.xml: keep android:queryHint="@string/nearby_search_hint", android:iconifiedByDefault="false", app:theme="@style/WhiteSearchBarTheme", and search icon setup to improve consistency across devices.
    • In styles.xml: add WhiteSearchBarTheme (inherits DarkAppTheme) with white controls to guarantee hint contrast on dark backgrounds.
  • Repository hygiene

Result
The placeholder “Bridge, museum, hotel” reliably appears when the field is empty, improving first-use discoverability in Nearby.

Tests performed (required)

  • Build variant: debug-main (Commons app 6.0.2-debug-main~4ed9ad508)
  • Device/Android: Android 15 (API 35) Emulator (Medium Phone)

Manual scenarios

  1. Open Nearby : empty field shows the placeholder.

Screenshots (for UI changes only)

  • Before: empty field with no placeholder
c8e5e7e9877907f3001b4ab975533fa3
  • After: empty field showing “Bridge, museum, hotel”
ea92e2d5b87dff52562090a5dd2d68a3

@github-actions
Copy link

✅ Generated APK variants!

@nicolas-raoul
Copy link
Member

Thanks a lot, your screenshot is very informative to get an idea of how it would look.

I can't help but think that the UI is more confusing with that string in that state. Especially on small screen, it would not be obvious whether Bridge and Museum are selected.

In view of that, and given the facts that it is not a real search bar, I would personally say that the UI is better without showing the "Bridge, museum, hotel, etc.".

What do you think?
If you agree, would you mind simply removing the string from app/src/main/res/values/strings.xml ?
I apologize for reverting my answer after I gave an answer at your confirmation question at #6482 (comment) , I know you put a lot of effort into this pull request, but seeing it live, I can't help but think that it would be more confusing than helpful.

Thanks a lot!

@XinyuYangYXY
Copy link
Contributor Author

I understand. It's okay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: the string "Bridge, museum, hotel" is not visible

2 participants