Skip to content

Commit c8797de

Browse files
committed
Lightswitch example a bit restructured
1 parent 5c4a89f commit c8797de

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

com.vogella.android.drawable.lightswitch/res/layout/main.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="fill_parent"
4-
android:layout_height="?android:attr/listPreferredItemHeight"
4+
android:layout_height="fill_parent"
55
android:gravity="center"
66
android:orientation="vertical" >
77

com.vogella.android.drawable.lightswitch/src/com/vogella/android/drawable/lightswitch/LightSwitchActivity.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.app.Activity;
55
import android.graphics.drawable.TransitionDrawable;
66
import android.os.Bundle;
7+
import android.util.Log;
78
import android.view.View;
89
import android.view.View.OnClickListener;
910
import android.widget.ImageView;
@@ -15,7 +16,9 @@ public class LightSwitchActivity extends Activity {
1516
public void onCreate(final Bundle savedInstanceState) {
1617
super.onCreate(savedInstanceState);
1718
setContentView(R.layout.main);
18-
19+
if (BuildConfig.DEBUG) {
20+
Log.i("CATEGORY", "AHHHHH!!!");
21+
}
1922

2023
final ImageView image = (ImageView) findViewById(R.id.image);
2124
final ToggleButton button = (ToggleButton) findViewById(R.id.button);

com.vogella.android.userinterface.undo/res/layout/activity_main.xml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,24 @@
33
android:layout_width="match_parent"
44
android:layout_height="match_parent" >
55

6-
<RelativeLayout
6+
<ListView
7+
android:id="@+id/listview"
78
android:layout_width="match_parent"
8-
android:layout_height="match_parent"
9-
tools:context=".MainActivity" >
10-
11-
<ListView
12-
android:id="@+id/listview"
13-
android:layout_width="match_parent"
14-
android:layout_height="match_parent" >
15-
</ListView>
16-
</RelativeLayout>
9+
android:layout_height="match_parent" >
10+
</ListView>
1711

1812
<LinearLayout
1913
android:id="@+id/undobar"
20-
android:visibility="gone"
2114
android:layout_width="wrap_content"
2215
android:layout_height="wrap_content"
2316
android:layout_gravity="bottom|center_horizontal"
2417
android:layout_margin="20dp"
2518
android:alpha="100"
2619
android:background="#808080"
2720
android:dividerPadding="11dp"
28-
android:padding="4dp" >
21+
android:padding="4dp"
22+
android:visibility="gone"
23+
>
2924

3025
<TextView
3126
android:id="@+id/undobar_message"
@@ -40,9 +35,9 @@
4035
android:layout_width="wrap_content"
4136
android:layout_height="wrap_content"
4237
android:layout_marginLeft="30dp"
43-
android:onClick="onClick"
4438
android:background="#808080"
4539
android:drawableLeft="@drawable/ic_undobar_undo"
40+
android:onClick="onClick"
4641
android:text="Undo"
4742
android:textAppearance="?android:attr/textAppearanceMedium"
4843
android:textColor="#fff" />

0 commit comments

Comments
 (0)