Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
XenGi committed Jan 28, 2015
2 parents 9005833 + 2c34b8f commit cfae1ff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0.0"
versionName "1.1.0"
}
buildTypes {
release {
Expand Down
14 changes: 12 additions & 2 deletions app/src/main/java/org/c_base/pymlgame/controller/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.c_base.pymlgame.controller;

import android.content.Context;
import android.graphics.Rect;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
Expand All @@ -9,6 +10,7 @@
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.os.Vibrator;

import java.io.IOException;
import java.net.DatagramPacket;
Expand Down Expand Up @@ -135,6 +137,8 @@ public void run() {
@InjectView(R.id.buttonMenu)
ImageView buttonMenu;

Vibrator vibrator;

String buttonStates = "00000000000000";
String tempButtonStates = "00000000000000";

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

vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);

ButterKnife.inject(this);

getWindow().getDecorView().findViewById(android.R.id.content).setOnTouchListener(new View.OnTouchListener() {
Expand Down Expand Up @@ -179,9 +185,13 @@ private void checkView(View v, MotionEvent ev, int position, int index) {
if(contains) {
if(ev.getAction() == MotionEvent.ACTION_UP) {
tempButtonStates = tempButtonStates.substring(0, position) + "0" + tempButtonStates.substring(position + 1);
return;
}
tempButtonStates = tempButtonStates.substring(0, position) + "1" + tempButtonStates.substring(position + 1);
else {
if (vibrator.hasVibrator() && buttonStates.charAt(position) == '0') {
vibrator.vibrate(20);
}
tempButtonStates = tempButtonStates.substring(0, position) + "1" + tempButtonStates.substring(position + 1);
}
}
}
}

0 comments on commit cfae1ff

Please sign in to comment.