fix delete_edit optimize segv, add dump submenu/dump_undo, add dbl edge drag/drop...
[goodguy/cinelerra.git] / CineRmt / src / main / java / com / local / cinermt / ConfigActivity.java
1 package com.local.cinermt;
2
3 import android.app.Activity;
4 import android.content.Intent;
5 import android.os.Bundle;
6 import android.view.Menu;
7 import android.view.MenuItem;
8 import android.view.View;
9 import android.view.View.OnClickListener;
10 import android.widget.Button;
11 import android.widget.EditText;
12
13 public class ConfigActivity extends Activity implements OnClickListener {
14         String ip_addr;
15         String pin;
16         int port;
17         EditText etxt_ip_addr;
18         EditText etxt_pin;
19         EditText etxt_port;
20
21         @Override
22         protected void onCreate(Bundle b) {
23                 super.onCreate(b);
24                 
25                 Intent it = getIntent();
26                 ip_addr = it.getStringExtra("IP_ADDR");
27                 pin = it.getStringExtra("PIN");
28                 port = it.getIntExtra("PORT",0);
29
30                 setContentView(R.layout.activity_config);
31                 etxt_ip_addr = (EditText)findViewById(R.id.ip_addr);
32                 etxt_pin = (EditText)findViewById(R.id.pin);
33                 etxt_port = (EditText)findViewById(R.id.port);
34
35                 etxt_ip_addr.setText(ip_addr);
36                 etxt_pin.setText(pin);
37                 etxt_port.setText(String.format("%d", port));
38                 
39                 Button btn = (Button)findViewById(R.id.back);
40                 btn.setOnClickListener(this);
41         }
42
43         @Override
44         public boolean onCreateOptionsMenu(Menu menu) {
45                 getMenuInflater().inflate(R.menu.menu_main, menu);
46                 return true;
47         }
48
49         @Override
50         public void onClick(View v) {   
51         if (v instanceof Button) {
52             int id = ((Button)v).getId();
53                         if (id == R.id.back) {
54                                 ip_addr = etxt_ip_addr.getText().toString();
55                                 pin = etxt_pin.getText().toString();
56                                 try {
57                                         port = Integer.valueOf(etxt_port.getText().toString());
58                                 } catch(Exception e) { port = 0; }
59                                 
60                                 Intent it = new Intent(this,MainActivity.class);
61                                 it.putExtra("IP_ADDR", ip_addr);
62                                 it.putExtra("PIN", pin);
63                                 it.putExtra("PORT", port);
64                                 startActivity(it);
65                                 finish();
66                         }
67         }
68         }
69
70         @Override
71         public boolean onOptionsItemSelected(MenuItem item) {
72                 super.onOptionsItemSelected(item);
73                 int id = item.getItemId();
74                 if (id == R.id.menu_exit) {
75                         finish();
76                         return true;
77                 }
78                 return false;
79         }
80 }