From 4fe00155c8d7ee4f93b1d218826b1e779ed6e48c Mon Sep 17 00:00:00 2001 From: BB <boqi.ren@tu-dresden.de> Date: Fri, 15 Feb 2019 16:05:03 +0100 Subject: [PATCH] changed textview to dropdown menu, delete senuserid function, fix send datetime, make the android xml constraint more clear --- .../inf/st/sensorsharing/MainActivity.java | 108 ++--- .../main/res/layout-sw600dp/activity_main.xml | 424 ++++++++++++++++++ mobile/src/main/res/layout/activity_main.xml | 65 ++- 3 files changed, 500 insertions(+), 97 deletions(-) create mode 100644 mobile/src/main/res/layout-sw600dp/activity_main.xml diff --git a/mobile/src/main/java/de/tudresden/inf/st/sensorsharing/MainActivity.java b/mobile/src/main/java/de/tudresden/inf/st/sensorsharing/MainActivity.java index 7ccdbbd..073f486 100644 --- a/mobile/src/main/java/de/tudresden/inf/st/sensorsharing/MainActivity.java +++ b/mobile/src/main/java/de/tudresden/inf/st/sensorsharing/MainActivity.java @@ -2,6 +2,7 @@ package de.tudresden.inf.st.sensorsharing; import android.bluetooth.BluetoothAdapter; import android.content.Context; +import android.graphics.Color; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; @@ -15,10 +16,13 @@ import android.util.Log; import android.view.View; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.EditText; +import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import android.widget.ToggleButton; @@ -137,8 +141,8 @@ public class MainActivity extends AppCompatActivity implements ToggleButton user2; Button sendbutton1; Button sendbutton2; - EditText edittext1; - EditText edittext2; + Spinner drop1; + Spinner drop2; private EditText valueServerURI; @@ -227,15 +231,19 @@ public class MainActivity extends AppCompatActivity implements } }); - //bbq + //inital for the drop box menu user1=findViewById(R.id.user_1_button); user2=findViewById(R.id.user_2_button); sendbutton1 =findViewById(R.id.send_button_1); sendbutton2=findViewById(R.id.send_button_2); - edittext1=findViewById(R.id.edit_text_1); - edittext2=findViewById(R.id.edit_text_2); - edittext1.setEnabled(false); - edittext2.setEnabled(false); + drop1=findViewById(R.id.drop_1); + drop2=findViewById(R.id.drop_2); + String[] items = new String[]{"OFF", "DIM", "MEDIUM", "BRIGHT"}; + ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, items); + drop1.setAdapter(adapter); + drop2.setAdapter(adapter); + drop1.setEnabled(false); + drop2.setEnabled(false); sendbutton1.setEnabled(false); sendbutton2.setEnabled(false); @@ -258,7 +266,7 @@ public class MainActivity extends AppCompatActivity implements user2.setEnabled(false); sendbutton2.setEnabled(false); sendbutton1.setEnabled(true); - edittext1.setEnabled(true); + drop1.setEnabled(true); System.out.println(accelVectorValues[0]); System.out.println(accelVectorValues[1]); System.out.println(accelVectorValues[2]); @@ -274,7 +282,7 @@ public class MainActivity extends AppCompatActivity implements sendMqttUpdates.put(MQTT_TOPIC_DATETIME_MINUTE,true); sendUpdate(MQTT_TOPIC_DATETIME_MINUTE,getDateTime()[3]); //send datetime - String userBrightness= edittext1.getText().toString(); + String userBrightness= drop1.getSelectedItem().toString(); //sendUserId("user1",edittext1.getText().toString()); sendMqttUpdates.put(MQTT_TOPIC_IRIS1_ITEM,true); sendUpdate(MQTT_TOPIC_IRIS1_ITEM, getBrigtnessValue(userBrightness)); @@ -286,8 +294,8 @@ public class MainActivity extends AppCompatActivity implements sendMqttUpdates.put(MQTT_TOPIC_USER1,true); sendUpdate(MQTT_TOPIC_USER1, "OFF"); user2.setEnabled(true); - edittext1.setEnabled(false); - edittext2.setEnabled(false); + drop1.setEnabled(false); + drop2.setEnabled(false); sendbutton1.setEnabled(false); sendbutton2.setEnabled(false);} } @@ -312,20 +320,20 @@ public class MainActivity extends AppCompatActivity implements user1.setEnabled(false); sendbutton1.setEnabled(false); sendbutton2.setEnabled(true); - edittext2.setEnabled(true); + drop2.setEnabled(true); sendbutton2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { sendMqttUpdates.put(MQTT_TOPIC_DATETIME_MONTH,true); - sendUpdate(MQTT_TOPIC_DATETIME_MONTH,getDateTime()[0]); + sendUpdate(MQTT_TOPIC_DATETIME_MONTH,getDateTime()[1]); sendMqttUpdates.put(MQTT_TOPIC_DATETIME_DAY,true); - sendUpdate(MQTT_TOPIC_DATETIME_DAY,getDateTime()[1]); + sendUpdate(MQTT_TOPIC_DATETIME_DAY,getDateTime()[2]); sendMqttUpdates.put(MQTT_TOPIC_DATETIME_HOUR,true); - sendUpdate(MQTT_TOPIC_DATETIME_HOUR,getDateTime()[2]); + sendUpdate(MQTT_TOPIC_DATETIME_HOUR,getDateTime()[3]); sendMqttUpdates.put(MQTT_TOPIC_DATETIME_MINUTE,true); - sendUpdate(MQTT_TOPIC_DATETIME_MINUTE,getDateTime()[3]); + sendUpdate(MQTT_TOPIC_DATETIME_MINUTE,getDateTime()[4]); //send preferences - String userBrightness= edittext2.getText().toString(); + String userBrightness= drop2.getSelectedItem().toString(); System.out.println(userBrightness); sendMqttUpdates.put(MQTT_TOPIC_IRIS1_ITEM,true); sendUpdate(MQTT_TOPIC_IRIS1_ITEM, getBrigtnessValue(userBrightness)); @@ -336,8 +344,8 @@ public class MainActivity extends AppCompatActivity implements sendMqttUpdates.put(MQTT_TOPIC_USER2,true); sendUpdate(MQTT_TOPIC_USER2, "OFF"); user1.setEnabled(true); - edittext1.setEnabled(false); - edittext2.setEnabled(false); + drop1.setEnabled(false); + drop2.setEnabled(false); sendbutton1.setEnabled(false); sendbutton2.setEnabled(false);} } @@ -345,7 +353,7 @@ public class MainActivity extends AppCompatActivity implements setupSendUpdatesCheckbox(); } - //boqi + //the value for send to iris hue private String getBrigtnessValue(String Brightness){ String BrightnessValue= ""; if(Brightness.equals("OFF")){ @@ -360,7 +368,8 @@ public class MainActivity extends AppCompatActivity implements BrightnessValue="90";} return BrightnessValue; } - //boqi + + //get input datas from mobil in system month private String [] getDateTime(){ DateFormat df = new SimpleDateFormat("yy:MM:dd:HH:mm"); String date = df.format(Calendar.getInstance().getTime()); @@ -368,34 +377,6 @@ public class MainActivity extends AppCompatActivity implements datetime_split=date.split(":"); return datetime_split; } -//boqi - private void sendUserId(String userId, String Text){ - String userid=userId; - String text = Text; - System.out.println(userid); - System.out.println(text); - RequestQueue queue= Volley.newRequestQueue(this); - String url ="http://192.168.99.1:5000/user/1";//must in the same wifi phone and host - // Request a string response from the provided URL. - StringRequest stringRequest = new StringRequest(Request.Method.GET, url, - new Response.Listener<String>() { - @Override - public void onResponse(String response) { - System.out.println("request working -------------------------------"); - System.out.println(response.getClass()); - - } - }, new Response.ErrorListener(){ - @Override - public void onErrorResponse(VolleyError error) { - System.out.println("That didnt work"); - System.out.println(error); - } - }); - // Add the request to the RequestQueue. - queue.add(stringRequest); - - } private void sendLightOnOffUpdateOfSmartphone(boolean state) { ObjectMapper mapper = new ObjectMapper(); @@ -597,50 +578,51 @@ public class MainActivity extends AppCompatActivity implements System.out.println("com in loop"); System.out.println(i); System.out.println(j); - edittext1=findViewById(R.id.edit_text_1); - edittext2=findViewById(R.id.edit_text_2); + drop1=findViewById(R.id.drop_1); + drop2=findViewById(R.id.drop_2); if (user1_status.equals("on")){ i++; if (i==1){ - edittext1.setText("OFF"); + drop1.setSelection(0); + }else if(i==2){ - edittext1.setText("DIM"); + drop1.setSelection(1); } else if (i==3){ - edittext1.setText("MEDIUM"); + drop1.setSelection(2); } else if (i==4){ - edittext1.setText("BRIGHT"); + drop1.setSelection(3); } else { i=0; - edittext1.setText("OFF");} + drop1.setSelection(0);} }else if (user1_status.equals("off")){ i=0; - edittext1.setText("OFF"); + drop1.setSelection(0); } if(user2_status.equals("on")){ j++; if (j == 1){ - edittext2.setText("OFF"); + drop2.setSelection(0); }else if(j == 2){ - edittext2.setText("DIM"); + drop2.setSelection(1); } else if (j == 3){ - edittext2.setText("MEDIUM"); + drop2.setSelection(2); } else if (j == 4){ - edittext2.setText("BRIGHT"); + drop2.setSelection(3); } else {j=0; - edittext2.setText("OFF");} + drop2.setSelection(0);} }else if (user2_status.equals("off")){ j = 0; - edittext2.setText("OFF"); + drop2.setSelection(0); } } break; diff --git a/mobile/src/main/res/layout-sw600dp/activity_main.xml b/mobile/src/main/res/layout-sw600dp/activity_main.xml new file mode 100644 index 0000000..0a6ec26 --- /dev/null +++ b/mobile/src/main/res/layout-sw600dp/activity_main.xml @@ -0,0 +1,424 @@ +<?xml version="1.0" encoding="utf-8"?> +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context="de.tudresden.inf.st.sensorsharing.MainActivity"> + + <android.support.constraint.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + + <TextView + android:id="@+id/label_own_rotation" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:text="@string/text_rotation" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/label_own_brightness" /> + + <TextView + android:id="@+id/value_own_rotation" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:text="@android:string/unknownName" + app:layout_constraintStart_toEndOf="@+id/label_own_rotation" + app:layout_constraintTop_toBottomOf="@+id/value_own_brightness" /> + + <TextView + android:id="@+id/label_wear_name" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:text="@string/text_name" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/label_wear_status" /> + + <TextView + android:id="@+id/value_wear_name" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:text="@android:string/unknownName" + app:layout_constraintStart_toEndOf="@+id/label_wear_name" + app:layout_constraintTop_toBottomOf="@+id/label_wear_status" /> + + <TextView + android:id="@+id/label_own_name" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:text="@string/text_name" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/separator_own" /> + + <TextView + android:id="@+id/value_own_name" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:text="@android:string/unknownName" + app:layout_constraintStart_toEndOf="@+id/label_own_name" + app:layout_constraintTop_toBottomOf="@+id/separator_own" /> + + <TextView + android:id="@+id/separator_own" + style="?android:attr/listSeparatorTextViewStyle" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:background="@android:color/darker_gray" + android:text="@string/text_separator_smartphone_values" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/user_2_button" /> + + <TextView + android:id="@+id/separator_wear" + style="?android:attr/listSeparatorTextViewStyle" + android:layout_width="match_parent" + android:layout_height="21dp" + android:layout_marginTop="32dp" + android:background="@android:color/darker_gray" + android:text="@string/text_separator_wear_values" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/label_own_brightness" /> + + <TextView + android:id="@+id/separator_mqtt" + style="?android:attr/listSeparatorTextViewStyle" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:background="@android:color/darker_gray" + android:text="@string/text_separator_mqtt_settings" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/label_wear_rotation" /> + + <TextView + android:id="@+id/label_server_uri" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="24dp" + android:text="@string/text_mqtt_server_uri" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/separator_mqtt" /> + + <TextView + android:id="@+id/label_own_brightness" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:text="@string/text_brightness" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/label_own_name" /> + + <TextView + android:id="@+id/label_wear_brightness" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:text="@string/text_brightness" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/label_wear_name" /> + + <TextView + android:id="@+id/label_wear_acceleration" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:text="@string/text_acceleration" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/label_wear_brightness" /> + + <TextView + android:id="@+id/label_wear_rotation" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:text="@string/text_rotation" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/label_wear_acceleration" /> + + <TextView + android:id="@+id/value_own_brightness" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="12dp" + android:layout_marginTop="8dp" + android:text="@android:string/unknownName" + app:layout_constraintStart_toEndOf="@+id/label_own_brightness" + app:layout_constraintTop_toBottomOf="@+id/label_own_name" /> + + <TextView + android:id="@+id/value_wear_brightness" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:text="@android:string/unknownName" + app:layout_constraintStart_toEndOf="@+id/label_wear_brightness" + app:layout_constraintTop_toBottomOf="@+id/label_wear_name" /> + + <TextView + android:id="@+id/value_wear_acceleration" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:text="@android:string/unknownName" + app:layout_constraintStart_toEndOf="@+id/label_wear_acceleration" + app:layout_constraintTop_toBottomOf="@+id/label_wear_brightness" /> + + <TextView + android:id="@+id/value_wear_rotation" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:text="@android:string/unknownName" + app:layout_constraintStart_toEndOf="@+id/label_wear_rotation" + app:layout_constraintTop_toBottomOf="@+id/label_wear_acceleration" /> + + <EditText + android:id="@+id/value_server_uri" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp" + android:ems="10" + android:inputType="text|textUri" + android:text="@string/default_mqtt_server_uri" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/label_server_uri" /> + + <Button + android:id="@+id/button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:layout_marginEnd="8dp" + android:onClick="connectMqtt" + android:text="@android:string/ok" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/separator_mqtt" /> + + <TextView + android:id="@+id/value_wear_status" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:text="@android:string/unknownName" + app:layout_constraintStart_toEndOf="@+id/label_wear_status" + app:layout_constraintTop_toBottomOf="@+id/separator_wear" /> + + <CheckBox + android:id="@+id/checkBox_send_brightness" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="@string/text_send_updates_brightness" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/value_server_uri" /> + + <CheckBox + android:id="@+id/checkBox_send_rotation_ahrs" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="@string/text_send_updates_rotationahrs" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/checkBox_send_brightness" /> + + <CheckBox + android:id="@+id/checkBox_send_rotation_quaternion" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="@string/send_updates_rotation_quaternion" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/checkBox_send_rotation_ahrs" /> + + <CheckBox + android:id="@+id/checkBox_send_wear_brightness" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="@string/send_updates_wear_brightness" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/checkBox_send_rotation_quaternion" /> + + <CheckBox + android:id="@+id/checkBox_send_wear_acceleration" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="@string/send_updates_wear_acceleration" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/checkBox_send_wear_brightness" /> + + <CheckBox + android:id="@+id/checkBox_send_wear_rotation" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="@string/send_updates_wear_rotation" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/checkBox_send_wear_acceleration" /> + + + <TextView + android:id="@+id/label_wear_status" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:text="@string/status" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/separator_wear" /> + + <ToggleButton + android:id="@+id/toggleButton-lightonoff" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:text="@string/switch_on" + android:textOff="@string/switch_light_on" + android:textOn="@string/switch_light_off" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/checkBox_send_wear_rotation" /> + + <TextView + android:id="@+id/user_identification" + style="?android:attr/listSeparatorTextViewStyle" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:background="@android:color/darker_gray" + android:text="@string/user_identification" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/label_user_1" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="24dp" + android:text="User 1: " + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/user_identification" /> + + <ToggleButton + android:id="@+id/user_1_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="172dp" + android:text="User 1" + android:textOff="on" + android:textOn="off" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintLeft_toLeftOf="@+id/label_user_1" + app:layout_constraintTop_toBottomOf="@+id/user_identification" /> + + <TextView + android:id="@+id/label_user_2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="24dp" + android:text="User 2: " + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/label_user_1" /> + + <ToggleButton + android:id="@+id/user_2_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="172dp" + android:text="User 2" + android:textOff="on" + android:textOn="off" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintLeft_toLeftOf="@+id/user_1_button" + app:layout_constraintTop_toBottomOf="@+id/user_1_button" + app:layout_constraintRight_toRightOf="@+id/send_button_1" /> + + <Spinner + android:id="@+id/drop_1" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ems="10" + android:inputType="text" + android:background="@color/colorPrimaryDark" + android:layout_marginEnd="172dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintLeft_toRightOf="@+id/send_button_1" + app:layout_constraintTop_toBottomOf="@+id/user_identification" /> + + <Spinner + android:id="@+id/drop_2" + android:layout_width="80dp" + android:layout_height="46dp" + android:layout_marginTop="48dp" + android:ems="10" + android:inputType="text" + app:layout_constraintEnd_toStartOf="@id/send_button_1" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintLeft_toLeftOf="@+id/user_1_button" + app:layout_constraintStart_toEndOf="@id/user_1_button" + app:layout_constraintTop_toBottomOf="@+id/user_identification" /> + + <Button + android:id="@+id/send_button_1" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="172dp" + android:text="SEND" + app:layout_constraintStart_toEndOf="@id/drop_1" + app:layout_constraintLeft_toRightOf="@+id/drop_1" + app:layout_constraintTop_toBottomOf="@+id/user_identification" /> + + <Button + android:id="@+id/send_button_2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="44dp" + android:text="SEND" + app:layout_constraintLeft_toRightOf="@+id/drop_1" + app:layout_constraintStart_toEndOf="@id/drop_1" + app:layout_constraintTop_toBottomOf="@+id/user_identification" /> + + </android.support.constraint.ConstraintLayout> +</ScrollView> diff --git a/mobile/src/main/res/layout/activity_main.xml b/mobile/src/main/res/layout/activity_main.xml index 50d31c1..f03bfae 100644 --- a/mobile/src/main/res/layout/activity_main.xml +++ b/mobile/src/main/res/layout/activity_main.xml @@ -343,13 +343,12 @@ android:id="@+id/user_1_button" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="172dp" android:text="User 1" android:textOff="on" android:textOn="off" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintLeft_toLeftOf="@+id/label_user_1" - app:layout_constraintTop_toBottomOf="@+id/user_identification" /> + app:layout_constraintLeft_toRightOf="@+id/label_user_1" + app:layout_constraintRight_toLeftOf="@+id/drop_1" + app:layout_constraintTop_toBottomOf="@id/user_identification"/> <TextView android:id="@+id/label_user_2" @@ -366,57 +365,55 @@ android:id="@+id/user_2_button" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="172dp" android:text="User 2" android:textOff="on" android:textOn="off" - app:layout_constraintEnd_toEndOf="parent" app:layout_constraintLeft_toRightOf="@+id/label_user_2" + app:layout_constraintRight_toLeftOf="@+id/drop_2" + app:layout_constraintStart_toStartOf="@id/user_1_button" app:layout_constraintTop_toBottomOf="@+id/user_1_button" /> - <EditText - android:id="@+id/edit_text_1" - android:layout_width="71dp" - android:layout_height="46dp" - android:ems="10" - android:inputType="number" - app:layout_constraintEnd_toStartOf="@id/send_button_1" - app:layout_constraintStart_toEndOf="@id/user_1_button" - app:layout_constraintLeft_toLeftOf="@+id/user_1_button" - app:layout_constraintTop_toBottomOf="@+id/user_identification"/> - - <EditText - android:id="@+id/edit_text_2" - android:layout_width="71dp" - android:layout_height="46dp" - android:layout_marginTop="48dp" - android:ems="10" - android:inputType="number" + <Spinner + android:id="@+id/drop_1" + android:layout_width="wrap_content" + android:layout_height="wrap_content" app:layout_constraintEnd_toStartOf="@id/send_button_1" - app:layout_constraintHorizontal_bias="0.0" - app:layout_constraintLeft_toLeftOf="@+id/user_1_button" - app:layout_constraintStart_toEndOf="@id/user_1_button" + app:layout_constraintLeft_toRightOf="@+id/user_1_button" + app:layout_constraintRight_toLeftOf="@+id/send_button_1" app:layout_constraintTop_toBottomOf="@+id/user_identification" /> + + <Spinner + android:id="@+id/drop_2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + + app:layout_constraintEnd_toStartOf="@id/send_button_2" + app:layout_constraintLeft_toRightOf="@+id/user_2_button" + app:layout_constraintRight_toLeftOf="@+id/send_button_2" + app:layout_constraintStart_toStartOf="@id/drop_1" + app:layout_constraintTop_toBottomOf="@+id/drop_1"> + + </Spinner> + <Button android:id="@+id/send_button_1" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="172dp" + android:layout_marginEnd="0dp" android:text="SEND" - app:layout_constraintStart_toEndOf="@id/edit_text_1" - app:layout_constraintLeft_toRightOf="@+id/edit_text_1" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintLeft_toRightOf="@id/drop_1" app:layout_constraintTop_toBottomOf="@+id/user_identification" /> <Button android:id="@+id/send_button_2" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="44dp" android:text="SEND" - app:layout_constraintLeft_toRightOf="@+id/edit_text_1" - app:layout_constraintStart_toEndOf="@id/edit_text_1" - app:layout_constraintTop_toBottomOf="@+id/user_identification" /> + app:layout_constraintLeft_toRightOf="@+id/drop_2" + app:layout_constraintStart_toStartOf="@id/send_button_1" + app:layout_constraintTop_toBottomOf="@+id/send_button_1" /> </android.support.constraint.ConstraintLayout> </ScrollView> -- GitLab