Die Buttons umbennant.

This commit is contained in:
Tim Schumacher 2015-01-27 08:34:09 +01:00
parent c66fa6cd32
commit 80e03d1cb7
2 changed files with 32 additions and 24 deletions

View file

@ -23,20 +23,20 @@ public class DerivBroadcastReceiver extends BroadcastReceiver {
NetworkInfo nwInfo = intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO); NetworkInfo nwInfo = intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
if (nwInfo.getExtraInfo().equals(MainActivity.networkSSID) && nwInfo.isConnected()) { if (nwInfo.getExtraInfo().equals(MainActivity.networkSSID) && nwInfo.isConnected()) {
View rootView = ((Activity)context).getWindow().getDecorView().findViewById(android.R.id.content); View rootView = ((Activity)context).getWindow().getDecorView().findViewById(android.R.id.content);
Button button = (Button) rootView.findViewById(R.id.button2); Button button = (Button) rootView.findViewById(R.id.button_buzzer);
button.setEnabled(true); button.setEnabled(true);
button = (Button) rootView.findViewById(R.id.button3); button = (Button) rootView.findViewById(R.id.button_door_unlock);
button.setEnabled(true); button.setEnabled(true);
button = (Button) rootView.findViewById(R.id.button); button = (Button) rootView.findViewById(R.id.button_door_open);
button.setEnabled(true); button.setEnabled(true);
Toast.makeText(context, context.getString(R.string.wlan_connected), Toast.LENGTH_SHORT).show(); Toast.makeText(context, context.getString(R.string.wlan_connected), Toast.LENGTH_SHORT).show();
} else { } else {
View rootView = ((Activity)context).getWindow().getDecorView().findViewById(android.R.id.content); View rootView = ((Activity)context).getWindow().getDecorView().findViewById(android.R.id.content);
Button button = (Button) rootView.findViewById(R.id.button2); Button button = (Button) rootView.findViewById(R.id.button_buzzer);
button.setEnabled(false); button.setEnabled(false);
button = (Button) rootView.findViewById(R.id.button3); button = (Button) rootView.findViewById(R.id.button_door_unlock);
button.setEnabled(false); button.setEnabled(false);
button = (Button) rootView.findViewById(R.id.button); button = (Button) rootView.findViewById(R.id.button_door_open);
button.setEnabled(false); button.setEnabled(false);
} }
} }

View file

@ -37,25 +37,33 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/button_outer_door" android:text="@string/button_outer_door"
android:id="@+id/button3" android:id="@+id/button_buzzer"
android:onClick="buttonOpenOuterDoor" android:enabled="false"
android:clickable="false" android:onClick="buttonOpenOuterDoor" />
android:enabled="false" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<Button <Button
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/button_inner_door" android:text="@string/button_inner_door"
android:id="@+id/button2" android:id="@+id/button_door_unlock"
android:onClick="buttonOpenInnerDoor" android:onClick="buttonOpenInnerDoor"
android:enabled="false" /> android:enabled="false" />
<Button <Button
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/button" android:id="@+id/button_door_open"
android:text="@string/button_inner_door_open" android:text="@string/button_inner_door_open"
android:enabled="false" /> android:enabled="false"
android:onClick="buttonUnlockInnerDoor" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>