2018-04-20 17:27:31 +02:00
|
|
|
package info.nightscout.androidaps.startupwizard;
|
|
|
|
|
2018-04-25 14:29:20 +02:00
|
|
|
import android.content.Context;
|
|
|
|
import android.text.InputType;
|
|
|
|
import android.view.View;
|
|
|
|
import android.widget.EditText;
|
|
|
|
import android.widget.LinearLayout;
|
|
|
|
|
2018-04-27 12:30:45 +02:00
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
2018-04-25 14:29:20 +02:00
|
|
|
import java.util.List;
|
|
|
|
|
2018-04-20 17:27:31 +02:00
|
|
|
public class SWUrl extends SWItem {
|
2018-04-27 12:30:45 +02:00
|
|
|
private static Logger log = LoggerFactory.getLogger(SWUrl.class);
|
2018-04-25 14:29:20 +02:00
|
|
|
private List<String> labels;
|
|
|
|
private List<String> values;
|
|
|
|
private String groupName;
|
2018-04-20 17:27:31 +02:00
|
|
|
public SWUrl() {
|
|
|
|
super(Type.URL);
|
|
|
|
}
|
2018-04-25 14:29:20 +02:00
|
|
|
|
|
|
|
public void setOptions(List<String> labels, List<String> values){
|
2018-04-27 12:30:45 +02:00
|
|
|
// log.debug("Setting options - labels "+labels.size()+" values - "+values.size());
|
2018-04-25 14:29:20 +02:00
|
|
|
this.labels = labels;
|
|
|
|
this.values = values;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setName(String name){
|
|
|
|
this.groupName = name;
|
|
|
|
}
|
|
|
|
|
2018-04-25 15:45:15 +02:00
|
|
|
@Override
|
2018-04-27 12:30:45 +02:00
|
|
|
public void generateDialog(View view, LinearLayout layout) {
|
2018-04-25 14:29:20 +02:00
|
|
|
Context context = view.getContext();
|
2018-04-27 12:30:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
if(values.get(values.size()-1) != "" && values.get(values.size()-1) != null) {
|
|
|
|
EditText editText = new EditText(context);
|
|
|
|
editText.setId(1);
|
|
|
|
// get the last value in list
|
|
|
|
editText.setText(values.get(values.size()-1));
|
|
|
|
editText.setInputType(InputType.TYPE_CLASS_TEXT);
|
|
|
|
editText.setMaxLines(1);
|
|
|
|
layout.addView(editText);
|
2018-04-25 14:29:20 +02:00
|
|
|
}
|
|
|
|
}
|
2018-04-26 14:18:01 +02:00
|
|
|
|
|
|
|
|
2018-04-20 17:27:31 +02:00
|
|
|
}
|