List of usage examples for android.app Activity overridePendingTransition
public void overridePendingTransition(int enterAnim, int exitAnim)
From source file:org.mariotaku.twidere.util.ThemeUtils.java
public static void overrideNormalActivityCloseAnimation(final Activity activity) { @SuppressWarnings("ConstantConditions") final TypedArray a = activity.obtainStyledAttributes(null, ANIM_CLOSE_STYLE_ATTRS, 0, android.R.style.Animation_Activity); final int activityCloseEnterAnimation = a.getResourceId(0, 0); final int activityCloseExitAnimation = a.getResourceId(1, 0); a.recycle();//w w w . j a v a 2 s.c o m activity.overridePendingTransition(activityCloseEnterAnimation, activityCloseExitAnimation); }
From source file:com.artemchep.horario.ui.widgets.SwipeBackLayout.java
private void finish() { if (finishListener != null) { finishListener.onFinish();//from w ww . j ava 2 s . com } else { Activity act = (Activity) getContext(); act.finish(); act.overridePendingTransition(0, android.R.anim.fade_out); } }
From source file:de.vanita5.twittnuker.util.ThemeUtils.java
public static void overrideActivityOpenAnimation(final Activity activity) { TypedArray a = activity.obtainStyledAttributes(new int[] { android.R.attr.windowAnimationStyle }); final int windowAnimationStyleResId = a.getResourceId(0, 0); a.recycle();// w ww . j a va 2s . c om // Now retrieve the resource ids of the actual animations used in the // animation style pointed to by // the window animation resource id. a = activity.obtainStyledAttributes(windowAnimationStyleResId, ANIM_OPEN_STYLE_ATTRS); final int activityOpenEnterAnimation = a.getResourceId(0, 0); final int activityOpenExitAnimation = a.getResourceId(1, 0); a.recycle(); activity.overridePendingTransition(activityOpenEnterAnimation, activityOpenExitAnimation); }
From source file:de.vanita5.twittnuker.util.ThemeUtils.java
public static void overrideActivityCloseAnimation(final Activity activity) { TypedArray a = activity.obtainStyledAttributes(new int[] { android.R.attr.windowAnimationStyle }); final int windowAnimationStyleResId = a.getResourceId(0, 0); a.recycle();//from w w w. j a v a 2 s. com // Now retrieve the resource ids of the actual animations used in the // animation style pointed to by // the window animation resource id. a = activity.obtainStyledAttributes(windowAnimationStyleResId, ANIM_CLOSE_STYLE_ATTRS); final int activityCloseEnterAnimation = a.getResourceId(0, 0); final int activityCloseExitAnimation = a.getResourceId(1, 0); a.recycle(); activity.overridePendingTransition(activityCloseEnterAnimation, activityCloseExitAnimation); }
From source file:net.gsantner.opoc.preference.GsPreferenceFragmentCompat.java
protected void restartActivity() { Activity activity; if (isAdded() && (activity = getActivity()) != null) { Intent intent = getActivity().getIntent(); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION); activity.overridePendingTransition(0, 0); activity.finish();//ww w .ja va 2 s. c o m activity.overridePendingTransition(0, 0); startActivity(intent); } }
From source file:com.github.ppamorim.dragger.DraggerView.java
private void finish() { Context context = getContext(); if (context instanceof Activity) { Activity activity = (Activity) context; if (!activity.isFinishing()) { activity.overridePendingTransition(0, android.R.anim.fade_out); activity.finish();/* w w w . j ava 2 s. co m*/ } } }
From source file:com.ubuntuone.android.files.activity.FilesActivity.java
public static void showFrom(Activity activity) { final Intent intent = new Intent(activity, FilesActivity.class); activity.startActivity(intent);//from w w w.j av a2 s . c o m activity.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); }
From source file:com.shafiq.mytwittle.App.java
public void restartApp(Activity currentActivity) { Intent intent = getBaseContext().getPackageManager() .getLaunchIntentForPackage(getBaseContext().getPackageName()); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_CLEAR_TASK); currentActivity.overridePendingTransition(0, 0); currentActivity.startActivity(intent); }
From source file:io.digibyte.tools.animation.BRAnimator.java
public static void openScanner(Activity app, int requestID) { try {//from ww w . j av a2s . c om if (app == null) return; // Check if the camera permission is granted if (ContextCompat.checkSelfPermission(app, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { // Should we show an explanation? if (ActivityCompat.shouldShowRequestPermissionRationale(app, Manifest.permission.CAMERA)) { BRDialog.showCustomDialog(app, app.getString(R.string.Send_cameraUnavailabeTitle_android), app.getString(R.string.Send_cameraUnavailabeMessage_android), app.getString(R.string.AccessibilityLabels_close), null, new BRDialogView.BROnClickListener() { @Override public void onClick(BRDialogView brDialogView) { brDialogView.dismiss(); } }, null, null, 0); } else { // No explanation needed, we can request the permission. ActivityCompat.requestPermissions(app, new String[] { Manifest.permission.CAMERA }, BRConstants.CAMERA_REQUEST_ID); } } else { // Permission is granted, open camera Intent intent = new Intent(app, ScanQRActivity.class); app.startActivityForResult(intent, requestID); app.overridePendingTransition(R.anim.fade_up, R.anim.fade_down); } } catch (Exception e) { e.printStackTrace(); } }
From source file:br.com.viniciuscr.notification2android.mediaPlayer.MusicUtils.java
static void activateTab(Activity a, int id) { Intent intent = new Intent(Intent.ACTION_PICK); switch (id) { case R.id.artisttab: intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/artistalbum"); break;// w w w . j a v a 2s . com case R.id.albumtab: intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/album"); break; case R.id.songtab: intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/track"); break; case R.id.playlisttab: intent.setDataAndType(Uri.EMPTY, MediaStore.Audio.Playlists.CONTENT_TYPE); break; case R.id.nowplaying: // intent = new Intent(a, MediaPlaybackActivity.class); // a.startActivity(intent); // fall through and return default: return; } intent.putExtra("withtabs", true); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); a.startActivity(intent); a.finish(); a.overridePendingTransition(0, 0); }