Skip to content

Commit c3a12c1

Browse files
committed
more buttons
1 parent 7ad13e3 commit c3a12c1

File tree

2 files changed

+56
-16
lines changed

2 files changed

+56
-16
lines changed

app/src/main/java/org/ligi/pmlctrl/MainActivity.java

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,31 @@ public void run() {
135135
@InjectView(R.id.right)
136136
ImageView right;
137137

138-
@InjectView(R.id.container)
139-
ViewGroup container;
138+
@InjectView(R.id.buttonA)
139+
ImageView buttonA;
140+
141+
142+
@InjectView(R.id.buttonB)
143+
ImageView buttonB;
144+
145+
146+
@InjectView(R.id.buttonX)
147+
ImageView buttonX;
148+
149+
150+
@InjectView(R.id.buttonY)
151+
ImageView buttonY;
152+
153+
@InjectView(R.id.buttonStart)
154+
ImageView buttonStart;
155+
156+
@InjectView(R.id.buttonSelect)
157+
ImageView buttonSelect;
158+
159+
@InjectView(R.id.buttonMenu)
160+
ImageView buttonMenu;
161+
162+
140163

141164
String buttonStates = "00000000000000";
142165
String tempButtonStates = "00000000000000";
@@ -157,6 +180,16 @@ public boolean onTouch(View v, MotionEvent event) {
157180
checkView(down, event, 1, i);
158181
checkView(left, event, 2, i);
159182
checkView(right, event, 3, i);
183+
checkView(buttonA, event, 4, i);
184+
checkView(buttonB, event, 5, i);
185+
checkView(buttonX, event, 6, i);
186+
checkView(buttonY, event, 7, i);
187+
checkView(buttonStart, event, 8, i);
188+
checkView(buttonSelect, event, 9, i);
189+
checkView(buttonMenu, event, 10, i);
190+
checkView(buttonMenu, event, 11, i);
191+
checkView(buttonMenu, event, 12, i);
192+
checkView(buttonMenu, event, 13, i);
160193
}
161194

162195
buttonStates = tempButtonStates;

app/src/main/res/layout/activity_main.xml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,24 @@
5151
android:layout_weight="2"
5252
android:layout_height="match_parent"
5353
/>
54-
<Button
54+
<ImageView
5555
android:layout_width="0dp"
5656
android:layout_weight="1"
57-
android:layout_height="wrap_content"
58-
android:text="Menu"
57+
android:layout_height="match_parent"
58+
android:src="@drawable/ic_launcher"
59+
android:id="@+id/buttonMenu"
5960
/>
6061
<View
6162
android:layout_width="0dp"
6263
android:layout_weight="2"
6364
android:layout_height="1dp"
6465
/>
65-
<Button
66+
<ImageView
6667
android:layout_width="0dp"
6768
android:layout_weight="1"
68-
android:layout_height="wrap_content"
69-
android:text="Y"
69+
android:layout_height="match_parent"
70+
android:src="@drawable/ic_launcher"
71+
android:id="@+id/buttonY"
7072
/>
7173
<View
7274
android:layout_width="0dp"
@@ -111,6 +113,7 @@
111113
android:layout_weight="1"
112114
android:layout_height="match_parent"
113115
android:src="@drawable/ic_launcher"
116+
android:id="@+id/buttonX"
114117
/>
115118
<View
116119
android:layout_width="0dp"
@@ -120,8 +123,9 @@
120123
<ImageView
121124
android:layout_width="0dp"
122125
android:layout_weight="1"
123-
android:layout_height="wrap_content"
124-
android:text="B"
126+
android:layout_height="match_parent"
127+
android:src="@drawable/ic_launcher"
128+
android:id="@+id/buttonB"
125129
/>
126130

127131
</LinearLayout>
@@ -155,8 +159,9 @@
155159
<ImageView
156160
android:layout_width="0dp"
157161
android:layout_weight="1"
158-
android:layout_height="wrap_content"
162+
android:layout_height="match_parent"
159163
android:src="@drawable/ic_launcher"
164+
android:id="@+id/buttonSelect"
160165
/>
161166

162167
<View
@@ -168,19 +173,21 @@
168173
<ImageView
169174
android:layout_width="0dp"
170175
android:layout_weight="1"
171-
android:layout_height="wrap_content"
172-
176+
android:layout_height="match_parent"
177+
android:src="@drawable/ic_launcher"
178+
android:id="@+id/buttonStart"
173179
/>
174180
<View
175181
android:layout_width="0dp"
176182
android:layout_weight="1"
177183
android:layout_height="1dp"
178184
/>
179-
<Button
185+
<ImageView
180186
android:layout_width="0dp"
181187
android:layout_weight="1"
182-
android:layout_height="wrap_content"
183-
android:text="B"
188+
android:layout_height="match_parent"
189+
android:src="@drawable/ic_launcher"
190+
android:id="@+id/buttonA"
184191
/>
185192
<View
186193
android:layout_width="0dp"

0 commit comments

Comments
 (0)