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

The following examples show how to use android.support.v4.app.ActivityCompat#finishAfterTransition() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SplashActivity.java    From AndroidBlueprints with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    if (Utils.hasLollipop()) requestWindowFeature(Window.FEATURE_CONTENT_TRANSITIONS);
    super.onCreate(savedInstanceState);

    if (Utils.hasLollipop()) {
        getWindow().setExitTransition(new Fade());
    }

    //TODO: Remove after evaluation testing
    try {
        Thread.sleep(2000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

    Intent intent = new Intent(this, MainActivity.class);
    ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(this);
    ActivityCompat.startActivity(this, intent, options.toBundle());
    ActivityCompat.finishAfterTransition(this);
}
 
Example 2
Source File: BaseActivity.java    From PainlessMusicPlayer with Apache License 2.0 6 votes vote down vote up
@Override
public boolean navigateUpTo(final Intent upIntent) {
    ComponentName destInfo = upIntent.getComponent();
    if (destInfo == null) {
        destInfo = upIntent.resolveActivity(getPackageManager());
        if (destInfo == null) {
            return false;
        }
    }

    if (shouldUpRecreateTask(upIntent)) {
        startActivity(upIntent);
        finish();
    } else {
        ActivityCompat.finishAfterTransition(this);
    }
    return true;
}
 
Example 3
Source File: QuizActivity.java    From android-topeka with Apache License 2.0 6 votes vote down vote up
@Override
public void onClick(final View v) {
    int i = v.getId();
    if (i == R.id.fab_quiz) {
        startQuizFromClickOn(v);

    } else if (i == R.id.submitAnswer) {
        submitAnswer();

    } else if (i == R.id.quiz_done) {
        ActivityCompat.finishAfterTransition(QuizActivity.this);

    } else if (i == R.id.back) {
        onBackPressed();

    } else {
        throw new UnsupportedOperationException(
                "OnClick has not been implemented for " + getResources().
                        getResourceName(v.getId()));
    }
}
 
Example 4
Source File: BaseActivity.java    From PainlessMusicPlayer with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            final Intent parent = getParentActivityIntent();
            if (parent != null) {
                if (!navigateUpTo(getParentActivityIntent())) {
                    ActivityCompat.finishAfterTransition(this);
                }
            } else {
                ActivityCompat.finishAfterTransition(this);
            }
            return true;

        default:
            return super.onOptionsItemSelected(item);
    }
}
 
Example 5
Source File: PackageDetailActivity.java    From apkextractor with GNU General Public License v3.0 5 votes vote down vote up
private void checkHeightAndFinish(){
    if(Build.VERSION.SDK_INT>=28){ //根布局项目太多时低版本Android会引发一个底层崩溃。版本号暂定28
        ActivityCompat.finishAfterTransition(this);
    }else {
        if(((AssemblyView)findViewById(R.id.package_detail_assemble)).getIsExpanded()){
            finish();
        }else{
            ActivityCompat.finishAfterTransition(this);
        }
    }
}
 
Example 6
Source File: MainActivity.java    From Awesome-WanAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressedSupport() {
    if (getSupportFragmentManager().getBackStackEntryCount() > 1) {
        pop();
    } else {
        ActivityCompat.finishAfterTransition(this);
    }
}
 
Example 7
Source File: RecentActivity.java    From GoogleFitExample with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    switch (id) {
        case android.R.id.home:
            ActivityCompat.finishAfterTransition(this);
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 8
Source File: VideoPlayerDetailedActivity.java    From ZoomPreviewPicture with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {
    if (exoPlayerManager.onBackPressed()) {
        ActivityCompat.finishAfterTransition(this);
        exoPlayerManager.onDestroy();
    }
}
 
Example 9
Source File: AppDetailActivity.java    From apkextractor with GNU General Public License v3.0 5 votes vote down vote up
private void checkHeightAndFinish(){
    if(Build.VERSION.SDK_INT>=28){ //根布局项目太多时低版本Android会引发一个底层崩溃。版本号暂定28
        ActivityCompat.finishAfterTransition(this);
    }else {
        if(((AssemblyView)findViewById(R.id.app_detail_assembly)).getIsExpanded()){
            finish();
        }else{
            ActivityCompat.finishAfterTransition(this);
        }
    }
}
 
Example 10
Source File: PlayerDetailsActivity.java    From android with Apache License 2.0 5 votes vote down vote up
@Override public boolean onOptionsItemSelected(MenuItem item) {
  int itemId = item.getItemId();
  if (itemId == android.R.id.home) {
    ActivityCompat.finishAfterTransition(this);
  } else if (itemId == R.id.action_replace) {
    startActivityForResult(TeamPlayersActivity.newIntent(this, player, club), REQUEST_REPLACE);
  }
  return true;
}
 
Example 11
Source File: AddEntryActivity.java    From GoogleFitExample with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    switch (id) {
        case android.R.id.home:
            // Reverse animation back to previous activity
            ActivityCompat.finishAfterTransition(this);
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 12
Source File: TimePickerActivity.java    From ESeal with Apache License 2.0 4 votes vote down vote up
@Override
public void onBackPressed() {
    super.onBackPressed();
    ActivityCompat.finishAfterTransition(this);
}
 
Example 13
Source File: FreightTrackGoogleMapFragment.java    From ESeal with Apache License 2.0 4 votes vote down vote up
private void signOut(boolean isSave) {
    PreferencesHelper.signOut(getContext(), isSave);
    LoginActivity.start(getActivity(), isSave);
    ActivityCompat.finishAfterTransition(getActivity());
}
 
Example 14
Source File: FreightTrackMapActivity.java    From ESeal with Apache License 2.0 4 votes vote down vote up
@Override
public void onBackPressed() {
    super.onBackPressed();
    ScanNfcDeviceActivity.start(this);
    ActivityCompat.finishAfterTransition(this);
}
 
Example 15
Source File: FreightTrackMapFragment.java    From ESeal with Apache License 2.0 4 votes vote down vote up
private void signOut(boolean isSave) {
    PreferencesHelper.signOut(getContext(), isSave);
    LoginActivity.start(getActivity(), isSave);
    ActivityCompat.finishAfterTransition(getActivity());
}
 
Example 16
Source File: ScanNfcDeviceActivity.java    From ESeal with Apache License 2.0 4 votes vote down vote up
private void signOut(boolean isSave) {
    PreferencesHelper.signOut(this, isSave);
    LoginActivity.start(this, isSave);
    ActivityCompat.finishAfterTransition(this);
}
 
Example 17
Source File: ScanNfcDeviceFragment.java    From ESeal with Apache License 2.0 4 votes vote down vote up
@Override
public void showDeviceDetailsUi(DeviceSearchSuggestion deviceSearchSuggestion) {
    FreightTrackMapActivity.start(getContext(), deviceSearchSuggestion);
    ActivityCompat.finishAfterTransition(getActivity());
}
 
Example 18
Source File: DetailsActivity.java    From journaldev with MIT License 4 votes vote down vote up
@Override
public void onBackPressed() {
    ActivityCompat.finishAfterTransition(this);
}
 
Example 19
Source File: MainActivity.java    From ESeal with Apache License 2.0 4 votes vote down vote up
private void signOut(boolean isSave) {
    MobclickAgent.onProfileSignOff();
    PreferencesHelper.signOut(this, isSave);
    LoginActivity.start(this, isSave);
    ActivityCompat.finishAfterTransition(this);
}
 
Example 20
Source File: QueueActivity.java    From PainlessMusicPlayer with Apache License 2.0 4 votes vote down vote up
private void onQueueEmpty() {
    ActivityCompat.finishAfterTransition(this);
}