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;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
2018-04-20 17:27:31 +02:00
|
|
|
public class SWUrl extends SWItem {
|
|
|
|
|
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){
|
|
|
|
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-25 14:34:07 +02:00
|
|
|
public void generateDialog(View view) {
|
2018-04-25 14:29:20 +02:00
|
|
|
Context context = view.getContext();
|
|
|
|
LinearLayout layout = (LinearLayout) view.findViewById(view.getId());
|
|
|
|
layout.removeAllViews();
|
|
|
|
|
|
|
|
for (int row = 0; row < 1; row++) {
|
|
|
|
for (int i = 0; i < labels.size(); i++) {
|
|
|
|
if(values.get(i) != "" && values.get(i) != null) {
|
|
|
|
EditText editText = new EditText(context);
|
|
|
|
editText.setId((row * 2) + i);
|
|
|
|
editText.setText(values.get(i));
|
|
|
|
editText.setInputType(InputType.TYPE_CLASS_TEXT);
|
|
|
|
editText.setMaxLines(1);
|
|
|
|
layout.addView(editText);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-04-26 14:18:01 +02:00
|
|
|
|
|
|
|
|
2018-04-20 17:27:31 +02:00
|
|
|
}
|