Java Code Examples for android.app.Fragment#setEnterTransition()

The following examples show how to use android.app.Fragment#setEnterTransition() . 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: MainActivity.java    From trekarta with GNU General Public License v3.0 6 votes vote down vote up
@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();
}
 
Example 2
Source File: MainActivity.java    From trekarta with GNU General Public License v3.0 6 votes vote down vote up
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: MainActivity.java    From trekarta with GNU General Public License v3.0 6 votes vote down vote up
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();
}
 
Example 4
Source File: MainActivity.java    From trekarta with GNU General Public License v3.0 6 votes vote down vote up
@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();
}
 
Example 5
Source File: MainActivity.java    From trekarta with GNU General Public License v3.0 5 votes vote down vote up
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 6
Source File: MainActivity.java    From trekarta with GNU General Public License v3.0 5 votes vote down vote up
@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();
}
 
Example 7
Source File: MainActivity.java    From trekarta with GNU General Public License v3.0 4 votes vote down vote up
@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();
}