diff --git a/Listify/app/src/main/java/com/example/listify/MainActivity.java b/Listify/app/src/main/java/com/example/listify/MainActivity.java
index d18c4f1..ea01bac 100644
--- a/Listify/app/src/main/java/com/example/listify/MainActivity.java
+++ b/Listify/app/src/main/java/com/example/listify/MainActivity.java
@@ -202,6 +202,23 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
});
}
+ public void onClickSignout(MenuItem m) {
+ m.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ try {
+ am.signOutUser();
+ Intent intent = new Intent(MainActivity.this, com.example.listify.ui.LoginPage.class);
+ startActivity(intent);
+ }
+ catch (Exception e) {
+ Log.i("Authentication", e.toString());
+ }
+ return false;
+ }
+ });
+ }
+
@Override
public void sendNewListName(String name) {
Properties configs = new Properties();
diff --git a/Listify/app/src/main/java/com/example/listify/ui/home/HomeFragment.java b/Listify/app/src/main/java/com/example/listify/ui/home/HomeFragment.java
index 985d430..28178c9 100644
--- a/Listify/app/src/main/java/com/example/listify/ui/home/HomeFragment.java
+++ b/Listify/app/src/main/java/com/example/listify/ui/home/HomeFragment.java
@@ -29,28 +29,12 @@ import java.io.IOException;
import java.util.Properties;
public class HomeFragment extends Fragment {
- private Button toLoginPage;
private Button toDeleteAccountPage;
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_home, container, false);
- toLoginPage = (Button) root.findViewById(R.id.button1);
- toLoginPage.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- try {
- am.signOutUser();
- }
- catch (Exception e) {
- Log.i("Authentication", e.toString());
- }
- Intent intent = new Intent(getActivity(), com.example.listify.ui.LoginPage.class);
- startActivity(intent);
- }
- });
-
- toDeleteAccountPage = (Button) root.findViewById(R.id.button2);
+ toDeleteAccountPage = (Button) root.findViewById(R.id.button);
toDeleteAccountPage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
diff --git a/Listify/app/src/main/res/layout/fragment_home.xml b/Listify/app/src/main/res/layout/fragment_home.xml
index 2726aad..a938244 100644
--- a/Listify/app/src/main/res/layout/fragment_home.xml
+++ b/Listify/app/src/main/res/layout/fragment_home.xml
@@ -7,17 +7,7 @@
tools:context=".ui.home.HomeFragment">
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:id="@+id/nav_logout"
+ android:title="Sign out"
+ android:onClick="onClickSignout" />
\ No newline at end of file