mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 12:19:54 +01:00
Finish if back button is pressed in SignOutFragment.
This commit is contained in:
@@ -12,7 +12,7 @@ import javax.annotation.Nullable;
|
|||||||
|
|
||||||
public class SignOutFragment extends BaseFragment {
|
public class SignOutFragment extends BaseFragment {
|
||||||
|
|
||||||
private static final String TAG = SignOutFragment.class.getName();
|
public static final String TAG = SignOutFragment.class.getName();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater,
|
public View onCreateView(LayoutInflater inflater,
|
||||||
@@ -30,5 +30,4 @@ public class SignOutFragment extends BaseFragment {
|
|||||||
public void injectFragment(ActivityComponent component) {
|
public void injectFragment(ActivityComponent component) {
|
||||||
// no need to inject
|
// no need to inject
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import android.os.Bundle;
|
|||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.design.widget.NavigationView;
|
import android.support.design.widget.NavigationView;
|
||||||
import android.support.design.widget.NavigationView.OnNavigationItemSelectedListener;
|
import android.support.design.widget.NavigationView.OnNavigationItemSelectedListener;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
@@ -218,19 +219,23 @@ public class NavDrawerActivity extends BriarActivity implements
|
|||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (drawerLayout.isDrawerOpen(START)) {
|
if (drawerLayout.isDrawerOpen(START)) {
|
||||||
drawerLayout.closeDrawer(START);
|
drawerLayout.closeDrawer(START);
|
||||||
} else if (getSupportFragmentManager().getBackStackEntryCount() == 0 &&
|
} else {
|
||||||
getSupportFragmentManager()
|
FragmentManager fm = getSupportFragmentManager();
|
||||||
.findFragmentByTag(ContactListFragment.TAG) == null) {
|
if (fm.findFragmentByTag(SignOutFragment.TAG) != null) {
|
||||||
|
finish();
|
||||||
|
} else if (fm.getBackStackEntryCount() == 0
|
||||||
|
&& fm.findFragmentByTag(ContactListFragment.TAG) == null) {
|
||||||
/*
|
/*
|
||||||
* This makes sure that the first fragment (ContactListFragment) the
|
* This makes sure that the first fragment (ContactListFragment) the
|
||||||
* user sees is the same as the last fragment the user sees before
|
* user sees is the same as the last fragment the user sees before
|
||||||
* exiting. This models the typical Google navigation behaviour such
|
* exiting. This models the typical Google navigation behaviour such
|
||||||
* as in Gmail/Inbox.
|
* as in Gmail/Inbox.
|
||||||
*/
|
*/
|
||||||
startFragment(ContactListFragment.newInstance(),
|
startFragment(ContactListFragment.newInstance(),
|
||||||
R.id.nav_btn_contacts);
|
R.id.nav_btn_contacts);
|
||||||
} else {
|
} else {
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user