mirror of
https://github.com/vanitasvitae/Spherical
synced 2024-11-21 20:02:06 +01:00
Add tap gesture listener and toggle input mode on tap
This commit is contained in:
parent
a8b4e0ecb2
commit
64ed8b3d61
1 changed files with 20 additions and 0 deletions
|
@ -6,6 +6,9 @@ import android.net.Uri;
|
|||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
|
@ -37,6 +40,22 @@ public class MainActivity extends AppCompatActivity {
|
|||
renderer = new Renderer(surfaceView);
|
||||
setContentView(surfaceView);
|
||||
|
||||
// Detect gestures like single taps.
|
||||
final GestureDetector mGesDetect = new GestureDetector(this, new GestureDetector.SimpleOnGestureListener() {
|
||||
@Override
|
||||
public boolean onSingleTapConfirmed(MotionEvent event) {
|
||||
SphereSurfaceView.USE_TOUCH = !SphereSurfaceView.USE_TOUCH;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
surfaceView.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
return mGesDetect.onTouchEvent(event);
|
||||
}
|
||||
});
|
||||
|
||||
Intent intent = getIntent();
|
||||
switch (intent.getAction()) {
|
||||
//Image was sent into the app
|
||||
|
@ -142,4 +161,5 @@ public class MainActivity extends AppCompatActivity {
|
|||
private void displayFlatImage(InputStream inputStream) {
|
||||
Log.d(TAG, "Display Flat Image!");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue