‫Now let's continue with the journal list and set the recycler view.
‫Binding object.
‫Dot Recyclerview dot set has fixed size.
‫Too true.
‫Also, I need to add the layout.
‫Manager Recycler view.
‫Layout Manager.
‫Equal to.
‫Layout manager.
‫Linear layout manager and I will pass this as the context.
‫So this is a new linear layout manager passed to the recycler view layout manager.
‫I will initialize the posts array list.
‫Journal list equal to new ArrayList.
‫So array list of.
‫And here I will specify the data.
‫Of Jordan.
‫Now I will add a menu to our activity.
‫So here I will create a new new resource Android Resource Directory.
‫I will select menu, click okay and you can see the menu folder is added.
‫Now I will create a new menu resource.
‫I will name it as my menu and here I will go to the split mode and I will paste my menu and you can
‫see I can here have two options the plus sign and the sign out.
‫Okay, so two items you can download.
‫Also the resource, the source code from the resources folder.
‫Okay.
‫My target is to learn you and teach you the.
‫An algorithm, not the layouts and how to design things.
‫It's up to you to be creative.
‫Okay, now let's override Oncreate method.
‫Oncreate.
‫Options menu.
‫And here I will get.
‫Menu.
‫Inflator dot inflate and I'm inflating r dot menu dot menu.
‫And I will pass type menu.
‫Okay.
‫This is the Oncreate options menu.
‫Now on options.
‫Options item selected if the user clicked on one of these items of these menus.
‫There are two.
‫One for adding and a journal and one for signing out.
‫So I will use a switch here.
‫Switch.
‫Or when?
‫According to.
‫Item dot item ID.
‫And here I will start with.
‫or.id dot action add.
‫Then what I need to do.
‫I need to check if.
‫User doesn't equal to Null and firebase auth.
‫Dot does not equal to null.
‫Then what to do?
‫Start.
‫Activity.
‫I need to go and create add journal and new journal from where?
‫By using the new activity and I will create it now.
‫So I will create a new activity.
‫I will name it as add journal activity.
‫Click enter.
‫And here we go.
‫This is the activity that allows us to add journals to our firebase.
‫Later on.
‫We will.
‫Uh, we will edit the code and add the journal activity codes to this activity.
‫But now I am just moving to this activity.
‫I will create a new intent.
‫Var val intent equal to intent.
‫Dot intent.
‫And I will pass this and are.
‫Or the ad journal activity dot.
‫class.gov.
‫Start activity and.
‫Okay, This is how we move from one activity to another.
‫Then if there's not, I will use the second option.
‫So if it is r.id dot action sign out.
‫If it is the case, if the user clicked on the sign out, I need to sign out from the firebase.
‫So.
‫If user doesn't equal to null and.
‫Firebase.
‫And Firebase OAuth doesn't equal to null if there is a valid user and login login user.
‫I need to use firebase auth dot sign out.
‫This is the function that allows us to sign out from the current user and the Start activity.
‫It's the same as before, the same intent.
‫And this time I need to go back to the journal list activity.
‫Okay.
‫Or the main activity I will use the main activity like login.
‫So the user will be signed out from the journals list.
‫Okay.
‫Then I will return super dot on options item selected.
‫And this is the item.