diff --git a/app/src/main/java/org/ntlab/acanthus_client/views/title/TitleActivity.java b/app/src/main/java/org/ntlab/acanthus_client/views/title/TitleActivity.java index fac1d56..52e1cc8 100644 --- a/app/src/main/java/org/ntlab/acanthus_client/views/title/TitleActivity.java +++ b/app/src/main/java/org/ntlab/acanthus_client/views/title/TitleActivity.java @@ -34,6 +34,7 @@ init(); HandlerTest(); } + //////////////////////////////////////////////////////////////////// public void HandlerTest() { Handler handler = new Handler(); @@ -41,17 +42,19 @@ @Override public void run() { Acanthus acanthus = (Acanthus) getApplication(); - titleViewModel.LoginToken(acanthus,acanthus.getEmail(),acanthus.getPassword()); + titleViewModel.LoginToken(acanthus, acanthus.getEmail(), acanthus.getPassword()); } }; - handler.postDelayed( runnable, 5000 ); + handler.postDelayed(runnable, 5000); } + ///////////////////////////////////////////////////////////// private void init() { binding = ActivityTitleBinding.inflate(getLayoutInflater()); startObserve(); falseLoginObserve(); } + // VMの監視開始 //3秒間の画面表示 private void startObserve() { @@ -63,18 +66,25 @@ } }); } - private void falseLoginObserve(){ + + private void falseLoginObserve() { titleViewModel = new ViewModelProvider(this).get(TitleViewModel.class); - titleViewModel.getLoginstatus().observe(this, new Observer() { + titleViewModel.getLoginStatus().observe(this, new Observer() { @Override - public void onChanged(Boolean loginstatus) { + public void onChanged(Boolean loginStatus) { falseLogin(); } }); } - private void succeedLogin() { transitionActivity(new MainActivity()); } - private void falseLogin(){transitionActivity(new SignUpActivity());} + private void succeedLogin() { + transitionActivity(new MainActivity()); + } + + private void falseLogin() { + transitionActivity(new SignUpActivity()); + } + private void transitionActivity(AppCompatActivity appCompatActivity) { Intent intent = new Intent(getApplication(), appCompatActivity.getClass()); startActivity(intent);