Activity Flow

Finally we update the navigation between activities. The following figure shows the transitions.

In State /action New Activity
MainActivity User is not signed (check in onStart()) SignInActivity
MainActivity User selects corresponding entry in options menu ManageAccountActivity
MainActivity - User selects corresponding entry in options menu User clicks on entry in postlist PostActivity
SignInActivity User clicks on CreateAccount CreateAccount

Find some remarks on implementation below:

Activity Back Stack

If activity A starts a new activity B, then B is pushed to the activity stack. If the user presses the Back button, that new activity is finished and popped off the stack. We will not dive into the details of managing the activity stack. You can find detailed information here.

MainActivity

After starting the app, we check the authentication state. If user is not authenticated, jump to SignInActivity immediately. Add this code to the method onStart()

 FirebaseUser currentUser = mAuth.getCurrentUser();
        if (currentUser == null) {
            Log.d(TAG, "User not authenticated! ");
            Intent intent = new Intent(getApplication(),
                    SignInActivity.class);
            startActivity(intent);

        }

After a click in the respective entry of the options menu, navigate to ManageAccountActivityin the onOptionsItemSelected-method.

After a click in the respective entry of the options menu, navigate to PostActivityin the onOptionsItemSelected-method.

SignInActivity

The SignInActivityneeds the following changes:

  1. After successful logon the activity shall finish.
  2. A click on Create New Account shall start the CreateAccountActivity

CreateAccountActivity

The CreateAccountActivityneeds the following changes: after successful account creation the activity shall finish.

ManageAccountActivity

The ManageAccountActivityneeds the following changes:

  1. After SignOut the activity shall finish.
  2. After DeleteAccount the activity shall finish.
  3. In the first three textlines display
    • email
    • account verification state
    • Firebase user-id

PostActivity

The PostActivityneeds the following changes: after _posting _the activity shall finish

results matching ""

    No results matching ""