android.transition.Fade Java Examples
The following examples show how to use
android.transition.Fade.
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: DetailActivity.java From animation-samples with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_detail); postponeEnterTransition(); TransitionSet transitions = new TransitionSet(); Slide slide = new Slide(Gravity.BOTTOM); slide.setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.linear_out_slow_in)); slide.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime)); transitions.addTransition(slide); transitions.addTransition(new Fade()); getWindow().setEnterTransition(transitions); Intent intent = getIntent(); sharedElementCallback = new DetailSharedElementEnterCallback(intent); setEnterSharedElementCallback(sharedElementCallback); initialItem = intent.getIntExtra(IntentUtil.SELECTED_ITEM_POSITION, 0); setUpViewPager(intent.<Photo>getParcelableArrayListExtra(IntentUtil.PHOTO)); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setNavigationOnClickListener(navigationOnClickListener); super.onCreate(savedInstanceState); }
Example #2
Source File: MainActivity.java From trekarta with GNU General Public License v3.0 | 6 votes |
private void onTrackProperties(String path) { logger.debug("onTrackProperties({})", path); //TODO Think of better way to find appropriate track for (FileDataSource source : mData) { if (source.path.equals(path)) { mEditedTrack = source.tracks.get(0); break; } } if (mEditedTrack == null) return; Bundle args = new Bundle(2); args.putString(TrackProperties.ARG_NAME, mEditedTrack.name); args.putInt(TrackProperties.ARG_COLOR, mEditedTrack.style.color); Fragment fragment = Fragment.instantiate(this, TrackProperties.class.getName(), args); fragment.setEnterTransition(new Fade()); FragmentTransaction ft = mFragmentManager.beginTransaction(); ft.replace(R.id.contentPanel, fragment, "trackProperties"); ft.addToBackStack("trackProperties"); ft.commit(); updateMapViewArea(); }
Example #3
Source File: Demo0Fragment.java From Android-UtilCode with Apache License 2.0 | 6 votes |
@Override public void initView(Bundle savedInstanceState, View view) { Random random = new Random(); FragmentUtils.setBackgroundColor(this, Color.rgb(random.nextInt(256), random.nextInt(256), random.nextInt(256))); btnShowAboutFragment = (Button) view.findViewById(R.id.btn_show_about_fragment); btnShowAboutFragment.setOnClickListener(this); view.findViewById(R.id.btn_add_hide).setOnClickListener(this); view.findViewById(R.id.btn_add_show).setOnClickListener(this); view.findViewById(R.id.btn_add_child).setOnClickListener(this); view.findViewById(R.id.btn_pop_to_root).setOnClickListener(this); view.findViewById(R.id.btn_pop_add).setOnClickListener(this); view.findViewById(R.id.btn_hide_show).setOnClickListener(this); view.findViewById(R.id.btn_replace).setOnClickListener(this); ivSharedElement = (ImageView) view.findViewById(R.id.iv_shared_element); tvAboutFragment = (TextView) view.findViewById(R.id.tv_about_fragment); demo0Fragment = this; sharedElement = new FragmentUtils.SharedElement(ivSharedElement, getString(R.string.fragment_transition)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { setExitTransition(new Fade()); } }
Example #4
Source File: LiveStreamActivity.java From Pocket-Plays-for-Twitch with GNU General Public License v3.0 | 6 votes |
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) private TransitionSet constructTransitions() { int[] slideTargets = {R.id.ChatRecyclerView, R.id.chat_input, R.id.chat_input_divider}; Transition slideTransition = new Slide(Gravity.BOTTOM); Transition fadeTransition = new Fade(); for (int slideTarget : slideTargets) { slideTransition.addTarget(slideTarget); fadeTransition.excludeTarget(slideTarget, true); } TransitionSet set = new TransitionSet(); set.addTransition(slideTransition); set.addTransition(fadeTransition); return set; }
Example #5
Source File: MainActivity.java From trekarta with GNU General Public License v3.0 | 6 votes |
@Override public void onDataSourceSelected(@NonNull DataSource source) { Bundle args = new Bundle(3); if (mLocationState != LocationState.DISABLED && mLocationService != null) { Location location = mLocationService.getLocation(); args.putDouble(DataList.ARG_LATITUDE, location.getLatitude()); args.putDouble(DataList.ARG_LONGITUDE, location.getLongitude()); args.putBoolean(DataList.ARG_CURRENT_LOCATION, true); } else { MapPosition position = mMap.getMapPosition(); args.putDouble(DataList.ARG_LATITUDE, position.getLatitude()); args.putDouble(DataList.ARG_LONGITUDE, position.getLongitude()); args.putBoolean(DataList.ARG_CURRENT_LOCATION, false); } args.putInt(DataList.ARG_HEIGHT, mViews.extendPanel.getHeight()); DataList fragment = (DataList) Fragment.instantiate(this, DataList.class.getName(), args); fragment.setDataSource(source); FragmentTransaction ft = mFragmentManager.beginTransaction(); fragment.setEnterTransition(new Fade()); ft.add(R.id.extendPanel, fragment, "dataList"); ft.addToBackStack("dataList"); ft.commit(); }
Example #6
Source File: MainActivity.java From Android-Developer-Fundamentals-Version-2 with GNU General Public License v3.0 | 6 votes |
public void animationsAndTransitions(View view) { switch (view.getId()) { case R.id.image_circle: Intent intent = new Intent(this, MainActivity.class); Explode explode = new Explode(); explode.setDuration(400); getWindow().setExitTransition(explode); intent.putExtra(ANIMATION, EXPLODE_ANIMATION); ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this); startActivity(intent, options.toBundle()); break; case R.id.image_line: Intent intent2 = new Intent(this, MainActivity.class); intent2.putExtra(ANIMATION, FADE_TRANSITION); Fade fade = new Fade(); fade.setDuration(400); getWindow().setExitTransition(fade); startActivity(intent2, ActivityOptions.makeSceneTransitionAnimation(this).toBundle()); break; case R.id.image_square: Animation rotateAnimation = AnimationUtils.loadAnimation(this, R.anim.anim_rotate); mYellowSquare.startAnimation(rotateAnimation); break; case R.id.image_android: Intent intent3 = new Intent(MainActivity.this, SecondActivity.class); ActivityOptions options2 = ActivityOptions.makeSceneTransitionAnimation(this, Pair.create((View) mGreenAndroid, "swap_shared_transition_android_icon"), Pair.create((View) mYellowSquare, "swap_shared_transition_square") ); startActivity(intent3, options2.toBundle()); break; default: break; } }
Example #7
Source File: MainActivity.java From Android-Developer-Fundamentals-Version-2 with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mYellowSquare = findViewById(R.id.image_square); mGreenAndroid = findViewById(R.id.image_android); if (getIntent().hasExtra(ANIMATION)) { switch (getIntent().getStringExtra(ANIMATION)) { case EXPLODE_ANIMATION: Explode explode = new Explode(); getWindow().setEnterTransition(explode); break; case FADE_TRANSITION: Fade fade = new Fade(); getWindow().setEnterTransition(fade); break; default: break; } } }
Example #8
Source File: MainActivity.java From FlexibleAdapter with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { if (Utils.hasLollipop()) requestWindowFeature(Window.FEATURE_CONTENT_TRANSITIONS); super.onCreate(savedInstanceState); if (Utils.hasLollipop()) { getWindow().setEnterTransition(new Fade()); } setContentView(R.layout.activity_main); if (BuildConfig.DEBUG) { FlexibleAdapter.enableLogs(Level.VERBOSE); } else { FlexibleAdapter.enableLogs(Level.SUPPRESS); } Log.v("onCreate"); // Initialize Toolbar, Drawer & FAB initializeToolbar(); initializeDrawer(); initializeFab(); // Initialize Fragment containing Adapter & RecyclerView initializeFragment(savedInstanceState); }
Example #9
Source File: SplashActivity.java From AndroidBlueprints with Apache License 2.0 | 6 votes |
@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 #10
Source File: ScreenCoordinator.java From native-navigation with MIT License | 6 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void setupFragmentForSharedElement( Fragment outFragment, Fragment inFragment, FragmentTransaction transaction, Bundle options) { FragmentSharedElementTransition transition = new FragmentSharedElementTransition(); inFragment.setSharedElementEnterTransition(transition); inFragment.setSharedElementReturnTransition(transition); Fade fade = new Fade(); inFragment.setEnterTransition(fade); inFragment.setReturnTransition(fade); ViewGroup rootView = (ViewGroup) outFragment.getView(); ViewGroup transitionGroup = ViewUtils.findViewGroupWithTag( rootView, R.id.react_shared_element_group_id, options.getString(TRANSITION_GROUP)); AutoSharedElementCallback.addSharedElementsToFragmentTransaction(transaction, transitionGroup); }
Example #11
Source File: StreamActivity.java From Twire with GNU General Public License v3.0 | 6 votes |
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) private TransitionSet constructTransitions() { int[] slideTargets = {R.id.ChatRecyclerView, R.id.chat_input, R.id.chat_input_divider}; Transition slideTransition = new Slide(Gravity.BOTTOM); Transition fadeTransition = new Fade(); for (int slideTarget : slideTargets) { slideTransition.addTarget(slideTarget); fadeTransition.excludeTarget(slideTarget, true); } TransitionSet set = new TransitionSet(); set.addTransition(slideTransition); set.addTransition(fadeTransition); return set; }
Example #12
Source File: GalleryFragment.java From animation-samples with Apache License 2.0 | 6 votes |
public GalleryFragment() { final Fade fade = new Fade(); fade.addTarget(R.id.appbar); Explode explode = new Explode(); explode.excludeTarget(R.id.appbar, true); Elevation elevation = new Elevation(); elevation.addTarget(R.id.gallery_card); elevation.setStartDelay(250); // arbitrarily chosen delay TransitionSet exit = new TransitionSet(); exit.addTransition(fade); exit.addTransition(explode); exit.addTransition(elevation); setExitTransition(exit); }
Example #13
Source File: ReadActivity.java From Jreader with GNU General Public License v2.0 | 5 votes |
/** * 设置转换动画 在5.0系统自身已经带有这种效果 */ @TargetApi(21) private void setupWindowAnimations() { Fade fade = new Fade(); fade.setDuration(500); getWindow().setEnterTransition(fade); Slide slide = new Slide(); slide.setDuration(500); getWindow().setReturnTransition(fade); }
Example #14
Source File: MainActivity.java From TutosAndroidFrance with MIT License | 5 votes |
private void setupWindowAnimations() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Explode explode = new Explode(); getWindow().setExitTransition(explode); Fade fade = new Fade(); getWindow().setReenterTransition(fade); } }
Example #15
Source File: TabManager.java From ForPDA with GNU General Public License v3.0 | 5 votes |
public void add(TabFragment tabFragment, View sharedElement, Fragment fragment) { if (tabFragment == null) return; String check = null; if (tabFragment.getConfiguration().isAlone()) { check = getTagContainClass(tabFragment.getClass()); } if (check != null) { select(check); return; } activeTag = TAB_PREFIX.concat(Long.toString(System.currentTimeMillis())); FragmentTransaction transaction = fragmentManager.beginTransaction(); hideTabs(transaction); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { tabFragment.setSharedElementEnterTransition(new DetailsTransition()); tabFragment.setEnterTransition(new Fade()); fragment.setExitTransition(new Fade()); tabFragment.setSharedElementReturnTransition(new DetailsTransition()); } transaction.addSharedElement(sharedElement, "detailsCover"); transaction.add(R.id.fragments_container, tabFragment, activeTag).commit(); fragmentManager.executePendingTransactions(); updateFragmentList(); activeIndex = existingFragments.indexOf(tabFragment); tabListener.onChange(); tabListener.onAddTab(tabFragment); }
Example #16
Source File: DetailFragment.java From animation-samples with Apache License 2.0 | 5 votes |
/** * Create a new instance with details for a given {@link Gallery}. * * @param context The context this runs in. * @param gallery The gallery of which the details should be displayed. * @return A newly instantiated fragment. */ public static DetailFragment newInstance(@NonNull Context context, @NonNull Gallery gallery, @NonNull CameraPosition cameraPosition) { DetailFragment fragment = new DetailFragment(); Bundle args = new Bundle(); args.putParcelable(IntentKeys.GALLERY, gallery); args.putParcelable(IntentKeys.CAMERA_POSITION, cameraPosition); fragment.setArguments(args); final TransitionInflater inflater = TransitionInflater.from(context); fragment.setSharedElementEnterTransition( inflater.inflateTransition(R.transition.detail_shared_enter)); fragment.setEnterTransition(new Fade()); return fragment; }
Example #17
Source File: TransitionKitKat.java From Noyze with Apache License 2.0 | 5 votes |
@Override public Object getAudioTransition() { final ChangeText tc = new ChangeText(); tc.setChangeBehavior(ChangeText.CHANGE_BEHAVIOR_OUT_IN); final TransitionSet inner = new TransitionSet(); inner.addTransition(tc).addTransition(new ChangeBounds()); final TransitionSet tg = new TransitionSet(); tg.addTransition(new Fade(Fade.OUT)).addTransition(inner). addTransition(new Fade(Fade.IN)); tg.setOrdering(TransitionSet.ORDERING_SEQUENTIAL); tg.setDuration(TRANSITION_DURATION); return tg; }
Example #18
Source File: AutoSharedElementCallback.java From native-navigation with MIT License | 5 votes |
@TargetApi(TARGET_API) private Transition getDefaultTransition() { TransitionSet set = new TransitionSet(); set.addTransition(new ChangeBounds()); set.addTransition(new Fade()); set.addTransition(new ChangeImageTransform()); set.setInterpolator(new FastOutSlowInInterpolator()); return set; }
Example #19
Source File: TransitionUtil.java From android with Apache License 2.0 | 5 votes |
/** * Returns a modified enter transition that excludes the navigation bar and status * bar as targets during the animation. This ensures that the navigation bar and * status bar won't appear to "blink" as they fade in/out during the transition. */ @TargetApi(Build.VERSION_CODES.KITKAT) public static Transition makeFadeTransition() { return new Fade() .excludeTarget(android.R.id.navigationBarBackground, true) .excludeTarget(android.R.id.statusBarBackground, true); }
Example #20
Source File: MainActivity.java From trekarta with GNU General Public License v3.0 | 5 votes |
private void onWaypointProperties(Waypoint waypoint) { mEditedWaypoint = waypoint; Bundle args = new Bundle(2); args.putString(WaypointProperties.ARG_NAME, mEditedWaypoint.name); args.putInt(WaypointProperties.ARG_COLOR, mEditedWaypoint.style.color); Fragment fragment = Fragment.instantiate(this, WaypointProperties.class.getName(), args); fragment.setEnterTransition(new Fade()); FragmentTransaction ft = mFragmentManager.beginTransaction(); ft.replace(R.id.contentPanel, fragment, "waypointProperties"); ft.addToBackStack("waypointProperties"); ft.commit(); updateMapViewArea(); }
Example #21
Source File: MainActivity.java From trekarta with GNU General Public License v3.0 | 5 votes |
@SuppressLint("RestrictedApi") @Override public FloatingActionButton enableActionButton() { if (mViews.listActionButton.getVisibility() == View.VISIBLE) mViews.listActionButton.setVisibility(View.INVISIBLE); TransitionManager.beginDelayedTransition(mViews.coordinatorLayout, new Fade()); mViews.actionButton.setVisibility(View.VISIBLE); return mViews.actionButton; }
Example #22
Source File: MainActivity.java From trekarta with GNU General Public License v3.0 | 5 votes |
@SuppressLint("RestrictedApi") @Override public FloatingActionButton enableListActionButton() { TransitionManager.beginDelayedTransition(mViews.coordinatorLayout, new Fade()); mViews.listActionButton.setVisibility(View.VISIBLE); return mViews.listActionButton; }
Example #23
Source File: SplashActivity.java From FlexibleAdapter with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { if (Utils.hasLollipop()) requestWindowFeature(Window.FEATURE_CONTENT_TRANSITIONS); super.onCreate(savedInstanceState); if (Utils.hasLollipop()) { getWindow().setExitTransition(new Fade()); } Intent intent = new Intent(this, MainActivity.class); ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(this); ActivityCompat.startActivity(this, intent, options.toBundle()); ActivityCompat.finishAfterTransition(this); }
Example #24
Source File: TransitionKitKat.java From Noyze with Apache License 2.0 | 5 votes |
@Override public Object getAudioTransition() { final ChangeText tc = new ChangeText(); tc.setChangeBehavior(ChangeText.CHANGE_BEHAVIOR_OUT_IN); final TransitionSet inner = new TransitionSet(); inner.addTransition(tc).addTransition(new ChangeBounds()); final TransitionSet tg = new TransitionSet(); tg.addTransition(new Fade(Fade.OUT)).addTransition(inner). addTransition(new Fade(Fade.IN)); tg.setOrdering(TransitionSet.ORDERING_SEQUENTIAL); tg.setDuration(TRANSITION_DURATION); return tg; }
Example #25
Source File: MaterialAnimationActivity.java From UltimateAndroid with Apache License 2.0 | 5 votes |
private void setupWindowAnimations() { Explode explode = new Explode(); explode.setDuration(2000); getWindow().setExitTransition(explode); Fade fade = new Fade(); getWindow().setReenterTransition(fade); }
Example #26
Source File: CacheControlActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
private void updateStorageUsageRow() { View view = layoutManager.findViewByPosition(storageUsageRow); if (view instanceof StroageUsageView) { StroageUsageView stroageUsageView = ((StroageUsageView) view); long currentTime = System.currentTimeMillis(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && currentTime - fragmentCreateTime > 250) { TransitionSet transition = new TransitionSet(); ChangeBounds changeBounds = new ChangeBounds(); changeBounds.setDuration(250); changeBounds.excludeTarget(stroageUsageView.legendLayout,true); Fade in = new Fade(Fade.IN); in.setDuration(290); transition .addTransition(new Fade(Fade.OUT).setDuration(250)) .addTransition(changeBounds) .addTransition(in); transition.setOrdering(TransitionSet.ORDERING_TOGETHER); transition.setInterpolator(CubicBezierInterpolator.EASE_OUT); TransitionManager.beginDelayedTransition(listView, transition); } stroageUsageView.setStorageUsage(calculating, databaseSize, totalSize, totalDeviceFreeSize, totalDeviceSize); RecyclerView.ViewHolder holder = listView.findViewHolderForAdapterPosition(storageUsageRow); if (holder != null) { stroageUsageView.setEnabled(listAdapter.isEnabled(holder)); } } else { listAdapter.notifyDataSetChanged(); } }
Example #27
Source File: FadeAnimationActivity.java From AndroidDemoProjects with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); getWindow().setEnterTransition( new Fade() ); getWindow().setExitTransition( new Fade() ); setContentView(R.layout.activity_fade_animation); }
Example #28
Source File: CacheControlActivity.java From Telegram with GNU General Public License v2.0 | 5 votes |
private void updateStorageUsageRow() { View view = layoutManager.findViewByPosition(storageUsageRow); if (view instanceof StroageUsageView) { StroageUsageView stroageUsageView = ((StroageUsageView) view); long currentTime = System.currentTimeMillis(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && currentTime - fragmentCreateTime > 250) { TransitionSet transition = new TransitionSet(); ChangeBounds changeBounds = new ChangeBounds(); changeBounds.setDuration(250); changeBounds.excludeTarget(stroageUsageView.legendLayout,true); Fade in = new Fade(Fade.IN); in.setDuration(290); transition .addTransition(new Fade(Fade.OUT).setDuration(250)) .addTransition(changeBounds) .addTransition(in); transition.setOrdering(TransitionSet.ORDERING_TOGETHER); transition.setInterpolator(CubicBezierInterpolator.EASE_OUT); TransitionManager.beginDelayedTransition(listView, transition); } stroageUsageView.setStorageUsage(calculating, databaseSize, totalSize, totalDeviceFreeSize, totalDeviceSize); RecyclerView.ViewHolder holder = listView.findViewHolderForAdapterPosition(storageUsageRow); if (holder != null) { stroageUsageView.setEnabled(listAdapter.isEnabled(holder)); } } else { listAdapter.notifyDataSetChanged(); } }
Example #29
Source File: FileExplorerActivity.java From Camera-Roll-Android-App with Apache License 2.0 | 5 votes |
@Override public void onSwipeFinish(int dir) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().setReturnTransition(new TransitionSet() .setOrdering(TransitionSet.ORDERING_TOGETHER) .addTransition(new Slide(dir > 0 ? Gravity.TOP : Gravity.BOTTOM)) .addTransition(new Fade()) .setInterpolator(new AccelerateDecelerateInterpolator())); } this.finish(); }
Example #30
Source File: GradientColorsActivity.java From PercentageChartView with Apache License 2.0 | 5 votes |
private void setupLayoutAnimation() { Explode transition = new Explode(); transition.setDuration(600); transition.setInterpolator(new OvershootInterpolator(1f)); getWindow().setEnterTransition(transition); displayedMode = MODE_PIE; mConstraintSet = new ConstraintSet(); mConstraintSet.clone(mConstraintLayout); fade = new Fade(); fade.setDuration(400); }