android.app.Fragment#setEnterTransition ( )源码实例Demo

下面列出了android.app.Fragment#setEnterTransition ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: trekarta   文件: MainActivity.java
@Override
public void showMarkerInformation(@NonNull GeoPoint point, @Nullable String name) {
    if (mFragmentManager.getBackStackEntryCount() > 0) {
        popAll();
    }
    Bundle args = new Bundle(3);
    args.putDouble(MarkerInformation.ARG_LATITUDE, point.getLatitude());
    args.putDouble(MarkerInformation.ARG_LONGITUDE, point.getLongitude());
    args.putString(MarkerInformation.ARG_NAME, name);
    Fragment fragment = Fragment.instantiate(this, MarkerInformation.class.getName(), args);
    fragment.setEnterTransition(new Slide());
    FragmentTransaction ft = mFragmentManager.beginTransaction();
    ft.replace(R.id.contentPanel, fragment, "markerInformation");
    ft.addToBackStack("markerInformation");
    ft.commit();
    updateMapViewArea();
}
 
源代码2 项目: trekarta   文件: MainActivity.java
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();
}
 
源代码3 项目: trekarta   文件: MainActivity.java
private void onTrackDetails(Track track, boolean current) {
    Fragment fragment = mFragmentManager.findFragmentByTag("trackInformation");
    if (fragment == null) {
        fragment = Fragment.instantiate(this, TrackInformation.class.getName());
        Slide slide = new Slide(mSlideGravity);
        // Required to sync with FloatingActionButton
        slide.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime));
        fragment.setEnterTransition(slide);
        FragmentTransaction ft = mFragmentManager.beginTransaction();
        ft.replace(R.id.contentPanel, fragment, "trackInformation");
        ft.addToBackStack("trackInformation");
        ft.commit();
        updateMapViewArea();
    }
    ((TrackInformation) fragment).setTrack(track, current);
    mViews.extendPanel.setForeground(getDrawable(R.drawable.dim));
    mViews.extendPanel.getForeground().setAlpha(0);
    ObjectAnimator anim = ObjectAnimator.ofInt(mViews.extendPanel.getForeground(), "alpha", 0, 255);
    anim.setDuration(500);
    anim.start();
}
 
源代码4 项目: trekarta   文件: MainActivity.java
@Override
public void onRouteDetails(Route route) {
    Fragment fragment = mFragmentManager.findFragmentByTag("routeInformation");
    if (fragment == null) {
        fragment = Fragment.instantiate(this, RouteInformation.class.getName());
        Slide slide = new Slide(mSlideGravity);
        // Required to sync with FloatingActionButton
        slide.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime));
        fragment.setEnterTransition(slide);
        FragmentTransaction ft = mFragmentManager.beginTransaction();
        ft.replace(R.id.contentPanel, fragment, "routeInformation");
        ft.addToBackStack("routeInformation");
        ft.commit();
        updateMapViewArea();
    }
    ((RouteInformation) fragment).setRoute(route);
    mViews.extendPanel.setForeground(getDrawable(R.drawable.dim));
    mViews.extendPanel.getForeground().setAlpha(0);
    ObjectAnimator anim = ObjectAnimator.ofInt(mViews.extendPanel.getForeground(), "alpha", 0, 255);
    anim.setDuration(500);
    anim.start();
}
 
源代码5 项目: trekarta   文件: MainActivity.java
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();
}
 
