fix(edit-timelines/hashtags): set tags as list (#596)

* fix(edit-timelines/hashtags): set tags as list

Fixes https://github.com/sk22/megalodon/issues/595, by setting the tags a tags and not as a list.

* refactor(edit-timelines/hashtags): set all tag terminator at once

* feat(edit-timelines/hashtags): add comment
This commit is contained in:
FineFindus
2023-06-21 22:34:22 +02:00
committed by GitHub
parent a70d39065c
commit 06543d5fc2

View File

@@ -236,16 +236,21 @@ public class EditTimelinesFragment extends RecyclerFragment<TimelineDefinition>
private boolean setTagListContent(NachoTextView editText, @Nullable List<String> tags) { private boolean setTagListContent(NachoTextView editText, @Nullable List<String> tags) {
if (tags == null || tags.isEmpty()) return false; if (tags == null || tags.isEmpty()) return false;
editText.setText(String.join(",", tags)); editText.setText(tags);
editText.chipifyAllUnterminatedTokens(); editText.chipifyAllUnterminatedTokens();
return true; return true;
} }
private NachoTextView prepareChipTextView(NachoTextView nacho) { private NachoTextView prepareChipTextView(NachoTextView nacho) {
nacho.addChipTerminator(',', BEHAVIOR_CHIPIFY_ALL); //Ill Be Back
nacho.addChipTerminator('\n', BEHAVIOR_CHIPIFY_ALL); nacho.setChipTerminators(
nacho.addChipTerminator(' ', BEHAVIOR_CHIPIFY_ALL); Map.of(
nacho.addChipTerminator(';', BEHAVIOR_CHIPIFY_ALL); ',', BEHAVIOR_CHIPIFY_ALL,
'\n', BEHAVIOR_CHIPIFY_ALL,
' ', BEHAVIOR_CHIPIFY_ALL,
';', BEHAVIOR_CHIPIFY_ALL
)
);
nacho.enableEditChipOnTouch(true, true); nacho.enableEditChipOnTouch(true, true);
nacho.setOnFocusChangeListener((v, hasFocus) -> nacho.chipifyAllUnterminatedTokens()); nacho.setOnFocusChangeListener((v, hasFocus) -> nacho.chipifyAllUnterminatedTokens());
return nacho; return nacho;