Merge remote-tracking branch 'origin/zwicki_branch'
# Conflicts: # app/src/main/java/de/jg_cody/Teraplex/ui/Flur/FlurFragment.java
This commit is contained in:
commit
7f1460ffa7
@ -1,6 +1,7 @@
|
|||||||
package de.jg_cody.Teraplex;
|
package de.jg_cody.Teraplex;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
import android.app.Fragment;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -8,17 +9,21 @@ import android.app.AlertDialog;
|
|||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import de.jg_cody.Teraplex.ui.Flur.FlurFragment;
|
||||||
|
import de.jg_cody.Teraplex.ui.rooms.ListItem;
|
||||||
|
import de.jg_cody.Teraplex.ui.rooms.*;
|
||||||
|
|
||||||
public class AddButtonDialogSingle extends DialogFragment {
|
public class AddButtonDialogSingle extends DialogFragment {
|
||||||
private EditText editTextUsername;
|
private EditText editText_command, editText_name, editText_button_name;
|
||||||
private EditText editTextPassword;
|
private AddButtonDialogListenerSingle listener;
|
||||||
|
private FlurFragment frag;
|
||||||
private EditText command, name, button_name;
|
|
||||||
private AddButtonDialogListener listener;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -31,9 +36,9 @@ public class AddButtonDialogSingle extends DialogFragment {
|
|||||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||||
View view = inflater.inflate(R.layout.addbuttondialog_single, null);
|
View view = inflater.inflate(R.layout.addbuttondialog_single, null);
|
||||||
|
|
||||||
command = getActivity().findViewById(R.id.dialogSingle_editText_command);
|
editText_command = view.findViewById(R.id.dialogSingle_editText_command);
|
||||||
name = getActivity().findViewById(R.id.dialogSingle_editText_name);
|
editText_name = view.findViewById(R.id.dialogSingle_editText_name);
|
||||||
button_name = getActivity().findViewById(R.id.dialogSingle_editText_buttonName);
|
editText_button_name = view.findViewById(R.id.dialogSingle_editText_buttonName);
|
||||||
|
|
||||||
|
|
||||||
builder.setView(view)
|
builder.setView(view)
|
||||||
@ -47,9 +52,10 @@ public class AddButtonDialogSingle extends DialogFragment {
|
|||||||
.setPositiveButton("ADD", new DialogInterface.OnClickListener() {
|
.setPositiveButton("ADD", new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
String username = editTextUsername.getText().toString();
|
String command = editText_command.getText().toString();
|
||||||
String password = editTextPassword.getText().toString();
|
String name = editText_name.getText().toString();
|
||||||
listener.applyTexts(username, password);
|
String button = editText_button_name.getText().toString();
|
||||||
|
listener.applyTextsSingle(name,command,button);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -59,33 +65,33 @@ public class AddButtonDialogSingle extends DialogFragment {
|
|||||||
return mDialog;
|
return mDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFragment(FlurFragment frag)
|
||||||
|
{
|
||||||
|
this.frag = frag;
|
||||||
|
}
|
||||||
|
public FlurFragment getFragment()
|
||||||
|
{
|
||||||
|
return frag;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(Context context) {
|
public void onAttach(Context context) {
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
listener = (AddButtonDialogListener) context;
|
listener = (AddButtonDialogListenerSingle) frag;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ClassCastException(context.toString() +
|
throw new ClassCastException(frag.toString() +
|
||||||
"must implement ExampleDialogListener");
|
"must implement ExampleDialogListener");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public interface AddButtonDialogListenerSingle {
|
||||||
|
void applyTextsSingle(String name, String command, String button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public interface AddButtonDialogListener {
|
|
||||||
void applyTexts(String username, String password);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return name.getText().toString();
|
|
||||||
}
|
|
||||||
public String getButtonName()
|
|
||||||
{
|
|
||||||
return button_name.getText().toString();
|
|
||||||
}
|
|
||||||
public String getCommand()
|
|
||||||
{
|
|
||||||
return command.getText().toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -11,11 +11,14 @@ import android.widget.EditText;
|
|||||||
|
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
|
||||||
|
import de.jg_cody.Teraplex.ui.Flur.FlurFragment;
|
||||||
|
|
||||||
|
|
||||||
public class AddButtonsDialogDouble extends DialogFragment {
|
public class AddButtonsDialogDouble extends DialogFragment {
|
||||||
private AddButtonsDialogListener listener;
|
private AddButtonsDialogListenerDouble listener;
|
||||||
|
|
||||||
private EditText name, command1, button1, command2, button2;
|
private EditText name, command1, button1, command2, button2;
|
||||||
|
private FlurFragment frag;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
@ -44,44 +47,33 @@ public class AddButtonsDialogDouble extends DialogFragment {
|
|||||||
command2 = getActivity().findViewById(R.id.dialogDouble_editText_command2);
|
command2 = getActivity().findViewById(R.id.dialogDouble_editText_command2);
|
||||||
button1 = getActivity().findViewById(R.id.dialogDouble_editText_button1);
|
button1 = getActivity().findViewById(R.id.dialogDouble_editText_button1);
|
||||||
button2 = getActivity().findViewById(R.id.dialogDouble_editText_button2);
|
button2 = getActivity().findViewById(R.id.dialogDouble_editText_button2);
|
||||||
|
|
||||||
AlertDialog mDialog = builder.create();
|
AlertDialog mDialog = builder.create();
|
||||||
mDialog.getWindow().setBackgroundDrawableResource(R.drawable.button_round);
|
mDialog.getWindow().setBackgroundDrawableResource(R.drawable.button_round);
|
||||||
return mDialog;
|
return mDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFragment(FlurFragment frag) {
|
||||||
|
this.frag = frag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FlurFragment getFragment() {
|
||||||
|
return frag;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(Context context) {
|
public void onAttach(Context context) {
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
listener = (AddButtonsDialogListener) context;
|
listener = (AddButtonsDialogListenerDouble) frag;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface AddButtonsDialogListener {
|
public interface AddButtonsDialogListenerDouble {
|
||||||
void applyTexts(String username, String password);
|
void applyTextsDouble(String name, String command1, String command2, String button1, String button2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return name.getText().toString();
|
|
||||||
}
|
|
||||||
public String getCommand1()
|
|
||||||
{
|
|
||||||
return command1.getText().toString();
|
|
||||||
}
|
|
||||||
public String getButton1()
|
|
||||||
{
|
|
||||||
return button1.getText().toString();
|
|
||||||
}
|
|
||||||
public String getCommand2()
|
|
||||||
{
|
|
||||||
return command2.getText().toString();
|
|
||||||
}
|
|
||||||
public String getButton2()
|
|
||||||
{
|
|
||||||
return button2.getText().toString();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,9 @@
|
|||||||
package de.jg_cody.Teraplex;
|
package de.jg_cody.Teraplex;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
@ -27,6 +29,7 @@ import android.view.MenuItem;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.ListView;
|
||||||
|
|
||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
@ -44,19 +47,30 @@ import com.google.android.material.navigation.NavigationView;
|
|||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import de.jg_cody.Teraplex.ui.Credits.CreditsFragment;
|
import de.jg_cody.Teraplex.ui.Credits.CreditsFragment;
|
||||||
import de.jg_cody.Teraplex.ui.Einstellungen.EinstellungenFragment;
|
import de.jg_cody.Teraplex.ui.Einstellungen.EinstellungenFragment;
|
||||||
import de.jg_cody.Teraplex.ui.Konsole.KonsoleFragment;
|
import de.jg_cody.Teraplex.ui.Konsole.KonsoleFragment;
|
||||||
import de.jg_cody.Teraplex.ui.home.HomeFragment;
|
import de.jg_cody.Teraplex.ui.home.HomeFragment;
|
||||||
|
import de.jg_cody.Teraplex.ui.rooms.ListAdapter;
|
||||||
|
import de.jg_cody.Teraplex.ui.rooms.ListItem;
|
||||||
|
import de.jg_cody.Teraplex.ui.rooms.ListItemDouble;
|
||||||
|
import de.jg_cody.Teraplex.ui.rooms.ListItemSingle;
|
||||||
|
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity implements AddButtonDialogSingle.AddButtonDialogListener {
|
public class MainActivity extends AppCompatActivity {
|
||||||
public static int RESULT_LOAD_IMAGE = 0;
|
public static int RESULT_LOAD_IMAGE = 0;
|
||||||
private AppBarConfiguration mAppBarConfiguration;
|
private AppBarConfiguration mAppBarConfiguration;
|
||||||
|
|
||||||
|
ListAdapter listAdapter;
|
||||||
|
ListView listView;
|
||||||
|
|
||||||
|
ArrayList<ListItem> items;
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -132,9 +146,19 @@ public class MainActivity extends AppCompatActivity implements AddButtonDialogSi
|
|||||||
NavigationUI.setupWithNavController(navigationView, navController);
|
NavigationUI.setupWithNavController(navigationView, navController);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*static public class DemoPreferenceFragment extends PreferenceFragmentCompat {
|
/*static public class DemoPreferenceFragment extends PreferenceFragmentCompat {
|
||||||
@Override
|
@Override
|
||||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||||
@ -186,11 +210,6 @@ public class MainActivity extends AppCompatActivity implements AddButtonDialogSi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void applyTexts(String username, String password) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void menurighttopeinstellungen(MenuItem i) {
|
public void menurighttopeinstellungen(MenuItem i) {
|
||||||
EinstellungenFragment pef = new EinstellungenFragment();
|
EinstellungenFragment pef = new EinstellungenFragment();
|
||||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||||
@ -313,4 +332,6 @@ public class MainActivity extends AppCompatActivity implements AddButtonDialogSi
|
|||||||
canvas.drawRect(0F, 0F, (float) width, (float) height, paint);
|
canvas.drawRect(0F, 0F, (float) width, (float) height, paint);
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
package de.jg_cody.Teraplex.ui.Flur;
|
package de.jg_cody.Teraplex.ui.Flur;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@ -17,16 +22,15 @@ import androidx.lifecycle.ViewModelProvider;
|
|||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Base64;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import de.jg_cody.Teraplex.AddButtonDialogSingle;
|
import de.jg_cody.Teraplex.AddButtonDialogSingle;
|
||||||
import de.jg_cody.Teraplex.AddButtonsDialogDouble;
|
import de.jg_cody.Teraplex.AddButtonsDialogDouble;
|
||||||
import de.jg_cody.Teraplex.Cricketer;
|
import de.jg_cody.Teraplex.Cricketer;
|
||||||
|
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.ListAdapter;
|
import de.jg_cody.Teraplex.ui.rooms.*;
|
||||||
import de.jg_cody.Teraplex.ui.rooms.ListItem;
|
|
||||||
import de.jg_cody.Teraplex.ui.rooms.ListItemDouble;
|
|
||||||
import de.jg_cody.Teraplex.ui.rooms.ListItemSingle;
|
|
||||||
|
|
||||||
public class FlurFragment extends Fragment{
|
public class FlurFragment extends Fragment{
|
||||||
|
|
||||||
@ -49,14 +53,14 @@ public class FlurFragment extends Fragment{
|
|||||||
flurViewModel =
|
flurViewModel =
|
||||||
new ViewModelProvider(this).get(FlurViewModel.class);
|
new ViewModelProvider(this).get(FlurViewModel.class);
|
||||||
View root = inflater.inflate(R.layout.fragment_flur, container, false);
|
View root = inflater.inflate(R.layout.fragment_flur, container, false);
|
||||||
/* SharedPreferences p = requireContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE);
|
SharedPreferences p = requireContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE);
|
||||||
String Background = p.getString("Background", null);
|
String Background = p.getString("Background", null);
|
||||||
if (Background != null) {
|
if (Background != null) {
|
||||||
ImageView I = root.findViewById(R.id.Background);
|
ImageView I = root.findViewById(R.id.Background);
|
||||||
byte[] BA = Base64.getDecoder().decode(Background);
|
byte[] BA = Base64.getDecoder().decode(Background);
|
||||||
I.setImageDrawable(new BitmapDrawable(getResources(), MainActivity.scaleCenterCrop(BitmapFactory.decodeByteArray(BA, 0, BA.length), MainActivity.getScreenHeight(), MainActivity.getScreenWidth())));
|
I.setImageDrawable(new BitmapDrawable(getResources(), MainActivity.scaleCenterCrop(BitmapFactory.decodeByteArray(BA, 0, BA.length), MainActivity.getScreenHeight(), MainActivity.getScreenWidth())));
|
||||||
I.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
I.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||||
} */
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -108,7 +112,7 @@ public class FlurFragment extends Fragment{
|
|||||||
}
|
}
|
||||||
public void openDialog1() {
|
public void openDialog1() {
|
||||||
AddButtonDialogSingle addButtonDialogSingle = new AddButtonDialogSingle();
|
AddButtonDialogSingle addButtonDialogSingle = new AddButtonDialogSingle();
|
||||||
addButtonDialogSingle.show(requireActivity().getSupportFragmentManager(), "example dialog");
|
addButtonDialogSingle.show(getActivity().getSupportFragmentManager(), "example dialog");
|
||||||
items.add(new ListItemSingle(addButtonDialogSingle.getCommand(),1, addButtonDialogSingle.getName(), addButtonDialogSingle.getButtonName()));
|
items.add(new ListItemSingle(addButtonDialogSingle.getCommand(),1, addButtonDialogSingle.getName(), addButtonDialogSingle.getButtonName()));
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
|
|
||||||
@ -117,7 +121,7 @@ public class FlurFragment extends Fragment{
|
|||||||
|
|
||||||
public void openDialog2() {
|
public void openDialog2() {
|
||||||
AddButtonsDialogDouble addButtonsDialogDouble = new AddButtonsDialogDouble();
|
AddButtonsDialogDouble addButtonsDialogDouble = new AddButtonsDialogDouble();
|
||||||
addButtonsDialogDouble.show(requireActivity().getSupportFragmentManager(), "example dialog");
|
addButtonsDialogDouble.show(getActivity().getSupportFragmentManager(), "example dialog");
|
||||||
items.add(new ListItemDouble(2,addButtonsDialogDouble.getName(), addButtonsDialogDouble.getCommand1(), addButtonsDialogDouble.getCommand2(), addButtonsDialogDouble.getButton1(), addButtonsDialogDouble.getButton2()));
|
items.add(new ListItemDouble(2,addButtonsDialogDouble.getName(), addButtonsDialogDouble.getCommand1(), addButtonsDialogDouble.getCommand2(), addButtonsDialogDouble.getButton1(), addButtonsDialogDouble.getButton2()));
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
@ -48,29 +48,38 @@ public class ListAdapter extends ArrayAdapter {
|
|||||||
ListItem listViewItem = objects.get(position);
|
ListItem listViewItem = objects.get(position);
|
||||||
int listViewItemType = getItemViewType(position);
|
int listViewItemType = getItemViewType(position);
|
||||||
|
|
||||||
|
String[] s = listViewItem.getStrings();
|
||||||
if (convertView == null) {
|
if (convertView == null) {
|
||||||
|
|
||||||
if (listViewItemType == SINGLEBUTTON) {
|
if (listViewItemType == SINGLEBUTTON) {
|
||||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.singlebutton, null);
|
convertView = LayoutInflater.from(getContext()).inflate(R.layout.singlebutton, null);
|
||||||
|
|
||||||
Button bRun = convertView.findViewById(R.id.bRun);
|
Button bRun = convertView.findViewById(R.id.singleButton_button);
|
||||||
Button text = convertView.findViewById(R.id.TEXT);
|
Button text = convertView.findViewById(R.id.singleButton_text);
|
||||||
bRun.setText(listViewItem.getText());
|
|
||||||
|
bRun.setText(s[2]);
|
||||||
|
text.setText(s[0]);
|
||||||
//text.setText(listViewItemType.get)
|
//text.setText(listViewItemType.get)
|
||||||
|
|
||||||
viewHolder = new ViewHolderSingleButton(bRun , listViewItem.getText());
|
//viewHolder = new ViewHolderSingleButton(bRun , listViewItem.getText());
|
||||||
convertView.setTag(viewHolder);
|
//convertView.setTag(viewHolder);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (listViewItemType == DOUBLEBUTTON) {
|
else if (listViewItemType == DOUBLEBUTTON) {
|
||||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.doublebutton, null);
|
convertView = LayoutInflater.from(getContext()).inflate(R.layout.doublebutton, null);
|
||||||
Button bLeft = (Button) convertView.findViewById(R.id.bLeft);
|
Button bLeft = (Button) convertView.findViewById(R.id.doubleButton_bLeft);
|
||||||
Button bRight = (Button) convertView.findViewById(R.id.bRight);
|
Button bRight = (Button) convertView.findViewById(R.id.doubleButton_bRight);
|
||||||
|
Button text = (Button) convertView.findViewById(R.id.doubleButton_text);
|
||||||
|
|
||||||
viewHolder = new ViewHolderDoubleButton(bLeft,bRight,listViewItem.getText());
|
bLeft.setText(s[3]);
|
||||||
|
bRight.setText(s[4]);
|
||||||
|
text.setText(s[0]);
|
||||||
|
|
||||||
convertView.setTag(viewHolder);
|
|
||||||
|
|
||||||
|
//viewHolder = new ViewHolderDoubleButton(bLeft,bRight,listViewItem.getText());
|
||||||
|
|
||||||
|
//convertView.setTag(viewHolder);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package de.jg_cody.Teraplex.ui.rooms;
|
package de.jg_cody.Teraplex.ui.rooms;
|
||||||
|
|
||||||
public class ListItem {
|
public abstract class ListItem {
|
||||||
private String text;
|
private String text;
|
||||||
private int type;
|
private int type;
|
||||||
|
|
||||||
@ -10,13 +10,7 @@ public class ListItem {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String getText() {
|
abstract public String[] getStrings();
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setText(String text) {
|
|
||||||
this.text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return type;
|
return type;
|
||||||
|
@ -52,4 +52,9 @@ public class ListItemDouble extends ListItem{
|
|||||||
return button2;
|
return button2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getStrings() {
|
||||||
|
String[] s = {name, command1, command2, button1,button2};
|
||||||
|
return s;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,14 @@ package de.jg_cody.Teraplex.ui.rooms;
|
|||||||
|
|
||||||
public class ListItemSingle extends ListItem{
|
public class ListItemSingle extends ListItem{
|
||||||
String buttonName;
|
String buttonName;
|
||||||
|
String command;
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
public ListItemSingle(String command, int type, String buttonName, String name) {
|
public ListItemSingle(int type, String name,String command,String buttonName ) {
|
||||||
super(type);
|
super(type);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.buttonName = buttonName;
|
this.buttonName = buttonName;
|
||||||
|
this.command = command;
|
||||||
|
|
||||||
}
|
}
|
||||||
public void setButtonName(String buttonName)
|
public void setButtonName(String buttonName)
|
||||||
@ -26,4 +28,18 @@ public class ListItemSingle extends ListItem{
|
|||||||
{
|
{
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
public void setCommand(String command)
|
||||||
|
{
|
||||||
|
this.command = command;
|
||||||
|
}
|
||||||
|
public String getCommand()
|
||||||
|
{
|
||||||
|
return command;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getStrings() {
|
||||||
|
String[] s = {name, command, buttonName};
|
||||||
|
return s;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/bLeft"
|
android:id="@+id/doubleButton_bLeft"
|
||||||
android:layout_width="100dp"
|
android:layout_width="100dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
@ -21,20 +21,19 @@
|
|||||||
app:backgroundTint="@null" />
|
app:backgroundTint="@null" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/TEXT"
|
android:id="@+id/doubleButton_text"
|
||||||
android:layout_width="100dp"
|
android:layout_width="100dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/button_middle"
|
android:background="@drawable/button_middle"
|
||||||
android:insetLeft="25dp"
|
android:insetLeft="25dp"
|
||||||
android:insetRight="25dp"
|
android:insetRight="25dp"
|
||||||
android:text="Button2"
|
android:text="Button1"
|
||||||
app:backgroundTint="@null" />
|
app:backgroundTint="@null" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/bRight"
|
android:id="@+id/doubleButton_bRight"
|
||||||
android:layout_width="100dp"
|
android:layout_width="100dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/fragment_flur"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".MainActivity">
|
tools:context=".MainActivity">
|
||||||
@ -19,8 +20,8 @@
|
|||||||
<ListView
|
<ListView
|
||||||
android:id="@+id/listView"
|
android:id="@+id/listView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="742dp"
|
android:layout_height="match_parent"
|
||||||
android:visibility="visible"/>
|
android:visibility="visible" />
|
||||||
|
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/TEXT"
|
android:id="@+id/singleButton_text"
|
||||||
android:layout_width="220dp"
|
android:layout_width="200dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
@ -17,11 +17,11 @@
|
|||||||
android:background="@drawable/button_left"
|
android:background="@drawable/button_left"
|
||||||
android:insetLeft="25dp"
|
android:insetLeft="25dp"
|
||||||
android:insetRight="25dp"
|
android:insetRight="25dp"
|
||||||
android:text="Beschriftung"
|
android:text="TEXT"
|
||||||
app:backgroundTint="@null" />
|
app:backgroundTint="@null" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/bRun"
|
android:id="@+id/singleButton_button"
|
||||||
android:layout_width="100dp"
|
android:layout_width="100dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
@ -29,7 +29,7 @@
|
|||||||
android:background="@drawable/button_right"
|
android:background="@drawable/button_right"
|
||||||
android:insetLeft="25dp"
|
android:insetLeft="25dp"
|
||||||
android:insetRight="25dp"
|
android:insetRight="25dp"
|
||||||
android:text="1234"
|
android:text="Button2"
|
||||||
app:backgroundTint="@null" />
|
app:backgroundTint="@null" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
Loading…
Reference in New Issue
Block a user