源代码6 项目: trekarta   文件: MainActivity.java
@SuppressLint("ClickableViewAccessibility")
@Override
public void onWaypointDetails(Waypoint waypoint, boolean fromList) {
    Bundle args = new Bundle(3);
    args.putBoolean(WaypointInformation.ARG_DETAILS, fromList);
    if (fromList || mLocationState != LocationState.DISABLED) {
        if (mLocationState != LocationState.DISABLED && mLocationService != null) {
            Location location = mLocationService.getLocation();
            args.putDouble(WaypointInformation.ARG_LATITUDE, location.getLatitude());
            args.putDouble(WaypointInformation.ARG_LONGITUDE, location.getLongitude());
        } else {
            MapPosition position = mMap.getMapPosition();
            args.putDouble(WaypointInformation.ARG_LATITUDE, position.getLatitude());
            args.putDouble(WaypointInformation.ARG_LONGITUDE, position.getLongitude());
        }
    }

    Fragment fragment = mFragmentManager.findFragmentByTag("amenityInformation");
    if (fragment != null) {
        mFragmentManager.popBackStack("amenityInformation", FragmentManager.POP_BACK_STACK_INCLUSIVE);
    }
    fragment = mFragmentManager.findFragmentByTag("waypointInformation");
    if (fragment == null) {
        fragment = Fragment.instantiate(this, WaypointInformation.class.getName(), args);
        Slide slide = new Slide(Gravity.BOTTOM);
        slide.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime));
        fragment.setEnterTransition(slide);
        FragmentTransaction ft = mFragmentManager.beginTransaction();
        ft.replace(R.id.bottomSheetPanel, fragment, "waypointInformation");
        ft.addToBackStack("waypointInformation");
        ft.commit();
    }
    ((WaypointInformation) fragment).setWaypoint(waypoint);
    mViews.extendPanel.setForeground(getDrawable(R.drawable.dim));
    mViews.extendPanel.getForeground().setAlpha(0);
    ObjectAnimator anim = ObjectAnimator.ofInt(mViews.extendPanel.getForeground(), "alpha", 0, 255);
    anim.setDuration(500);
    anim.start();
}
 
源代码7 项目: trekarta   文件: MainActivity.java
@Override
public void onFeatureDetails(long id, boolean fromList) {
    Bundle args = new Bundle(3);
    //args.putBoolean(AmenityInformation.ARG_DETAILS, fromList);

    if (fromList || mLocationState != LocationState.DISABLED) {
        if (mLocationState != LocationState.DISABLED && mLocationService != null) {
            Location location = mLocationService.getLocation();
            args.putDouble(AmenityInformation.ARG_LATITUDE, location.getLatitude());
            args.putDouble(AmenityInformation.ARG_LONGITUDE, location.getLongitude());
        } else {
            MapPosition position = mMap.getMapPosition();
            args.putDouble(AmenityInformation.ARG_LATITUDE, position.getLatitude());
            args.putDouble(AmenityInformation.ARG_LONGITUDE, position.getLongitude());
        }
    }

    Fragment fragment = mFragmentManager.findFragmentByTag("waypointInformation");
    if (fragment != null) {
        mFragmentManager.popBackStack("waypointInformation", FragmentManager.POP_BACK_STACK_INCLUSIVE);
    }
    fragment = mFragmentManager.findFragmentByTag("amenityInformation");
    if (fragment == null) {
        fragment = Fragment.instantiate(this, AmenityInformation.class.getName(), args);
        Slide slide = new Slide(Gravity.BOTTOM);
        // Required to sync with FloatingActionButton
        slide.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime));
        fragment.setEnterTransition(slide);
        FragmentTransaction ft = mFragmentManager.beginTransaction();
        ft.replace(R.id.bottomSheetPanel, fragment, "amenityInformation");
        ft.addToBackStack("amenityInformation");
        ft.commit();
        updateMapViewArea();
    }
    ((AmenityInformation) fragment).setPreferredLanguage(Configuration.getLanguage());
    ((AmenityInformation) fragment).setAmenity(id);
    mViews.extendPanel.setForeground(getDrawable(R.drawable.dim));
    mViews.extendPanel.getForeground().setAlpha(0);
    ObjectAnimator anim = ObjectAnimator.ofInt(mViews.extendPanel.getForeground(), "alpha", 0, 255);
    anim.setDuration(500);
    anim.start();
}