Skip to content

Commit

Permalink
Fix subreddit autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumBadger committed Apr 8, 2020
1 parent 3bea09f commit 32bff3d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.quantumbadger.redreader.common.General;
import org.quantumbadger.redreader.common.LinkHandler;
import org.quantumbadger.redreader.common.PrefsUtility;
import org.quantumbadger.redreader.common.collections.CollectionStream;
import org.quantumbadger.redreader.fragments.AccountListDialog;
import org.quantumbadger.redreader.fragments.ChangelogDialog;
import org.quantumbadger.redreader.fragments.CommentListingFragment;
Expand Down Expand Up @@ -482,10 +483,12 @@ public void onSelected(final @MainMenuFragment.MainMenuAction int type) {
final ArrayList<SubredditCanonicalId> subredditHistory = RedditSubredditHistory.getSubredditsSorted(
RedditAccountManager.getInstance(this).getDefaultAccount());

final ArrayAdapter<SubredditCanonicalId> autocompleteAdapter = new ArrayAdapter<>(
final ArrayAdapter<String> autocompleteAdapter = new ArrayAdapter<>(
this,
android.R.layout.simple_dropdown_item_1line,
subredditHistory.toArray(new SubredditCanonicalId[0]));
new CollectionStream<>(subredditHistory)
.map(SubredditCanonicalId::getDisplayNameLowercase)
.collect(new ArrayList<>()));

editText.setAdapter(autocompleteAdapter);
editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public class RedditSubredditHistory {

private static final HashMap<RedditAccount, HashSet<SubredditCanonicalId>> SUBREDDITS = new HashMap<>();

private static HashSet<SubredditCanonicalId> getForAccount(
final RedditAccount account) {
private static HashSet<SubredditCanonicalId> getForAccount(final RedditAccount account) {

HashSet<SubredditCanonicalId> result = SUBREDDITS.get(account);

Expand Down

0 comments on commit 32bff3d

Please sign in to comment.