Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

nearby: show placeholder in Nearby SearchView (Fixes #6482) #6523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
XinyuYangYXY wants to merge 1 commit into commons-app:main
base: main
Choose a base branch
Loading
from XinyuYangYXY:fix/nearby-search-placeholder-6482

Conversation

@XinyuYangYXY
Copy link
Contributor

@XinyuYangYXY XinyuYangYXY commented Oct 17, 2025

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

Copy link

✅ Generated APK variants!

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!

Copy link
Contributor Author

I understand. It's okay.

nicolas-raoul reacted with heart emoji

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

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

AltStyle によって変換されたページ (->オリジナル) /