Android Open Source - RemoteControl Keyboard Activity






From Project

Back to project page RemoteControl.

License

The source code is released under:

MIT License

If you think the Android project RemoteControl listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package ch.sebastianhaeni.remotecontrol;
/*from w  w  w  . j  a  v  a 2s  . co m*/
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.Menu;
import android.view.MenuItem;

public class KeyboardActivity extends Activity {

  private String _ipAddress;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_keyboard);

    Intent intent = getIntent();
    _ipAddress = intent.getStringExtra("SERVER");

    final MyEditText text = (MyEditText) findViewById(R.id.keyboard_input);
    text.setIpAddress(_ipAddress);

    text.addTextChangedListener(new TextWatcher() {

      @Override
      public void onTextChanged(CharSequence s, int start, int before, int count) {

      }

      @Override
      public void beforeTextChanged(CharSequence s, int start, int count, int after) {

      }

      @Override
      public void afterTextChanged(Editable s) {
        if (s.toString().isEmpty()) {
          return;
        }
        (new NetworkThread(KeyboardActivity.this, _ipAddress, "keyboard:" + s.toString(), "KEYBOARD_SET")).start();
        text.setText("");
      }
    });
  }

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
  }

  @Override
  public boolean onMenuItemSelected(int featureId, MenuItem item) {
    return VolumeActivity.handleMenuItemSelected(this, _ipAddress, featureId, item);
  }

}




Java Source Code List

ch.sebastianhaeni.remotecontrol.KeyboardActivity.java
ch.sebastianhaeni.remotecontrol.MouseActivity.java
ch.sebastianhaeni.remotecontrol.MyEditText.java
ch.sebastianhaeni.remotecontrol.NetworkThread.java
ch.sebastianhaeni.remotecontrol.ServerSelectionActivity.java
ch.sebastianhaeni.remotecontrol.UDPListenerService.java
ch.sebastianhaeni.remotecontrol.VolumeActivity.java