mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2026-03-10 18:55:03 +00:00
Sign out button works with one click
This commit is contained in:
@@ -149,7 +149,7 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
|
|||||||
DrawerLayout drawer = findViewById(R.id.drawer_layout);
|
DrawerLayout drawer = findViewById(R.id.drawer_layout);
|
||||||
NavigationView navigationView = findViewById(R.id.nav_view);
|
NavigationView navigationView = findViewById(R.id.nav_view);
|
||||||
mAppBarConfiguration = new AppBarConfiguration.Builder(
|
mAppBarConfiguration = new AppBarConfiguration.Builder(
|
||||||
R.id.nav_home, R.id.nav_profile)
|
R.id.nav_home, R.id.nav_profile, R.id.nav_logout)
|
||||||
.setDrawerLayout(drawer)
|
.setDrawerLayout(drawer)
|
||||||
.build();
|
.build();
|
||||||
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
|
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
|
||||||
@@ -174,20 +174,14 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onClickSignout(MenuItem m) {
|
public void onClickSignout(MenuItem m) {
|
||||||
m.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
try {
|
||||||
@Override
|
am.signOutUser();
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
Intent intent = new Intent(MainActivity.this, com.example.listify.ui.LoginPage.class);
|
||||||
try {
|
startActivity(intent);
|
||||||
am.signOutUser();
|
}
|
||||||
Intent intent = new Intent(MainActivity.this, com.example.listify.ui.LoginPage.class);
|
catch (Exception e) {
|
||||||
startActivity(intent);
|
Log.i("Authentication", e.toString());
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
|
||||||
Log.i("Authentication", e.toString());
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:tint="?attr/colorControlNormal">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M10.09,15.59L11.5,17l5,-5 -5,-5 -1.41,1.41L12.67,11H3v2h9.67l-2.58,2.59zM19,3H5c-1.11,0 -2,0.9 -2,2v4h2V5h14v14H5v-4H3v4c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2z"/>
|
||||||
|
</vector>
|
||||||
@@ -17,7 +17,8 @@
|
|||||||
<item
|
<item
|
||||||
android:id="@+id/nav_logout"
|
android:id="@+id/nav_logout"
|
||||||
android:title="Sign out"
|
android:title="Sign out"
|
||||||
android:onClick="onClickSignout" />
|
android:onClick="onClickSignout"
|
||||||
|
android:icon="@drawable/ic_baseline_exit_to_app_24"/>
|
||||||
|
|
||||||
<!-- <item-->
|
<!-- <item-->
|
||||||
<!-- android:id="@+id/nav_gallery"-->
|
<!-- android:id="@+id/nav_gallery"-->
|
||||||
|
|||||||
Reference in New Issue
Block a user