Java Code Examples for android.support.v4.app.ActivityCompat.finishAffinity()

The following are Jave code examples for showing how to use finishAffinity() of the android.support.v4.app.ActivityCompat class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: whatanime-android   File: Navigator.java   Source Code and License Vote up 6 votes
public static void goToMain(AppCompatActivity activity, View view) {
    ActivityOptionsCompat aoc;
    if (AndroidVersions.isLollipop() && view != null) {
        aoc = ActivityOptionsCompat.makeClipRevealAnimation(view,
                0,
                0,
                view.getWidth(),
                view.getHeight());
    } else {
        aoc = ActivityOptionsCompat.makeBasic();
    }
    Intent intent = new Intent(activity, MainActivity.class);
    ActivityCompat.startActivity(activity, intent, aoc.toBundle());
    ActivityCompat.finishAffinity(activity);
}
 
Example 2
Project: boohee_v5.6   File: AppCompatActivity.java   Source Code and License Vote up 6 votes
public boolean onSupportNavigateUp() {
    Intent upIntent = getSupportParentActivityIntent();
    if (upIntent == null) {
        return false;
    }
    if (supportShouldUpRecreateTask(upIntent)) {
        TaskStackBuilder b = TaskStackBuilder.create(this);
        onCreateSupportNavigateUpTaskStack(b);
        onPrepareSupportNavigateUpTaskStack(b);
        b.startActivities();
        try {
            ActivityCompat.finishAffinity(this);
        } catch (IllegalStateException e) {
            finish();
        }
    } else {
        supportNavigateUpTo(upIntent);
    }
    return true;
}
 
Example 3
Project: MyNotes   File: EditProfileActivity.java   Source Code and License Vote up 5 votes
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case android.R.id.home:
            finish();
            break;
        case R.id.changePasswordItem:
            new AlertDialog.Builder(this)
                .setTitle(R.string.change_password_button)
                .setMessage(R.string.edit_password_dialog_contet)
                .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        String email = CheckLoginActivity.user.getEmail();
                        emailSent(email);
                    }
                })
                .setNegativeButton(android.R.string.cancel, null)
                .create().show();
            break;
        case R.id.signoutItem:
            FirebaseAuth mAuth = FirebaseAuth.getInstance();
            mAuth.signOut();
            Intent it = new Intent(this, CheckLoginActivity.class);
            startActivity(it);
            ActivityCompat.finishAffinity(this);
            break;
    }
    return true;
}
 
Example 4
Project: AndroidSnooper   File: SnooperBaseActivity.java   Source Code and License Vote up 5 votes
private BroadcastReceiver finishActivityReceiver(final Activity activity) {
  return new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
      ActivityCompat.finishAffinity(activity);
    }
  };
}
 
Example 5
Project: android_client_php_backend   File: ProfileFragment.java   Source Code and License Vote up 5 votes
private void logout() {
    SharedPreferences.Editor editor = pref.edit();
    editor.putBoolean(Util.IS_LOGGED_IN, false);
    editor.putString(Util.EMAIL, "");
    editor.putString(Util.NAME, "");
    editor.putString(Util.UNIQUE_ID, "");
    editor.apply();
    ActivityCompat.finishAffinity(getActivity());
    Intent intent = new Intent(getActivity(), SplashActivity.class);
    intent.putExtra("finish", true);
    startActivity(intent);
}
 
Example 6
Project: atlant-android   File: HomeActivity.java   Source Code and License Vote up 5 votes
@Override
public void onBackPressed() {
  if (drawerHelper.isDrawerOpen()) {
    drawerHelper.closeDrawer();
  } else {
    ActivityCompat.finishAffinity(this);
  }
}
 
Example 7
Project: atlant-android   File: LoginActivity.java   Source Code and License Vote up 5 votes
@Override
public void onBackPressed() {
  super.onBackPressed();
  if (type == TYPE_AUTHORISATION) {
    ActivityCompat.finishAffinity(this);
  }
}
 
Example 8
Project: atlant-android   File: BackupActivity.java   Source Code and License Vote up 5 votes
@Override
public void onBackPressed() {
  super.onBackPressed();
  ActivityCompat.finishAffinity(this);
}
 
Example 9
Project: MiPushFramework   File: WizardSPUtils.java   Source Code and License Vote up 4 votes
static void finishWizard (Activity context) {
    setShouldShowWizard(false, context);
    ActivityCompat.finishAffinity(context);
    context.startActivity(new Intent(context,
            MainActivity.class));
}
 
Example 10
Project: atlant-android   File: LoginSelectedAppActivity.java   Source Code and License Vote up 4 votes
@Override
public void onBackPressed() {
  super.onBackPressed();
  ActivityCompat.finishAffinity(this);
}