Skip to content
Snippets Groups Projects
Commit 0529cfff authored by boqiren's avatar boqiren
Browse files

add current lights control text view

parent 91a18eed
No related branches found
No related tags found
No related merge requests found
...@@ -567,20 +567,20 @@ public class MainActivity extends AppCompatActivity implements ...@@ -567,20 +567,20 @@ public class MainActivity extends AppCompatActivity implements
@Override @Override
public void messageArrived(String topic, MqttMessage message) throws Exception { public void messageArrived(String topic, MqttMessage message) throws Exception {
String status_message= new String(message.getPayload()); String status_message= new String(message.getPayload());
TextView textView = findViewById(R.id.room_name);
TextView textView1 = findViewById(R.id.current_light_name);
System.out.println(" Topic:\t" + topic + System.out.println(" Topic:\t" + topic +
" Message:\t" + status_message +" QoS:\t" + message.getQos() ); " Message:\t" + status_message +" QoS:\t" + message.getQos() );
if (topic.equals("in/E_Motion_Detector/state") && status_message.equals("OPEN")){ if (topic.equals("in/E_Motion_Detector/state") && status_message.equals("OPEN")){
System.out.println("hhhhhhh");
TextView textView = findViewById(R.id.room_name);
textView.setText("Entrance Room"); textView.setText("Entrance Room");
textView1.setText("E Lights");
} else if (topic.equals("in/G_Motion_Detector/state") && status_message.equals("OPEN")){ } else if (topic.equals("in/G_Motion_Detector/state") && status_message.equals("OPEN")){
System.out.println("uuuuu");
TextView textView = findViewById(R.id.room_name);
textView.setText("Bedroom Corridor"); textView.setText("Bedroom Corridor");
textView1.setText("G Lights");
} else if(topic.equals("in/D_Motion_Detector/state") && status_message.equals("OPEN")){ } else if(topic.equals("in/D_Motion_Detector/state") && status_message.equals("OPEN")){
TextView textView = findViewById(R.id.room_name);
textView.setText("Kitchen"); textView.setText("Kitchen");
textView1.setText("D Lights 1 and Lights 2");
} }
SeekBar current_seekbar = findViewById(R.id.seekBar1); SeekBar current_seekbar = findViewById(R.id.seekBar1);
current_seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { current_seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment