Skip to content

Commit

Permalink
Highlight search suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiGr committed Jul 7, 2020
1 parent 13a0d1d commit b96d171
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.Editable;
import android.text.Html;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
Expand Down Expand Up @@ -71,6 +72,7 @@
import io.reactivex.schedulers.Schedulers;
import io.reactivex.subjects.PublishSubject;

import static android.text.Html.escapeHtml;
import static androidx.recyclerview.widget.ItemTouchHelper.Callback.makeMovementFlags;
import static java.util.Arrays.asList;
import static org.schabi.newpipe.util.AnimationUtils.animateView;
Expand Down Expand Up @@ -1003,7 +1005,11 @@ private void handleSearchSuggestion() {
? R.string.search_showing_result_for
: R.string.did_you_mean);

correctSuggestion.setText(String.format(helperText, searchSuggestion));
final String highlightedSearchSuggestion =
"<b><i>" + escapeHtml(searchSuggestion) + "</i></b>";
correctSuggestion.setText(
Html.fromHtml(String.format(helperText, highlightedSearchSuggestion)));


correctSuggestion.setOnClickListener(v -> {
correctSuggestion.setVisibility(View.GONE);
Expand Down

0 comments on commit b96d171

Please sign in to comment.