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

    LayoutInflater inflater = LayoutInflater.from(this.getBaseContext());
    View actionBarView = inflater.inflate(R.layout.actionbar_view3, null);

    getActionBar().setDisplayShowTitleEnabled(false);
    getActionBar().setDisplayShowCustomEnabled(true);
    getActionBar().setCustomView(actionBarView);
    Button upButton = (Button) getActionBar().getCustomView().findViewById(R.id.myUpButton);
    upButton.setText(getTitle());
    final Activity act = this;
    upButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            NavUtils.navigateUpFromSameTask(act);
          }
        });

    // Set up the login form.
    mEmailView = (EditText) findViewById(R.id.email);
    mEmailView.setText(mEmail);

    mPasswordView = (EditText) findViewById(R.id.password);
    mPasswordView.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
            if (id == R.id.login || id == EditorInfo.IME_NULL) {
              attemptLogin();
              return true;
            }
            return false;
          }
        });

    mLoginFormView = findViewById(R.id.login_form);
    mLoginStatusView = findViewById(R.id.login_status);
    mLoginStatusMessageView = (TextView) findViewById(R.id.login_status_message);
    mLoginStatusMessageView.setTypeface(mTypefaceRobotoRegular);
  }
Example #2
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   super.onCreateOptionsMenu(menu);
   getMenuInflater().inflate(R.menu.signin, menu);
   return true;
 }