Added some skeleton code for Kenny

This commit is contained in:
2017-07-28 17:13:20 +02:00
parent 4ed0944b16
commit f26113008c
2 changed files with 19 additions and 0 deletions

View File

@@ -74,4 +74,12 @@ public class MainActivity extends Activity {
taskView.removeView(v); taskView.removeView(v);
list.remove(v.getTask()); list.remove(v.getTask());
} }
public void onStatusChanged() {
if (list.isFinished()) {
// Alle taken zijn complete
} else {
// Rani haar huis staat in brand
}
}
} }

View File

@@ -4,6 +4,7 @@ import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText; import android.widget.EditText;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.Toast; import android.widget.Toast;
@@ -33,6 +34,7 @@ public class TaskView extends LinearLayout {
textView.setText(t.getText()); textView.setText(t.getText());
addTextListeners(); addTextListeners();
addCheckListeners();
} }
public void updateTask() { public void updateTask() {
@@ -49,6 +51,15 @@ public class TaskView extends LinearLayout {
return this.task; return this.task;
} }
private void addCheckListeners() {
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
TaskView.this.parent.onStatusChanged();
}
});
}
// Android is horrible, this code tries to figure out when the user finished editing. // Android is horrible, this code tries to figure out when the user finished editing.
// When this is the case, check if the text field is empty, delete the taskview if this is // When this is the case, check if the text field is empty, delete the taskview if this is
// the case. // the case.