mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-15 18:28:47 +00:00
Sign out button works with one click
This commit is contained in:
parent
0934965306
commit
04636f3d25
@ -149,7 +149,7 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
|
||||
DrawerLayout drawer = findViewById(R.id.drawer_layout);
|
||||
NavigationView navigationView = findViewById(R.id.nav_view);
|
||||
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)
|
||||
.build();
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
});
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
@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
|
||||
android:id="@+id/nav_logout"
|
||||
android:title="Sign out"
|
||||
android:onClick="onClickSignout" />
|
||||
android:onClick="onClickSignout"
|
||||
android:icon="@drawable/ic_baseline_exit_to_app_24"/>
|
||||
|
||||
<!-- <item-->
|
||||
<!-- android:id="@+id/nav_gallery"-->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user