Added warning icon
Some more work on settings Configuration dialog finished
This commit is contained in:
parent
1aec61f810
commit
ba153f5708
17 changed files with 187 additions and 77 deletions
|
|
@ -5,7 +5,6 @@ import android.os.Bundle;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
|
@ -19,7 +18,7 @@ import java.util.ArrayList;
|
|||
/**
|
||||
* This fragment will show a read only list of defined UeBehaviours
|
||||
*/
|
||||
public class BehaviourListFragment extends Fragment implements AbsListView.OnItemClickListener {
|
||||
public class BehaviourListFragment extends Fragment {
|
||||
|
||||
/**
|
||||
* The fragment's ListView/GridView.
|
||||
|
|
@ -67,9 +66,6 @@ public class BehaviourListFragment extends Fragment implements AbsListView.OnIte
|
|||
listView = (AdapterView) view.findViewById(android.R.id.list);
|
||||
listView.setAdapter(adapter);
|
||||
|
||||
// Set OnItemClickListener so we can be notified on item clicks
|
||||
//listView.setOnItemClickListener(this);
|
||||
|
||||
setEmptyText("No Behaviours Defined");
|
||||
|
||||
return view;
|
||||
|
|
@ -83,11 +79,6 @@ public class BehaviourListFragment extends Fragment implements AbsListView.OnIte
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The default content for this Fragment has a TextView that is shown when
|
||||
* the list is empty. If you would like to change the text, call this method
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import android.app.Dialog;
|
|||
import android.app.DialogFragment;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputType;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
|
@ -13,14 +14,19 @@ import com.ericsson.uecontrol.R;
|
|||
import com.ericsson.uecontrol.gui.util.Configurator;
|
||||
import com.ericsson.uecontrol.gui.util.Configurator.ConfigurationParam;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Created by ezivkoc on 2014-07-24.
|
||||
*/
|
||||
public class ConfigureBehaviourDialog extends DialogFragment {
|
||||
public class ConfigureDialog extends DialogFragment {
|
||||
private HashMap<String, EditText> inputs;
|
||||
private Configurator confer;
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
inputs = new HashMap<String, EditText>();
|
||||
|
||||
// Create dialog
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setTitle(R.string.configure_behaviour);
|
||||
|
|
@ -30,25 +36,30 @@ public class ConfigureBehaviourDialog extends DialogFragment {
|
|||
root.setLayoutParams(new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT));
|
||||
int padding = getResources().getDimensionPixelSize(R.dimen.standard_padding);
|
||||
root.setPadding(padding, padding, padding, padding);
|
||||
|
||||
for(ConfigurationParam confParam : confer.getConfiguration()){
|
||||
LinearLayout layout = new LinearLayout(getActivity());
|
||||
layout.setOrientation(LinearLayout.HORIZONTAL);
|
||||
layout.setLayoutParams(new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
LinearLayout.LayoutParams.MATCH_PARENT));
|
||||
|
||||
TextView label = new TextView(getActivity());
|
||||
label.setText("Test: ");
|
||||
label.setText(confParam.getName()+": ");
|
||||
label.setLayoutParams(new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
layout.addView(label);
|
||||
|
||||
EditText input = new EditText(getActivity());
|
||||
label.setLayoutParams(new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT));
|
||||
input.setLayoutParams(new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
input.setText(confParam.getString(), TextView.BufferType.EDITABLE);
|
||||
input.setInputType(InputType.TYPE_NULL);
|
||||
inputs.put(confParam.getName(), input);
|
||||
layout.addView(input);
|
||||
|
||||
root.addView(layout);
|
||||
|
|
@ -57,12 +68,15 @@ public class ConfigureBehaviourDialog extends DialogFragment {
|
|||
|
||||
builder.setPositiveButton(R.string.action_save, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
for(ConfigurationParam confParam : confer.getConfiguration()){
|
||||
confParam.setString(inputs.get(confParam.getName()).getText().toString());
|
||||
}
|
||||
confer.setConfiguration();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(R.string.action_cancel, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
ConfigureBehaviourDialog.this.getDialog().cancel();
|
||||
ConfigureDialog.this.getDialog().cancel();
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue