/* * Copyright 2010-2018 Eric Kok et al. * * Transdroid is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Transdroid is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Transdroid. If not, see . */ package org.transdroid.core.gui.navigation; import android.content.Context; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.EditText; import android.widget.ListView; import com.afollestad.materialdialogs.MaterialDialog; import com.nispok.snackbar.Snackbar; import com.nispok.snackbar.SnackbarManager; import org.transdroid.R; import org.transdroid.core.app.settings.SettingsUtils; import java.util.Iterator; import java.util.List; public class SetLabelDialog { /** * A dialog fragment that allows picking a label or entering a new label to set this new label to the torrent. * * @param context The activity context that opens (and owns) this dialog * @param onLabelPickedListener The callback when a new label has been entered or picked by the user * @param currentLabels The list of labels as currently exist on the server, to present as list for easy selection */ public static void show(final Context context, final OnLabelPickedListener onLabelPickedListener, List