Android Open Source - Alkomer Registration Activity






From Project

Back to project page Alkomer.

License

The source code is released under:

MIT License

If you think the Android project Alkomer 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 cz.jmx.tomik.alkomer.android;
//from  ww  w  .  j  a  v  a2s . c o  m
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import cz.jmx.tomik.alkomer.android.threads.RegistrationAsyncTask;
import cz.jmx.tomik.alkomer.android.tools.EmailValidator;

/**
 * Alkomer - Server App
 * --------------------
 * Registration Form Activity
 *
 * @copyright   Copyright (c) 2011 Tomas Vitek
 * @author      Tomas Vitek ~ http://tomik.jmx.cz

 * @package     Alkomer
 * @version     1.0
 */
public class RegistrationActivity extends BaseActivity {
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.registration);
        this.title.setText("Registrace");        
        
        Button reg = (Button) findViewById(R.id.regbtn);
        reg.setOnClickListener(new OnClickListener() {
      
      @Override
      public void onClick(View arg0) {

        TextView utext = (TextView) findViewById(R.id.email);
        TextView ptext = (TextView) findViewById(R.id.password);
        TextView p2text = (TextView) findViewById(R.id.password2);
        
        String email = utext.getText().toString();
        String password = ptext.getText().toString();
        String password2 = p2text.getText().toString();
        
        if (EmailValidator.validate(email)) {        
          if (password != password2) {
            if (!password.equals("")) {
              String[] data = {email, password};          
              new RegistrationAsyncTask(RegistrationActivity.this).execute(data);
            }
            else {
              Toast.makeText(RegistrationActivity.this, "Heslo nesm? b?t pr?zdn?!", Toast.LENGTH_LONG).show();
            }              
          }
          else {
            Toast.makeText(RegistrationActivity.this, "Ob? hesla se mus? rovnat!", Toast.LENGTH_LONG).show();
          }
        }
        else {
          Toast.makeText(RegistrationActivity.this, "Zadejte platn? email!", Toast.LENGTH_LONG).show();
        }
        
      }
    });        
    }
    
    @Override
    public void onResume() {
      super.onResume();
      
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    String email = prefs.getString("email", "");
    
    if (!email.equals("")) {
          finish();
    }
    }
    
}




Java Source Code List

cz.jmx.tomik.alkomer.android.BaseActivity.java
cz.jmx.tomik.alkomer.android.DashboardActivity.java
cz.jmx.tomik.alkomer.android.DrinkListActivity.java
cz.jmx.tomik.alkomer.android.ForgottenPasswordActivity.java
cz.jmx.tomik.alkomer.android.GlassListActivity.java
cz.jmx.tomik.alkomer.android.LoginActivity.java
cz.jmx.tomik.alkomer.android.Main.java
cz.jmx.tomik.alkomer.android.RegistrationActivity.java
cz.jmx.tomik.alkomer.android.SettingsActivity.java
cz.jmx.tomik.alkomer.android.StatisticsActivity.java
cz.jmx.tomik.alkomer.android.StatisticsFlowAdapter.java
cz.jmx.tomik.alkomer.android.database.DataHelper.java
cz.jmx.tomik.alkomer.android.drinks.DrinkAdapter.java
cz.jmx.tomik.alkomer.android.drinks.Drink.java
cz.jmx.tomik.alkomer.android.drinks.Drinks.java
cz.jmx.tomik.alkomer.android.drinks.GlassAdapter.java
cz.jmx.tomik.alkomer.android.drinks.Glass.java
cz.jmx.tomik.alkomer.android.models.Gender.java
cz.jmx.tomik.alkomer.android.models.User.java
cz.jmx.tomik.alkomer.android.threads.DeleteDrinkThread.java
cz.jmx.tomik.alkomer.android.threads.DeleteDrinksThread.java
cz.jmx.tomik.alkomer.android.threads.DrinkThread.java
cz.jmx.tomik.alkomer.android.threads.ForgottenPasswordAsyncTask.java
cz.jmx.tomik.alkomer.android.threads.ImageDownloadAsyncTask.java
cz.jmx.tomik.alkomer.android.threads.LoginAsyncTask.java
cz.jmx.tomik.alkomer.android.threads.RegistrationAsyncTask.java
cz.jmx.tomik.alkomer.android.threads.UpdateSettingsThread.java
cz.jmx.tomik.alkomer.android.tools.Calculator.java
cz.jmx.tomik.alkomer.android.tools.DataTime.java
cz.jmx.tomik.alkomer.android.tools.EmailValidator.java
cz.jmx.tomik.alkomer.android.tools.IntEditTextPreference.java