Example #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.pickup_uri);

    // Set window size
    //		LayoutParams params = getWindow().getAttributes();
    //		params.width = LayoutParams.FILL_PARENT;
    //		getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);

    // Set title
    // TODO -- use dialog instead
    //		((TextView) findViewById(R.id.my_title)).setText(R.string.pickup_sip_uri);
    //		((ImageView) findViewById(R.id.my_icon)).setImageResource(android.R.drawable.ic_menu_call);

    okBtn = (Button) findViewById(R.id.ok);
    okBtn.setOnClickListener(this);
    Button btn = (Button) findViewById(R.id.cancel);
    btn.setOnClickListener(this);

    sipUri = (EditSipUri) findViewById(R.id.sip_uri);
    sipUri
        .getTextField()
        .setOnEditorActionListener(
            new OnEditorActionListener() {
              @Override
              public boolean onEditorAction(TextView tv, int action, KeyEvent arg2) {
                if (action == EditorInfo.IME_ACTION_GO) {
                  sendPositiveResult();
                  return true;
                }
                return false;
              }
            });
    sipUri.setShowExternals(false);
  }
Example #2
0
 private void sendPositiveResult() {
   Intent resultValue = new Intent();
   ToCall result = sipUri.getValue();
   if (result != null) {
     // Restore existing extras.
     Intent it = getIntent();
     if (it != null) {
       Bundle b = it.getExtras();
       if (b != null) {
         resultValue.putExtras(b);
       }
     }
     resultValue.putExtra(Intent.EXTRA_PHONE_NUMBER, result.getCallee());
     resultValue.putExtra(SipProfile.FIELD_ID, result.getAccountId());
     setResult(RESULT_OK, resultValue);
   } else {
     setResult(RESULT_CANCELED);
   }
   finish();
 }