Android Open Source - CipherChat Choose Server Activity






From Project

Back to project page CipherChat.

License

The source code is released under:

MIT License

If you think the Android project CipherChat 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 com.ist.cipherchat.gui;
/*  w  w  w  .  j av a2 s  .c o m*/
import com.ist.cipherchat.R;
import com.ist.cipherchat.networking.Globals;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;


public class ChooseServerActivity extends Activity
{
   public final static String EXTRA_SERVER_IP = "com.ist.cryptochat.SERVER_IP";
   public final static String EXTRA_SERVER_PORT = "com.ist.cryptochat.SERVER_PORT";
   public static final String EXTRA_USERNAME = "com.ist.cryptochat.USERNAME";
   public static final String EXTRA_PASSWORD = "com.ist.cryptochat.PASSWORD";
   public static final String EXTRA_OPTION = "com.ist.cryptochat.OPTION"; 
   
  
  @Override
  protected void onCreate(Bundle savedInstanceState)
  {    
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_choose_server);
        
    EditText serverIPText = (EditText) findViewById(R.id.ServerIpText);
    serverIPText.setText("192.168.186.51");
      EditText serverPortText = (EditText) findViewById(R.id.serverPortEdit);
      serverPortText.setText("1337");
  }

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

  public void connectToServer(View view)
  {
    // Create intent to start the main window
      Intent intent = new Intent(this, Contacts.class);
      
      // Get server IP
      EditText serverIPText = (EditText) findViewById(R.id.ServerIpText);
      String serverIP = serverIPText.getText().toString();
      intent.putExtra(EXTRA_SERVER_IP, serverIP);
      
      // Get server port
      EditText serverPortText = (EditText) findViewById(R.id.serverPortEdit);
      String serverPort = serverPortText.getText().toString();
      intent.putExtra(EXTRA_SERVER_PORT, serverPort);
      
      //Get user name and password
      EditText usernameText = (EditText) findViewById(R.id.UsernameTextField);
      String username = usernameText.getText().toString();
      intent.putExtra(EXTRA_USERNAME, username);
      
      EditText passwordText = (EditText) findViewById(R.id.PasswordTextField);
      String password = passwordText.getText().toString();
      intent.putExtra(EXTRA_PASSWORD, password);
      
      // get radio buttons
      RadioGroup radio = (RadioGroup) findViewById(R.id.radioGroup);
      int radioId = radio.getCheckedRadioButtonId();
      
      RadioButton radioButton = (RadioButton) findViewById(radioId);
            
      intent.putExtra(EXTRA_OPTION, radioButton.getText().toString());
      
      // Send IP and port to main window, so it can connect to server
      startActivityForResult(intent, 666);
     

  }
}




Java Source Code List

com.desperate.AdminConsole.java
com.desperate.ClientHandler.java
com.desperate.CryptoServer.java
com.desperate.UserDatabase.java
com.desperate.User.java
com.desperate.common.Message.java
com.desperate.common.NoncePacket.java
com.desperate.common.SessionKeyRequestInfo.java
com.desperate.common.TestCipherSerializable.java
com.desperate.common.Utilities.java
com.desperate.common.messages.ChatMessage.java
com.desperate.common.messages.IPMessage.java
com.desperate.common.messages.LoginMessage.java
com.desperate.common.messages.LogoutMessage.java
com.desperate.common.messages.RegisterMessage.java
com.desperate.common.messages.SessionKeyRequestMessage.java
com.desperate.common.messages.StartChatMessage.java
com.desperate.common.messages.UserListMessage.java
com.desperate.common.replies.CheckSessionMessage.java
com.desperate.common.replies.IPReplyMessage.java
com.desperate.common.replies.LoginReplyMessage.java
com.desperate.common.replies.LogoutReplyMessage.java
com.desperate.common.replies.NeedhamSchroederSuccessReply.java
com.desperate.common.replies.RegisterReplyMessage.java
com.desperate.common.replies.ReplyMessage.java
com.desperate.common.replies.SessionKeyReplyMessage.java
com.desperate.common.replies.StartChatReply.java
com.desperate.common.replies.UserListReplyMessage.java
com.desperate.debug.DebugClient.java
com.desperate.debug.DebugCryptoClient.java
com.desperate.debug.PlainServer.java
com.ist.cipherchat.gui.ChatActivity.java
com.ist.cipherchat.gui.ChooseServerActivity.java
com.ist.cipherchat.gui.Contacts.java
com.ist.cipherchat.gui.Origin.java
com.ist.cipherchat.networking.ChatActivityRunnable.java
com.ist.cipherchat.networking.ChatInRunnable.java
com.ist.cipherchat.networking.ChatOutHandler.java
com.ist.cipherchat.networking.Core.java
com.ist.cipherchat.networking.Globals.java
com.ist.cipherchat.networking.OutputSocketHandler.java
com.ist.cipherchat.networking.PhoneServerSocketHandler.java
com.ist.cipherchat.networking.ThreadComm.java