use of com.ichi2.anki.dialogs.tags.TagsDialog in project AnkiChinaAndroid by ankichinateam.
the class SelfStudyActivity method showTagsDialog.
private void showTagsDialog(TextView tag_selected) {
TagsDialog dialog = TagsDialog.newInstance(TagsDialog.TYPE_FILTER_BY_TAG, new ArrayList<>(), new ArrayList<>(getCol().getTags().all()));
dialog.setTagsDialogListener((selectedTags, option) -> filterByTag(selectedTags, option, tag_selected));
showDialogFragment(dialog);
}
use of com.ichi2.anki.dialogs.tags.TagsDialog in project AnkiChinaAndroid by ankichinateam.
the class CustomStudyDialog method buildContextMenu.
/**
* Build a context menu for custom study
*
* @param id
* @return
*/
private MaterialDialog buildContextMenu(int id) {
int[] listIds = getListIds(id);
final boolean jumpToReviewer = getArguments().getBoolean("jumpToReviewer");
return new MaterialDialog.Builder(this.getActivity()).title(R.string.custom_study).cancelable(true).itemsIds(listIds).items(ContextMenuHelper.getValuesFromKeys(getKeyValueMap(), listIds)).itemsCallback(new MaterialDialog.ListCallback() {
@Override
public void onSelection(MaterialDialog materialDialog, View view, int which, CharSequence charSequence) {
AnkiActivity activity = getAnkiActivity();
switch(view.getId()) {
case DECK_OPTIONS:
{
// User asked to permanently change the deck options
Intent i = new Intent(activity, DeckOptions.class);
i.putExtra("did", getArguments().getLong("did"));
getActivity().startActivity(i);
break;
}
case MORE_OPTIONS:
{
// User asked to see all custom study options
CustomStudyDialog d = CustomStudyDialog.newInstance(CONTEXT_MENU_STANDARD, getArguments().getLong("did"), jumpToReviewer, listener);
activity.showDialogFragment(d);
break;
}
case CUSTOM_STUDY_TAGS:
{
/*
* This is a special Dialog for CUSTOM STUDY, where instead of only collecting a
* number, it is necessary to collect a list of tags. This case handles the creation
* of that Dialog.
*/
long currentDeck = getArguments().getLong("did");
TagsDialog dialogFragment = TagsDialog.newInstance(TagsDialog.TYPE_CUSTOM_STUDY_TAGS, new ArrayList<String>(), new ArrayList<>(activity.getCol().getTags().byDeck(currentDeck, true)));
dialogFragment.setTagsDialogListener(CustomStudyDialog.this::customStudyFromTags);
activity.showDialogFragment(dialogFragment);
break;
}
default:
{
// User asked for a standard custom study option
CustomStudyDialog d = CustomStudyDialog.newInstance(view.getId(), getArguments().getLong("did"), jumpToReviewer, listener);
getAnkiActivity().showDialogFragment(d);
}
}
}
}).build();
}
use of com.ichi2.anki.dialogs.tags.TagsDialog in project Anki-Android by ankidroid.
the class NoteEditor method showTagsDialog.
private void showTagsDialog() {
if (mSelectedTags == null) {
mSelectedTags = new ArrayList<>(0);
}
ArrayList<String> tags = new ArrayList<>(getCol().getTags().all());
ArrayList<String> selTags = new ArrayList<>(mSelectedTags);
TagsDialog dialog = mTagsDialogFactory.newTagsDialog().withArguments(TagsDialog.DialogType.EDIT_TAGS, selTags, tags);
showDialogFragment(dialog);
}
use of com.ichi2.anki.dialogs.tags.TagsDialog in project Anki-Android by ankidroid.
the class AbstractFlashcardViewer method showTagsDialog.
protected void showTagsDialog() {
ArrayList<String> tags = new ArrayList<>(getCol().getTags().all());
ArrayList<String> selTags = new ArrayList<>(mCurrentCard.note().getTags());
TagsDialog dialog = mTagsDialogFactory.newTagsDialog().withArguments(TagsDialog.DialogType.EDIT_TAGS, selTags, tags);
showDialogFragment(dialog);
}
Aggregations