Skip to content

Commit cfae1ff

Browse files
author
XenGi
committed
Merge branch 'release/1.1.0'
2 parents 9005833 + 2c34b8f commit cfae1ff

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ android {
99
minSdkVersion 15
1010
targetSdkVersion 21
1111
versionCode 1
12-
versionName "1.0.0"
12+
versionName "1.1.0"
1313
}
1414
buildTypes {
1515
release {

app/src/main/java/org/c_base/pymlgame/controller/MainActivity.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.c_base.pymlgame.controller;
22

3+
import android.content.Context;
34
import android.graphics.Rect;
45
import android.os.Bundle;
56
import android.support.v7.app.ActionBarActivity;
@@ -9,6 +10,7 @@
910
import android.view.ViewGroup;
1011
import android.widget.EditText;
1112
import android.widget.ImageView;
13+
import android.os.Vibrator;
1214

1315
import java.io.IOException;
1416
import java.net.DatagramPacket;
@@ -135,6 +137,8 @@ public void run() {
135137
@InjectView(R.id.buttonMenu)
136138
ImageView buttonMenu;
137139

140+
Vibrator vibrator;
141+
138142
String buttonStates = "00000000000000";
139143
String tempButtonStates = "00000000000000";
140144

@@ -143,6 +147,8 @@ protected void onCreate(Bundle savedInstanceState) {
143147
super.onCreate(savedInstanceState);
144148
setContentView(R.layout.activity_main);
145149

150+
vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
151+
146152
ButterKnife.inject(this);
147153

148154
getWindow().getDecorView().findViewById(android.R.id.content).setOnTouchListener(new View.OnTouchListener() {
@@ -179,9 +185,13 @@ private void checkView(View v, MotionEvent ev, int position, int index) {
179185
if(contains) {
180186
if(ev.getAction() == MotionEvent.ACTION_UP) {
181187
tempButtonStates = tempButtonStates.substring(0, position) + "0" + tempButtonStates.substring(position + 1);
182-
return;
183188
}
184-
tempButtonStates = tempButtonStates.substring(0, position) + "1" + tempButtonStates.substring(position + 1);
189+
else {
190+
if (vibrator.hasVibrator() && buttonStates.charAt(position) == '0') {
191+
vibrator.vibrate(20);
192+
}
193+
tempButtonStates = tempButtonStates.substring(0, position) + "1" + tempButtonStates.substring(position + 1);
194+
}
185195
}
186196
}
187197
}

0 commit comments

Comments
 (0)