@Override public boolean onTouchEvent(MotionEvent event) { if (event.getX() > 300) { tpad.send(1f); } else tpad.send(0f); return super.onTouchEvent(event); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tpad_start); // start the new tpad server for our tpad object tpad.startTPad(this, tpadFreq); DebugText = (TextView) findViewById(R.id.DebugText); ComboButton = (ImageButton) findViewById(R.id.ComboButton); BlueBallButton = (ImageButton) findViewById(R.id.BlueBallButton); BitmapButton = (ImageButton) findViewById(R.id.BitmapButton); GlassCleanButton = (ImageButton) findViewById(R.id.GlassButton); TextureButton = (ImageButton) findViewById(R.id.TextureButton); AudioButton = (ImageButton) findViewById(R.id.AudioButton); UpButton = (Button) findViewById(R.id.UpF); DownButton = (Button) findViewById(R.id.DownF); Slider = (SlidingDrawer) findViewById(R.id.slidingDrawer1); myTPadDrawer = new TPadDrawer(tpad, Slider, height, rampwidth, buttonoffset); UpButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { tpadFreq += 30; DebugText.setText("TPad Freq: " + String.valueOf(tpadFreq)); tpad.freq(tpadFreq); } }); DownButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { tpadFreq += -30; DebugText.setText("TPad Freq: " + String.valueOf(tpadFreq)); tpad.freq(tpadFreq); } }); // Open touchscreen activity ComboButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent("nxr.tpaddemo.COMBO"); startActivity(intent); } }); // Open touchscreen activity BlueBallButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Slider.animateClose(); Intent intent = new Intent("nxr.tpaddemo.BALL"); startActivity(intent); } }); // Open touchscreen activity BitmapButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Slider.animateClose(); Intent intent = new Intent("nxr.tpaddemo.BITMAP"); startActivity(intent); } }); GlassCleanButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Slider.animateClose(); Intent intent = new Intent("nxr.tpaddemo.GLASS"); startActivity(intent); } }); AudioButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Slider.animateClose(); Intent intent = new Intent("nxr.tpaddemo.AUDIO"); startActivity(intent); } }); TextureButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Slider.animateClose(); Intent intent = new Intent("nxr.tpaddemo.TEXTURE"); startActivity(intent); } }); }
@Override protected void onDestroy() { tpad.stopTPad(); super.onDestroy(); }