Conflicts:
	app/src/main/java/de/jg_cody/Teraplex/ui/Flur/FlurFragment.java
This commit is contained in:
JG-Cody 2021-06-27 17:04:30 +02:00
commit e401474bf7

View File

@ -32,7 +32,7 @@ import de.jg_cody.Teraplex.MainActivity;
import de.jg_cody.Teraplex.R; import de.jg_cody.Teraplex.R;
import de.jg_cody.Teraplex.ui.rooms.*; import de.jg_cody.Teraplex.ui.rooms.*;
public class FlurFragment extends Fragment{ public class FlurFragment extends Fragment implements AddButtonDialogSingle.AddButtonDialogListenerSingle, AddButtonsDialogDouble.AddButtonsDialogListenerDouble {
private FlurViewModel flurViewModel; private FlurViewModel flurViewModel;
@ -47,6 +47,8 @@ public class FlurFragment extends Fragment{
ArrayList<Cricketer> cricketersList = new ArrayList<>(); ArrayList<Cricketer> cricketersList = new ArrayList<>();
int list_item_type;
@RequiresApi(api = Build.VERSION_CODES.O) @RequiresApi(api = Build.VERSION_CODES.O)
public View onCreateView(@NonNull LayoutInflater inflater, public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) { ViewGroup container, Bundle savedInstanceState) {
@ -111,21 +113,31 @@ public class FlurFragment extends Fragment{
mDialog.show(); mDialog.show();
} }
public void openDialog1() { public void openDialog1() {
list_item_type = 0;
AddButtonDialogSingle addButtonDialogSingle = new AddButtonDialogSingle(); AddButtonDialogSingle addButtonDialogSingle = new AddButtonDialogSingle();
addButtonDialogSingle.setFragment(this);
addButtonDialogSingle.show(getActivity().getSupportFragmentManager(), "example dialog"); addButtonDialogSingle.show(getActivity().getSupportFragmentManager(), "example dialog");
items.add(new ListItemSingle(addButtonDialogSingle.getCommand(),1, addButtonDialogSingle.getName(), addButtonDialogSingle.getButtonName()));
listAdapter.notifyDataSetChanged();
} }
public void openDialog2() { public void openDialog2() {
list_item_type = 1;
AddButtonsDialogDouble addButtonsDialogDouble = new AddButtonsDialogDouble(); AddButtonsDialogDouble addButtonsDialogDouble = new AddButtonsDialogDouble();
addButtonsDialogDouble.setFragment(this);
addButtonsDialogDouble.show(getActivity().getSupportFragmentManager(), "example dialog"); addButtonsDialogDouble.show(getActivity().getSupportFragmentManager(), "example dialog");
items.add(new ListItemDouble(2,addButtonsDialogDouble.getName(), addButtonsDialogDouble.getCommand1(), addButtonsDialogDouble.getCommand2(), addButtonsDialogDouble.getButton1(), addButtonsDialogDouble.getButton2()));
listAdapter.notifyDataSetChanged();
} }
public void addItems(View v) {
@Override
public void applyTextsSingle(String name, String command, String button) {
//items.add(new ListItemSingle(0,name,command,button));
listAdapter.add(new ListItemSingle(list_item_type,name,command,button));
listAdapter.notifyDataSetChanged();
}
@Override
public void applyTextsDouble(String name, String command1, String command2, String button1, String button2) {
listAdapter.add(new ListItemDouble(list_item_type,name, command1, command2, button1, button2));
listAdapter.notifyDataSetChanged(); listAdapter.notifyDataSetChanged();
} }
} }