Newer
Older
CosmosClient / app / src / main / java / com / example / cosmosclient / views / SigninActivity.java
k-morimoto on 4 Jun 2019 2 KB 変数名とidを変更
package com.example.cosmosclient.views;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.example.cosmosclient.R;

import retrofit2.Retrofit;
import retrofit2.converter.jackson.JacksonConverterFactory;

public class SigninActivity extends AppCompatActivity {

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

        //各種IDを取得
        Button SigninButton = findViewById(R.id.SigninButton);
        Button SignupButton = findViewById(R.id.SignupButton);
        final EditText NameText = findViewById(R.id.NameText);
        final EditText PasswordText = findViewById(R.id.PasswordText);
        Button ForgotPasswordButton = findViewById(R.id.ForgotPasswordButton);

        //retrofitの処理
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl("nitta-lab-www.is.konan-u.ac.jp")
                .addConverterFactory(JacksonConverterFactory.create())
                .build();
        //interfaceから実装を取得
        Signin signin = retrofit.create(Signin.class);

        //Sign inボタンの処理
        SigninButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getApplication(), GroupList.class);
                startActivity(intent);
                finish();
            }
        });

        //サインアップ画面への遷移処理
        SignupButton.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                Intent intent = new Intent(getApplication(), SignupActivity.class);
                startActivity(intent);
                finish();
            }
        });

        //パスワード再登録画面への遷移処理
        ForgotPasswordButton.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                Intent intent = new Intent(getApplication(), ForgotPasswordActivity.class);
                startActivity(intent);
                //finish();
            }
        });
    }
}