Add inputs for bathroom
This commit is contained in:
parent
b814ef2a00
commit
b7ac69c46f
2 changed files with 271 additions and 178 deletions
|
@ -127,6 +127,9 @@ public class MainActivity extends AppCompatActivity {
|
||||||
findViewById(R.id.kitchen_on_button).setOnClickListener(view -> on("kitchen"));
|
findViewById(R.id.kitchen_on_button).setOnClickListener(view -> on("kitchen"));
|
||||||
findViewById(R.id.kitchen_off_button).setOnClickListener(view -> off("kitchen"));
|
findViewById(R.id.kitchen_off_button).setOnClickListener(view -> off("kitchen"));
|
||||||
|
|
||||||
|
findViewById(R.id.bathroom_on_button).setOnClickListener(view -> on("bathroom"));
|
||||||
|
findViewById(R.id.bathroom_off_button).setOnClickListener(view -> off("bathroom"));
|
||||||
|
|
||||||
findViewById(R.id.all_on_button).setOnClickListener(view -> on("seating", "kitchen"));
|
findViewById(R.id.all_on_button).setOnClickListener(view -> on("seating", "kitchen"));
|
||||||
findViewById(R.id.all_off_button).setOnClickListener(view -> off("seating", "kitchen"));
|
findViewById(R.id.all_off_button).setOnClickListener(view -> off("seating", "kitchen"));
|
||||||
|
|
||||||
|
@ -162,6 +165,22 @@ public class MainActivity extends AppCompatActivity {
|
||||||
setBrightness("kitchen", seekBar.getProgress());
|
setBrightness("kitchen", seekBar.getProgress());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
((SeekBar)findViewById(R.id.bathroom_brightness)).setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||||
|
setBrightness("bathroom", seekBar.getProgress());
|
||||||
|
}
|
||||||
|
});
|
||||||
((SeekBar)findViewById(R.id.all_brightness)).setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
((SeekBar)findViewById(R.id.all_brightness)).setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
|
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
|
||||||
|
@ -177,7 +196,8 @@ public class MainActivity extends AppCompatActivity {
|
||||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||||
int progress = seekBar.getProgress();
|
int progress = seekBar.getProgress();
|
||||||
setBrightness("seating", progress, false);
|
setBrightness("seating", progress, false);
|
||||||
setBrightness("kitchen", progress);
|
setBrightness("kitchen", progress, false);
|
||||||
|
setBrightness("bathroom", progress);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -6,21 +6,25 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".MainActivity">
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_height="0dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/seating" />
|
android:text="@string/seating"
|
||||||
|
android:layout_marginLeft="5dp"/>
|
||||||
|
|
||||||
<SeekBar
|
<SeekBar
|
||||||
android:id="@+id/seating_brightness"
|
android:id="@+id/seating_brightness"
|
||||||
|
@ -41,7 +45,7 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_gravity="start"
|
android:layout_gravity="start"
|
||||||
android:layout_height="90dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
android:text="@string/on" />
|
android:text="@string/on" />
|
||||||
|
|
||||||
|
@ -50,21 +54,22 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:layout_height="90dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
android:text="@string/off" />
|
android:text="@string/off" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center">
|
||||||
<NumberPicker
|
<NumberPicker
|
||||||
android:id="@+id/seating_timer_minutes"
|
android:id="@+id/seating_timer_minutes"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="match_parent"/>
|
||||||
<NumberPicker
|
<NumberPicker
|
||||||
android:id="@+id/seating_timer_seconds"
|
android:id="@+id/seating_timer_seconds"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="match_parent"/>
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/seating_set_timer"
|
android:id="@+id/seating_set_timer"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -77,14 +82,14 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/kitchen" />
|
android:text="@string/kitchen"
|
||||||
|
android:layout_marginLeft="5dp" />
|
||||||
|
|
||||||
<SeekBar
|
<SeekBar
|
||||||
android:id="@+id/kitchen_brightness"
|
android:id="@+id/kitchen_brightness"
|
||||||
|
@ -105,7 +110,7 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_gravity="start"
|
android:layout_gravity="start"
|
||||||
android:layout_height="90dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
android:text="@string/on" />
|
android:text="@string/on" />
|
||||||
|
|
||||||
|
@ -114,21 +119,22 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:layout_height="90dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
android:text="@string/off" />
|
android:text="@string/off" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center">
|
||||||
<NumberPicker
|
<NumberPicker
|
||||||
android:id="@+id/kitchen_timer_minutes"
|
android:id="@+id/kitchen_timer_minutes"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="match_parent"/>
|
||||||
<NumberPicker
|
<NumberPicker
|
||||||
android:id="@+id/kitchen_timer_seconds"
|
android:id="@+id/kitchen_timer_seconds"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="match_parent"/>
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/kitchen_set_timer"
|
android:id="@+id/kitchen_set_timer"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -141,14 +147,79 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/all" />
|
android:text="@string/bathroom"
|
||||||
|
android:layout_marginLeft="5dp" />
|
||||||
|
|
||||||
|
<SeekBar
|
||||||
|
android:id="@+id/bathroom_brightness"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:max="100"
|
||||||
|
android:progress="100" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/bathroom_on_button"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_gravity="start"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:text="@string/on" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/bathroom_off_button"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:text="@string/off" />
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center">
|
||||||
|
<NumberPicker
|
||||||
|
android:id="@+id/bathroom_timer_minutes"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
<NumberPicker
|
||||||
|
android:id="@+id/bathroom_timer_seconds"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/bathroom_set_timer"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:text="@string/set_timer" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/all"
|
||||||
|
android:layout_marginLeft="5dp" />
|
||||||
|
|
||||||
<SeekBar
|
<SeekBar
|
||||||
android:id="@+id/all_brightness"
|
android:id="@+id/all_brightness"
|
||||||
|
@ -169,7 +240,7 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_gravity="start"
|
android:layout_gravity="start"
|
||||||
android:layout_height="90dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
android:text="@string/on" />
|
android:text="@string/on" />
|
||||||
|
|
||||||
|
@ -178,21 +249,22 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:layout_height="90dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
android:text="@string/off" />
|
android:text="@string/off" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center">
|
||||||
<NumberPicker
|
<NumberPicker
|
||||||
android:id="@+id/all_timer_minutes"
|
android:id="@+id/all_timer_minutes"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="match_parent"/>
|
||||||
<NumberPicker
|
<NumberPicker
|
||||||
android:id="@+id/all_timer_seconds"
|
android:id="@+id/all_timer_seconds"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="match_parent"/>
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/all_set_timer"
|
android:id="@+id/all_set_timer"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -203,4 +275,5 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Add table
Add a link
Reference in a new issue