diff --git a/app/src/main/java/de/jg_cody/Teraplex/ui/Flur/FlurFragment.java b/app/src/main/java/de/jg_cody/Teraplex/ui/Flur/FlurFragment.java index 44d9694..a7766b7 100644 --- a/app/src/main/java/de/jg_cody/Teraplex/ui/Flur/FlurFragment.java +++ b/app/src/main/java/de/jg_cody/Teraplex/ui/Flur/FlurFragment.java @@ -102,6 +102,8 @@ public class FlurFragment extends Fragment implements AddButtonDialogSingle.AddB } else if (i == 2) { } else if (i == 3) { + listAdapter.add(new ListItemSpace(3)); + listAdapter.notifyDataSetChanged(); } @@ -112,6 +114,7 @@ public class FlurFragment extends Fragment implements AddButtonDialogSingle.AddB Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round); mDialog.show(); } + public void openDialog1() { list_item_type = 0; AddButtonDialogSingle addButtonDialogSingle = new AddButtonDialogSingle(); diff --git a/app/src/main/java/de/jg_cody/Teraplex/ui/rooms/ListAdapter.java b/app/src/main/java/de/jg_cody/Teraplex/ui/rooms/ListAdapter.java index d9499a6..b451c6d 100644 --- a/app/src/main/java/de/jg_cody/Teraplex/ui/rooms/ListAdapter.java +++ b/app/src/main/java/de/jg_cody/Teraplex/ui/rooms/ListAdapter.java @@ -18,7 +18,8 @@ public class ListAdapter extends ArrayAdapter { public static int SINGLEBUTTON = 0; public static int DOUBLEBUTTON = 1; - public static int OPTION3BUTTON = 2; + public static int HEADLINE = 2; + public static int SPACE = 3; private ArrayList objects; @@ -26,7 +27,7 @@ public class ListAdapter extends ArrayAdapter { @Override public int getViewTypeCount() { - return 3; + return 4; } public int getItemViewType(int position){ @@ -44,7 +45,7 @@ public class ListAdapter extends ArrayAdapter { @Override public View getView(int position, View convertView, @NotNull ViewGroup parent) { - IViewHolder viewHolder= null; + IViewHolder viewHolder = null; ListItem listViewItem = objects.get(position); int listViewItemType = getItemViewType(position); @@ -64,8 +65,7 @@ public class ListAdapter extends ArrayAdapter { //viewHolder = new ViewHolderSingleButton(bRun , listViewItem.getText()); //convertView.setTag(viewHolder); - } - else if (listViewItemType == DOUBLEBUTTON) { + } else if (listViewItemType == DOUBLEBUTTON) { convertView = LayoutInflater.from(getContext()).inflate(R.layout.doublebutton, null); Button bLeft = (Button) convertView.findViewById(R.id.doubleButton_bLeft); Button bRight = (Button) convertView.findViewById(R.id.doubleButton_bRight); @@ -76,19 +76,19 @@ public class ListAdapter extends ArrayAdapter { text.setText(s[0]); - //viewHolder = new ViewHolderDoubleButton(bLeft,bRight,listViewItem.getText()); //convertView.setTag(viewHolder); + } else if (listViewItemType == SPACE) { + convertView = LayoutInflater.from(getContext()).inflate(R.layout.space, null); + + } else { + viewHolder = (IViewHolder) convertView.getTag(); } - } - else{ - viewHolder = (IViewHolder) convertView.getTag(); - } + return convertView; + } return convertView; - } - -} + }} diff --git a/app/src/main/java/de/jg_cody/Teraplex/ui/rooms/ListItemHeadline.java b/app/src/main/java/de/jg_cody/Teraplex/ui/rooms/ListItemHeadline.java new file mode 100644 index 0000000..c4de03f --- /dev/null +++ b/app/src/main/java/de/jg_cody/Teraplex/ui/rooms/ListItemHeadline.java @@ -0,0 +1,56 @@ +package de.jg_cody.Teraplex.ui.rooms; + +public class ListItemHeadline extends ListItem{ + + private String name, command1, command2,button1, button2; + public ListItemHeadline(int type, String name, String command1, String command2, String button1, String button2) { + super( type); + this.name = name; + } + public void setName(String name) + { + this.name = name; + } + public void setCommand1(String command1) + { + this.command1 = command1; + } + public void setCommand2(String command2) + { + this.command2 = command2; + } + public void setButton1(String button1) + { + this.button1 = button1; + } + public void setButton2(String button2) + { + this.button2 = button2; + } + public String getName() + { + return name; + } + public String getCommand1() + { + return command1; + } + public String getCommand2() + { + return command2; + } + public String getButton1() + { + return button1; + } + public String getButton2() + { + return button2; + } + + @Override + public String[] getStrings() { + String[] s = {name, command1, command2, button1,button2}; + return s; + } +} diff --git a/app/src/main/java/de/jg_cody/Teraplex/ui/rooms/ListItemSpace.java b/app/src/main/java/de/jg_cody/Teraplex/ui/rooms/ListItemSpace.java new file mode 100644 index 0000000..6df85f8 --- /dev/null +++ b/app/src/main/java/de/jg_cody/Teraplex/ui/rooms/ListItemSpace.java @@ -0,0 +1,16 @@ +package de.jg_cody.Teraplex.ui.rooms; + +public class ListItemSpace extends ListItem{ + + public ListItemSpace(int type) { + super( type); + + } + + + @Override + public String[] getStrings() { + String[] s = {}; + return s; + } +} diff --git a/app/src/main/res/layout/headline.xml b/app/src/main/res/layout/headline.xml new file mode 100644 index 0000000..f8a7344 --- /dev/null +++ b/app/src/main/res/layout/headline.xml @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/space.xml b/app/src/main/res/layout/space.xml new file mode 100644 index 0000000..bcdf557 --- /dev/null +++ b/app/src/main/res/layout/space.xml @@ -0,0 +1,13 @@ + + + + + \ No newline at end of file