diff --git a/app/src/main/java/org/ntlab/radishforandroidstudio/sample/SampleActivity.java b/app/src/main/java/org/ntlab/radishforandroidstudio/sample/SampleActivity.java index c5b9541..28c21ac 100644 --- a/app/src/main/java/org/ntlab/radishforandroidstudio/sample/SampleActivity.java +++ b/app/src/main/java/org/ntlab/radishforandroidstudio/sample/SampleActivity.java @@ -5,6 +5,7 @@ import android.os.Bundle; import android.view.MotionEvent; import android.view.View; +import android.widget.Button; import android.widget.LinearLayout; import org.ntlab.radishforandroidstudio.R; @@ -99,6 +100,24 @@ camera.setFieldOfView(1.5); camera.setBackClipDistance(10000.0); start(1000L, 50L, true); + + + //top-button操作 + Button top_button = findViewById(R.id.top_button); + top_button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + System.out.println("top-button"); + } + }); + //down-button操作 + Button down_button = findViewById(R.id.down_button); + down_button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + System.out.println("down-button"); + } + }); } @Override @@ -123,6 +142,7 @@ public boolean onTouchEvent(MotionEvent event){ super.onTouchEvent(event); + //ACTION_MOVE:タッチしたまま移動,ACTION_DOWN:タッチダウン if (event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_MOVE) { isTouched = true; float maxX = event.getDevice().getMotionRange(MotionEvent.AXIS_X).getMax(); @@ -131,8 +151,10 @@ float minY = event.getDevice().getMotionRange(MotionEvent.AXIS_Y).getMin(); touchX = (event.getX() - minX) / (maxX - minX); touchY = (event.getY() - minY) / (maxY - minY); + System.out.println("touch"); } else if (event.getAction() == MotionEvent.ACTION_UP) { isTouched = false; + System.out.println("Not-touch"); } return true; }