Android Open Source - interamap Authorization Screen






From Project

Back to project page interamap.

License

The source code is released under:

MIT License

If you think the Android project interamap 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.richso.interamap;
/*from  ww  w. j  a v a  2 s . c  o  m*/
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import com.richso.interamap.utils.Constant;
import com.richso.interamap.utils.L;

/**
 * Created with IntelliJ IDEA.
 * User: nikolai
 * Date: 10.09.13
 * Time: 13:58
 * To change this template use File | Settings | File Templates.
 */
public class AuthorizationScreen extends BaseActivity implements View.OnClickListener{

    private LinearLayout linearAuth;
    private Button btnSignUp;
    private Button btnLogin;
    private EditText username;
    private EditText password;

    {
        L.setTag(this.getClass().getName());
    }

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

    private void init() {
        linearAuth = (LinearLayout)findViewById(R.id.linearAuth);
        username = (EditText)findViewById(R.id.usernameEditText);
        password = (EditText)findViewById(R.id.passwordEditText);

        btnLogin = (Button)findViewById(R.id.loginAuth);
        btnLogin.setOnClickListener(this);

        btnSignUp = (Button)findViewById(R.id.signUpAuth);
        btnSignUp.setOnClickListener(this);
    }

    @Override
    public void onBackPressed() {
        showWarningDialog(R.string.title_info, R.string.message, R.string.yes, R.string.no, R.string.cancel);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.loginAuth:
                openHomeScreen();
                break;
            case R.id.signUpAuth:
                openRegistrationScreen();
                break;
            default:break;
        }
    }

    private boolean preConditionLogin() {
        String userText = null;
        userText = username.getText().toString();
        if( userText != null && userText.length() > 0) {
            return true;
        } else {
            showWarningDialog(R.string.dialog_title_login, R.string.dialog_message_login, 0, 0, R.string.dialog_cancel);
        }
        return false;
    }

    private void openRegistrationScreen() {
        Intent intent = new Intent(AuthorizationScreen.this, RegistrationScreen.class);
        startActivity(intent);
    }

    private void openHomeScreen() {
        if( preConditionLogin() ) {
            Intent intent = new Intent(AuthorizationScreen.this, HomeScreen.class);
            intent.putExtra(Constant.Extra.username, username.getText().toString());
            startActivity(intent);
        }
    }
}




Java Source Code List

com.richso.interamap.AuthorizationScreen.java
com.richso.interamap.BaseActivity.java
com.richso.interamap.CategoryScreen.java
com.richso.interamap.HomeScreen.java
com.richso.interamap.MapScreen.java
com.richso.interamap.MoreInfoScreen.java
com.richso.interamap.RegistrationScreen.java
com.richso.interamap.SplashScreen.java
com.richso.interamap.adapter.CategoryAdapter.java
com.richso.interamap.adapter.ImageAdapter.java
com.richso.interamap.adapter.MarkerInfoAdapter.java
com.richso.interamap.dialogue.WarningDialog.java
com.richso.interamap.item.Category.java
com.richso.interamap.item.ItemCategory.java
com.richso.interamap.utils.Constant.java
com.richso.interamap.utils.Device.java
com.richso.interamap.utils.L.java
com.richso.interamap.view.MapFragment.java